public class HttpUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getRequestedPath(javax.servlet.http.HttpServletRequest request)
Get the path from the given request.
|
static java.lang.String |
getRequestedServletPath(javax.servlet.http.HttpServletRequest request)
Get the servlet path of the current request.
|
public static java.lang.String getRequestedPath(javax.servlet.http.HttpServletRequest request)
Get the path from the given request. This method is different from
HttpServletRequest.getRequestURI()
in that it concatenates and returns the servlet
path plus the path info from the request. These are usually the same, but in some cases they
are not.
One case where they are known to differ is when a request for a directory is forwarded by the
servlet container to a welcome file. In that case, HttpServletRequest.getRequestURI()
returns the path that was actually requested (e.g., "/"
), whereas the servlet path
plus path info is the path to the welcome file (e.g. "/index.jsp"
).
public static java.lang.String getRequestedServletPath(javax.servlet.http.HttpServletRequest request)
HttpServletRequest.getServletPath()
. If the given request is an include, then
the servlet path of the included resource is returned.? Copyright 2005-2006, Stripes Development Team.