|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.ServletResponseWrapper javax.servlet.http.HttpServletResponseWrapper org.apache.shiro.web.servlet.ShiroHttpServletResponse
public class ShiroHttpServletResponse
HttpServletResponse implementation to support URL Encoding of Shiro Session IDs.
It is only used when using Shiro's native Session Management configuration (and not when using the Servlet Container session configuration, which is Shiro's default in a web environment). Because the servlet container already performs url encoding of its own session ids, instances of this class are only needed when using Shiro native sessions. Note that this implementation relies in part on source code from the Tomcat 6.x distribution for encoding URLs for session ID URL Rewriting (we didn't want to re-invent the wheel). Since Shiro is also Apache 2.0 license, all regular licenses and conditions have remained in tact.
Field Summary |
---|
Constructor Summary | |
---|---|
ShiroHttpServletResponse(HttpServletResponse wrapped,
ServletContext context,
ShiroHttpServletRequest request)
|
Method Summary | |
---|---|
String |
encodeRedirectUrl(String s)
|
String |
encodeRedirectURL(String url)
Encode the session identifier associated with this response into the specified redirect URL, if necessary. |
String |
encodeUrl(String s)
|
String |
encodeURL(String url)
Encode the session identifier associated with this response into the specified URL, if necessary. |
ServletContext |
getContext()
|
ShiroHttpServletRequest |
getRequest()
|
protected boolean |
isEncodeable(String location)
Return true if the specified URL should be encoded with
a session identifier. |
static boolean |
isSchemeChar(char c)
Determine if the character is allowed in the scheme of a URI. |
void |
setContext(ServletContext context)
|
void |
setRequest(ShiroHttpServletRequest request)
|
protected String |
toEncoded(String url,
String sessionId)
Return the specified URL with the specified session identifier suitably encoded. |
Methods inherited from class javax.servlet.http.HttpServletResponseWrapper |
---|
addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, sendError, sendError, sendRedirect, setDateHeader, setHeader, setIntHeader, setStatus, setStatus |
Methods inherited from class javax.servlet.ServletResponseWrapper |
---|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getResponse, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale, setResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.ServletResponse |
---|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale |
Constructor Detail |
---|
public ShiroHttpServletResponse(HttpServletResponse wrapped, ServletContext context, ShiroHttpServletRequest request)
Method Detail |
---|
public ServletContext getContext()
public void setContext(ServletContext context)
public ShiroHttpServletRequest getRequest()
public void setRequest(ShiroHttpServletRequest request)
public String encodeRedirectURL(String url)
encodeRedirectURL
in interface HttpServletResponse
encodeRedirectURL
in class HttpServletResponseWrapper
url
- URL to be encodedpublic String encodeRedirectUrl(String s)
encodeRedirectUrl
in interface HttpServletResponse
encodeRedirectUrl
in class HttpServletResponseWrapper
public String encodeURL(String url)
encodeURL
in interface HttpServletResponse
encodeURL
in class HttpServletResponseWrapper
url
- URL to be encodedpublic String encodeUrl(String s)
encodeUrl
in interface HttpServletResponse
encodeUrl
in class HttpServletResponseWrapper
protected boolean isEncodeable(String location)
true
if the specified URL should be encoded with
a session identifier. This will be true if all of the following
conditions are met:
location
- Absolute URL to be validated
true
if the specified URL should be encoded with a session identifier, false
otherwise.public static boolean isSchemeChar(char c)
c
- the character to check
true
if the character is allowed in a URI scheme, false
otherwise.protected String toEncoded(String url, String sessionId)
url
- URL to be encoded with the session idsessionId
- Session id to be included in the encoded URL
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |