org.apache.sling.api.wrappers
Class SlingRequestPaths

java.lang.Object
  extended by org.apache.sling.api.wrappers.SlingRequestPaths

public class SlingRequestPaths
extends Object

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.


Field Summary
static String INCLUDE_CONTEXT_PATH
          Attribute name used by the RequestDispatcher to indicate the context path of the included request, as a String.
static String INCLUDE_PATH_INFO
          Attribute name used by the RequestDispatcher to indicate the path info of the included request, as a String.
static String INCLUDE_QUERY_STRING
          Attribute name used by the RequestDispatcher to indicate the query string of the included request, as a String.
static String INCLUDE_REQUEST_URI
          Attribute name used by the RequestDispatcher to indicate the request URI of the included request, as a String.
static String INCLUDE_SERVLET_PATH
          Attribute name used by the RequestDispatcher to indicate the servlet path of the included request, as a String.
 
Constructor Summary
SlingRequestPaths()
           
 
Method Summary
static 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 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 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 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 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INCLUDE_CONTEXT_PATH

public static final String INCLUDE_CONTEXT_PATH
Attribute name used by the RequestDispatcher to indicate the context path of the included request, as a String.

See Also:
Constant Field Values

INCLUDE_PATH_INFO

public static final String INCLUDE_PATH_INFO
Attribute name used by the RequestDispatcher to indicate the path info of the included request, as a String.

See Also:
Constant Field Values

INCLUDE_QUERY_STRING

public static final String INCLUDE_QUERY_STRING
Attribute name used by the RequestDispatcher to indicate the query string of the included request, as a String.

See Also:
Constant Field Values

INCLUDE_REQUEST_URI

public static final String INCLUDE_REQUEST_URI
Attribute name used by the RequestDispatcher to indicate the request URI of the included request, as a String.

See Also:
Constant Field Values

INCLUDE_SERVLET_PATH

public static final String INCLUDE_SERVLET_PATH
Attribute name used by the RequestDispatcher to indicate the servlet path of the included request, as a String.

See Also:
Constant Field Values
Constructor Detail

SlingRequestPaths

public SlingRequestPaths()
Method Detail

getContextPath

public static 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.


getPathInfo

public static 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.


getQueryString

public static 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.


getRequestURI

public static 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.


getServletPath

public static 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.


isIncluded

public 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



Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.