"Holmes III, William S" wrote:

> Vadim,
>
> I'm not having problems with the *.do mappings.  My question was in the use
> of additional path information in the URL. It used to be that you could have
> information in between the mapped servlet name and the parameter list of the
> URL. You would then use getPathInfo() in your controller servlet to retrieve
> the information.
>
> For example:
> If you had *.do mapped to you controller servlet, and a HTML form that
> posted to "/Forward.do/here?method=get" then the controller servlet would be
> invoked and you could use the getPathInfo() method to find out that "/here"
> had been appended to the end of the servlet path.
>
> Now if you want to do something like this, you have to map *.do* and then
> parse the information yourself from the servlet path. Which makes me
> question what use getPathInfo() has.  Won't a call to this method always
> return null? Or is that just the case for mapped servlets?
>
> Maybe Craig or someone else on the list can answer this.
>

Unfortunately, the 2.2 servlet spec says that won't work.  Extension mapping is
defined only on the *last* slash-separated element of the request URI, so a request
posted to "/Forward.do/here?method=get" will return a 404 error on any 2.2 servlet
container.  For what it's worth, I use hidden variables or query string parameters
to pass extra stuff like this.

The getPathInfo() call is useful when you have servlets mapped to prefix patterns,
so if you mapped your controller servlet this way:

    <servlet-mapping>
        <servlet-name>Controller</servlet-name>
        <url-pattern>/do/*</url-pattern>
    </servlet-mapping>

then a request for "/do/Forward/here?method=get" would return values as follows:

    getServletPath returns "/do"
    getPathInfo returns "/Forward/here"
    getQueryString returns "method=get"

and you could parse the path info for the action selector + any extra path info.

This issue is already on the list to be looked at for the next version of the spec.

>
> --Bill
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to