Package org.apache.sling.api.wrappers
Class SlingRequestPaths
java.lang.Object
org.apache.sling.api.wrappers.SlingRequestPaths
This class is not a "wrapper" per se, but computes the correct path info,
request URI, etc. for included requests. When including a request via
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.static final StringDeprecated.UseRequestDispatcher.INCLUDE_PATH_INFOstatic final StringDeprecated.UseRequestDispatcher.INCLUDE_QUERY_STRINGstatic final StringDeprecated.UseRequestDispatcher.INCLUDE_REQUEST_URIstatic final StringDeprecated.UseRequestDispatcher.INCLUDE_SERVLET_PATH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetContextPath(jakarta.servlet.http.HttpServletRequest r) Return the context path for r, using the appropriate request attribute if the request is an included one.static StringgetContextPath(javax.servlet.http.HttpServletRequest r) Deprecated.static StringgetPathInfo(jakarta.servlet.http.HttpServletRequest r) Return the context path for r, using the appropriate request attribute if the request is an included one.static StringgetPathInfo(javax.servlet.http.HttpServletRequest r) Deprecated.static StringgetQueryString(jakarta.servlet.http.HttpServletRequest r) Return the query string for r, using the appropriate request attribute if the request is an included one.static StringgetQueryString(javax.servlet.http.HttpServletRequest r) Deprecated.static StringgetRequestURI(jakarta.servlet.http.HttpServletRequest r) Return the request URI for r, using the appropriate request attribute if the request is an included one.static StringgetRequestURI(javax.servlet.http.HttpServletRequest r) Deprecated.static StringgetServletPath(jakarta.servlet.http.HttpServletRequest r) Return the servlet path for r, using the appropriate request attribute if the request is an included one.static StringgetServletPath(javax.servlet.http.HttpServletRequest r) Deprecated.static booleanisIncluded(jakarta.servlet.http.HttpServletRequest r) True if r is an included request, in which case it has the INCLUDE_REQUEST_URI attributestatic booleanisIncluded(javax.servlet.http.HttpServletRequest r) Deprecated.
-
Field Details
-
INCLUDE_CONTEXT_PATH
Deprecated.UseRequestDispatcher.INCLUDE_CONTEXT_PATHAttribute name used by the RequestDispatcher to indicate the context path of the included request, as a String.- See Also:
-
INCLUDE_PATH_INFO
Deprecated.UseRequestDispatcher.INCLUDE_PATH_INFOAttribute name used by the RequestDispatcher to indicate the path info of the included request, as a String.- See Also:
-
INCLUDE_QUERY_STRING
Deprecated.UseRequestDispatcher.INCLUDE_QUERY_STRINGAttribute name used by the RequestDispatcher to indicate the query string of the included request, as a String.- See Also:
-
INCLUDE_REQUEST_URI
Deprecated.UseRequestDispatcher.INCLUDE_REQUEST_URIAttribute name used by the RequestDispatcher to indicate the request URI of the included request, as a String.- See Also:
-
INCLUDE_SERVLET_PATH
Deprecated.UseRequestDispatcher.INCLUDE_SERVLET_PATHAttribute name used by the RequestDispatcher to indicate the servlet path of the included request, as a String.- See Also:
-
-
Constructor Details
-
SlingRequestPaths
public SlingRequestPaths()
-
-
Method Details
-
getContextPath
Return the context path for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The context path.
-
getPathInfo
Return the context path for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The path info.
-
getQueryString
Return the query string for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The query string.
-
getRequestURI
Return the request URI for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The request uri.
-
getServletPath
Return the servlet path for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The servlet path.
-
isIncluded
public static boolean isIncluded(jakarta.servlet.http.HttpServletRequest r) True if r is an included request, in which case it has the INCLUDE_REQUEST_URI attribute- Parameters:
r- The request- Returns:
trueif this is an include.
-
getContextPath
Deprecated.Return the context path for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The context path.
-
getPathInfo
Deprecated.Return the context path for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The path info.
-
getQueryString
Deprecated.Return the query string for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The query string.
-
getRequestURI
Deprecated.Return the request URI for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The request uri.
-
getServletPath
Deprecated.Return the servlet path for r, using the appropriate request attribute if the request is an included one.- Parameters:
r- The request- Returns:
- The servlet path.
-
isIncluded
Deprecated.True if r is an included request, in which case it has the INCLUDE_REQUEST_URI attribute- Parameters:
r- The request- Returns:
trueif this is an include.
-
RequestDispatcher.INCLUDE_CONTEXT_PATH