public class SlingRequestPaths
extends java.lang.Object
RequestDispatcher
, the Servlet API specifies that
target paths of the included request are available as request attributes.
Request.getPathInfo()
, for example will return the value for the
including request, *not* for the included one.
This class is not intended to be extended or instantiated because it just provides constants and static utility methods not intended to be overwritten.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
INCLUDE_CONTEXT_PATH
Attribute name used by the RequestDispatcher to indicate the context path
of the included request, as a String.
|
static java.lang.String |
INCLUDE_PATH_INFO
Attribute name used by the RequestDispatcher to indicate the path info of
the included request, as a String.
|
static java.lang.String |
INCLUDE_QUERY_STRING
Attribute name used by the RequestDispatcher to indicate the query string
of the included request, as a String.
|
static java.lang.String |
INCLUDE_REQUEST_URI
Attribute name used by the RequestDispatcher to indicate the request URI
of the included request, as a String.
|
static java.lang.String |
INCLUDE_SERVLET_PATH
Attribute name used by the RequestDispatcher to indicate the servlet path
of the included request, as a String.
|
Constructor and Description |
---|
SlingRequestPaths() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getContextPath(javax.servlet.http.HttpServletRequest r)
Return the context path for r, using the appropriate request attribute if
the request is an included one.
|
static java.lang.String |
getPathInfo(javax.servlet.http.HttpServletRequest r)
Return the context path for r, using the appropriate request attribute if
the request is an included one.
|
static java.lang.String |
getQueryString(javax.servlet.http.HttpServletRequest r)
Return the query string for r, using the appropriate request attribute if
the request is an included one.
|
static java.lang.String |
getRequestURI(javax.servlet.http.HttpServletRequest r)
Return the request URI for r, using the appropriate request attribute if
the request is an included one.
|
static java.lang.String |
getServletPath(javax.servlet.http.HttpServletRequest r)
Return the servlet path for r, using the appropriate request attribute if
the request is an included one.
|
static boolean |
isIncluded(javax.servlet.http.HttpServletRequest r)
True if r is an included request, in which case it has the
INCLUDE_REQUEST_URI attribute
|
public static final java.lang.String INCLUDE_CONTEXT_PATH
public static final java.lang.String INCLUDE_PATH_INFO
public static final java.lang.String INCLUDE_QUERY_STRING
public static final java.lang.String INCLUDE_REQUEST_URI
public static final java.lang.String INCLUDE_SERVLET_PATH
public static java.lang.String getContextPath(javax.servlet.http.HttpServletRequest r)
r
- The requestpublic static java.lang.String getPathInfo(javax.servlet.http.HttpServletRequest r)
r
- The requestpublic static java.lang.String getQueryString(javax.servlet.http.HttpServletRequest r)
r
- The requestpublic static java.lang.String getRequestURI(javax.servlet.http.HttpServletRequest r)
r
- The requestpublic static java.lang.String getServletPath(javax.servlet.http.HttpServletRequest r)
r
- The requestpublic static boolean isIncluded(javax.servlet.http.HttpServletRequest r)
r
- The requesttrue
if this is an include.Copyright © 2022 The Apache Software Foundation. All rights reserved.