I guess I am more saying, I'm pretty sure, by looking at Struts source code
(granted a week or so ago), that you can't do /*.  So I am suggesting to use
a filter.

But looking at a different piece of the source maybe the solution is to not
have a mapping specified at all.  Sounds ugly, dangerous; but there is a
comment in the source that states, " Use our servlet mapping, if one is
specified":



    /**
     * Return the form action converted into a server-relative URL.
     */
    public static String getActionMappingURL(String action, PageContext
pageContext) {

        HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
        StringBuffer value = new StringBuffer(request.getContextPath());
        ModuleConfig config =
            (ModuleConfig)
pageContext.getRequest().getAttribute(Globals.MODULE_KEY);
        if (config != null) {
            value.append(config.getPrefix());
        }

        // Use our servlet mapping, if one is specified
        String servletMapping =
            (String) pageContext.getAttribute(Globals.SERVLET_KEY,
PageContext.APPLICATION_SCOPE);
        if (servletMapping != null) {
            String queryString = null;
            int question = action.indexOf("?");
            if (question >= 0) {
                queryString = action.substring(question);
            }
            String actionMapping = getActionMappingName(action);
            if (servletMapping.startsWith("*.")) {
                value.append(actionMapping);
                value.append(servletMapping.substring(1));
            } else if (servletMapping.endsWith("/*")) {
                value.append(servletMapping.substring(0,
servletMapping.length() - 2));
                value.append(actionMapping);
            } else if (servletMapping.equals("/")) {
                value.append(actionMapping);
            }
            if (queryString != null) {
                value.append(queryString);
            }
        }

        // Otherwise, assume extension mapping is in use and extension is
        // already included in the action property
        else {
            if (!action.startsWith("/")) {
                value.append("/");
            }
            value.append(action);
        }

        // Return the completed value
        return (value.toString());
     }

-----Original Message-----
From: Paul Yunusov [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 13, 2003 6:02 PM
To: Struts Users Mailing List
Subject: Re: Mapping Struts controller servlet to webapp root: trouble

On August 13, 2003 05:40 pm, Bailey, Shane C. wrote:
> Do you want to add a filter which will look over every request prior to
> Struts getting any requests?  That might be one possibility.
>
> If you have never written a filter then one I know where you can get
source
> for is at securityfilter.sourceforge.net that one isn't doing necessarily
> what you want but it is a (working with source) example.

No, all I want is to route every request to a webapp through a Struts 
controller servlet. The only obvious option, which is mapping the servlet to

the "/*" pattern in web.xml, doesn't seem to work. That's why I am wondering

if Struts supports this kind of mapping or not, or if this is a bug.
Thanks,

Paul


>
> ----- Original Message -----
> From: "Paul Yunusov" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 13, 2003 11:51 AM
> Subject: Re: Mapping Struts controller servlet to webapp root: trouble
>
> > Thanks, I see how the way Struts parses URLs could confuse it. I want to
>
> map
>
> > Struts to the webapp's root because my webapp doesn't contain any static
> > content and I want to limit all requests to Struts-defined actions.
> >
> > Can anyone confirm Struts does not support "/*" mapping for its
> > controller servlet?
> >
> > Thank you,
> >
> > Paul
> >
> > > -----Original Message-----
> > > From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, August 13, 2003 11:05 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Mapping Struts controller servlet to webapp root: trouble
> > >
> > > I was wondering if anyone has heard of issues arising when the
> > > contoller
>
> is
>
> > > mapped to a webapp's root.
> > >
> > > I am talking about this:
> > >
> > > <servlet-mapping>
> > >   <servlet-name>action</servlet-name>
> > >   <url-pattern>/*</url-pattern>
> > > </servlet-mapping>
> > >
> > > where "action" is the Struts controller.
> > >
> > > Struts seems to return a 400 error with such mapping when it tries to
>
> make
>
> > > a
> > >
> > > forward from an Action instance saying that "the request was
>
> syntactically
>
> > > incorrect".
> > >
> > > <url-pattern>/struts/*</url-pattern> or
<url-pattern>*.do</url-pattern>
>
> are
>
> > > commong but I was wondering about the "/*" mapping. Anyone heard of
any
> > > issues with this?
> > > Thanks,
> > >
> > > Paul
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to