org.riotfamily.cachius.support
Class SessionCreationPreventingRequestWrapper

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.riotfamily.cachius.support.SessionCreationPreventingRequestWrapper
All Implemented Interfaces:
HttpServletRequest, ServletRequest

public class SessionCreationPreventingRequestWrapper
extends HttpServletRequestWrapper

HttpServletRequestWrapper that prevents the creation of new HTTP sessions. An IllegalStateException is thrown when getSession() or getSession(true) is invoked and no session existed at the time the wrapper was created.

Rationale: Cachius supports the caching of snippets that use URL rewriting for session tracking. It therefore stores two versions (one with rewritten URLs and one without) under different cache keys. Hence Cachius must know whether URL rewriting is used before a CacheItem is retrieved or created. This implies that cachable snippets must not create new sessions.

Since:
6.5
Author:
Felix Gnass [fgnass at neteye dot de]

Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
SessionCreationPreventingRequestWrapper(HttpServletRequest request)
           
 
Method Summary
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, 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.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

SessionCreationPreventingRequestWrapper

public SessionCreationPreventingRequestWrapper(HttpServletRequest request)
Method Detail

getSession

public HttpSession getSession()
Specified by:
getSession in interface HttpServletRequest
Overrides:
getSession in class HttpServletRequestWrapper

getSession

public HttpSession getSession(boolean create)
Specified by:
getSession in interface HttpServletRequest
Overrides:
getSession in class HttpServletRequestWrapper