org.hippoecm.hst.container
Class HstContainerRequestImpl

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.hippoecm.hst.util.GenericHttpServletRequestWrapper
              extended by org.hippoecm.hst.container.HstContainerRequestImpl
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest, HstContainerRequest

public class HstContainerRequestImpl
extends GenericHttpServletRequestWrapper
implements HstContainerRequest

The HstContainerRequestImpl is a wrapper around the GenericHttpServletRequestWrapper. As the HstRequestProcessor is invoked from a Filter, the original HttpServletRequest does return an empty HttpServletRequest.getPathInfo(). However, in the context of HstRequestProcessor, the HttpServletRequest.getServletPath() is equivalent to ResolvedMount.getResolvedMountPath() and the HttpServletRequest.getPathInfo() equivalent to the HttpServletRequest.getRequestURI() after the HttpServletRequest.getServletPath() (and the same for HttpServletRequest.getPathTranslated() only then not decoded.).

Therefore, this HstContainerRequestImpl object has a setter setServletPath(String), that recomputes the getPathInfo(). When the constructor is called, the servletPath is set to an empty String (""). After for example a ResolvedMount is found, the setServletPath(String) can be called to recompute/reset the servletPath and pathInfo (and pathTranslated)

The getPathInfo() won't return the part in the GenericHttpServletRequestWrapper.getRequestURI() after the pathSuffixDelimiter. The delimiter itself won't be part of the getPathInfo() either. Also the return won't include any matrix parameters.

Version:
$Id$

Field Summary
 
Fields inherited from class org.hippoecm.hst.util.GenericHttpServletRequestWrapper
contextPath, pathInfo, pathTranslated, requestURI, requestURL, servletPath
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
HstContainerRequestImpl(javax.servlet.http.HttpServletRequest request, String pathSuffixDelimiter)
          Creates a wrapper HttpServletRequest with a HttpServletRequest.getServletPath() that is an empty String ("").
 
Method Summary
 String getPathInfo()
           
 String getPathSuffix()
          Returns path suffix splitted from the request URI by the specified path suffix delimiter.
 String getPathTranslated()
           
 StringBuffer getRequestURL()
           
 void setServletPath(String servletPath)
           Sets a new servletPath on the HttpServletRequest.
 
Methods inherited from class org.hippoecm.hst.util.GenericHttpServletRequestWrapper
getContextPath, getRequestURI, getServletPath, setContextPath, setPathInfo, setPathTranslated, setRequestURI, setRequestURL
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getQueryString, getRemoteUser, getRequestedSessionId, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Constructor Detail

HstContainerRequestImpl

public HstContainerRequestImpl(javax.servlet.http.HttpServletRequest request,
                               String pathSuffixDelimiter)
Creates a wrapper HttpServletRequest with a HttpServletRequest.getServletPath() that is an empty String (""). The HttpServletRequest.getPathInfo() will be the part of the HttpServletRequest.getRequestURI() after the HttpServletRequest.getContextPath() and before the getPathSuffix() and before the #MATRIX_PARAMETERS_DELIMITER

Parameters:
request -
pathSuffixDelimiter -
Method Detail

getPathSuffix

public String getPathSuffix()
Description copied from interface: HstContainerRequest
Returns path suffix splitted from the request URI by the specified path suffix delimiter.

Specified by:
getPathSuffix in interface HstContainerRequest
Returns:

getRequestURL

public StringBuffer getRequestURL()
Specified by:
getRequestURL in interface javax.servlet.http.HttpServletRequest
Overrides:
getRequestURL in class GenericHttpServletRequestWrapper

setServletPath

public void setServletPath(String servletPath)

Sets a new servletPath on the HttpServletRequest. For an HstRequest, the servletPath becomes the ResolvedMount.getResolvedMountPath() of the ResolvedMount belonging to the HstRequestContext.

When the ResolvedMount.getMount() returns a 'root' Mount, the servletPath is an empty string (""). Otherwise, it always starts with a slash "/".

Overrides:
setServletPath in class GenericHttpServletRequestWrapper
Parameters:
servletPath -
See Also:
ResolvedMount.getResolvedMountPath()

getPathInfo

public String getPathInfo()
Specified by:
getPathInfo in interface javax.servlet.http.HttpServletRequest
Overrides:
getPathInfo in class GenericHttpServletRequestWrapper

getPathTranslated

public String getPathTranslated()
Specified by:
getPathTranslated in interface javax.servlet.http.HttpServletRequest
Overrides:
getPathTranslated in class GenericHttpServletRequestWrapper


Copyright © 2008-2012 Hippo. All Rights Reserved.