Duane Morse wrote:
>
> Certain path-related methods seem to return curious results in JRun 3.0
> after servlet mapping.  For instance,
> if I map "/xyz" to "MyServlet", then getPathInfo() returns null,
> getServletPath() returns "/xyz", and
> getRequestURI() returns "/MyApp/xyz".  Of course, when invoking MyServlet by
> "/MyApp/servlet/MyServlet/xyz",
> getPathInfo() returns "/xyz", getServletPath() returns "/servlet/MyServlet",
> and getRequestURI() returns
> "/MyApp/servlet/MyServlet/xyz", which is what I expect.
>
> Are these results normal, or is JRun not following the spec?

These results are normal and expected. Here's Section 4.4 from the
Servlet 2.3 Specification:

"The request path that leads to a servlet servicing a request is
composed of many important sections. The following elements are obtained
from the request URI path and exposed via the request object:

"· Context Path: The path prefix associated with the ServletContext that
this servlet is a part of. If this context is the “default” context
rooted at the base of the web server’s URL namespace, this path will be
an empty string. Otherwise, this path starts with a ’/’ character but
does not end with a’/’ character.

"· Servlet Path: The path section that directly corresponds to the
mapping which activated this request. This path starts with a ’/’
character.

"· PathInfo: The part of the request path that is not part of the
Context Path or the Servlet Path.

"It is important to note that, except for URL encoding differences
between the request URI and the path parts, the following equation is
always true:

"requestURI = contextPath + servletPath + pathInfo"

The Servlet 2.2 Specification has the same words in section 5.4.

The extra path info is the stuff after the servlet path. If you map /xyz
to /servlet/MyServlet, then /xyz is not extra stuff after the servlet
path, it is the servlet path. When you access /servlet/MyServlet/xyz,
then /servlet/MyServlet is the path the activates the request, anything
after that is extra path info.

K Mukhar

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to