Class SessionEncodeURL
- java.lang.Object
-
- com.iplanet.dpro.session.share.SessionEncodeURL
-
public class SessionEncodeURL extends Object
SessionEncodeURL
class encodes the URL with the cookie value as a query string or extra path info based on the encoding scheme.The cookie Value is written in the URL based on the encoding scheme specified. The Cookie Value could be written as path info separated by either a "/" OR ";" or as a query string.
If the encoding scheme is SLASH then the cookie value would be written in the URL as extra path info in the following format:
protocol://server:port/servletpath/<cookieName>=<cookieValue>? queryString
Note that this format works only if the path is a servlet, if a a JSP file is specified then web containers return with "File Not found" error. To rewrite links which are JSP files with cookie value use the
SEMICOLON
orQUERY
encoding scheme.If the encoding scheme is SEMICOLON then the cookie value would be written in the URL as extra path info in the following format:
protocol://server:port/path;<cookieName=cookieValue> ?queryString
Note that this is not supported in the servlet specification and some web containers do not support this.If the encoding scheme is QUERY then the cookie value would be written in the URL in the following format:
protocol://server:port/path?<cookieName>=<cookieValue> protocol://server:port/path?queryString&<cookieName>=<cookieValue>
This is the default and OpenAM always encodes in this format unless otherwise specified. If the URL passed in has query parameter then entity escaping of ampersand will be done before appending the cookie if the escape is true. Only the ampersand before appending cookie parameter will be entity escaped.
-
-
Constructor Summary
Constructors Constructor Description SessionEncodeURL()
ConstructsSessionEncodeURL
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
buildCookieString(String url, String cookieStr, short encodingScheme, boolean escape)
Constructs the cookie string based on the URL and cookie String passed.static String
createCookieString(String cookieName, String sessionID)
static String
encodeURL(String sidString, String url, short encodingScheme, boolean escape)
Encodes the URL with the cookie value as a query string or extra path info based on the encoding scheme. if encoding scheme is QUERY , encoded URL format will be :protocol://server:port/path?
static String
getSidFromURL(jakarta.servlet.http.HttpServletRequest request)
Checks whether the encoded URL has session id or not.static String
getSidFromURL(jakarta.servlet.http.HttpServletRequest request, String cookieName)
Checks whether the encoded URL has session id or not.
-
-
-
Field Detail
-
debug
public static Debug debug
-
delimiter
public final String delimiter
- See Also:
- Constant Field Values
-
sidHash
public static Hashtable sidHash
-
SESS_DELIMITER
public static final String SESS_DELIMITER
- See Also:
- Constant Field Values
-
SLASH_SESS_DELIMITER
public static final String SLASH_SESS_DELIMITER
- See Also:
- Constant Field Values
-
QUERY
public static final String QUERY
- See Also:
- Constant Field Values
-
AMPERSAND
public static final String AMPERSAND
- See Also:
- Constant Field Values
-
AMPERSAND_ESC
public static final String AMPERSAND_ESC
- See Also:
- Constant Field Values
-
EQUAL
public static final String EQUAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
encodeURL
public static String encodeURL(String sidString, String url, short encodingScheme, boolean escape)
Encodes the URL with the cookie value as a query string or extra path info based on the encoding scheme. if encoding scheme is QUERY , encoded URL format will be :protocol://server:port/path?cookieName=cookieValue
if escape is false then no entity escaping of ampersand.protocol://server:port/path?queryString& cookieName=cookieValue
if escape is true then entity escaping of ampersandprotocol://server:port/path?queryString&cookieName=cookieValue
if encoding scheme is
SLASH
,encodedURL
format will be :protocol://server:port/path/cookieName=cookieValue
if encoding scheme is
SEMICOLON
,encodedURL
format will be:protocol://server:port/path;cookieName=cookieValue
- Parameters:
sidString
- Session ID.url
- the URL to be encoded.encodingScheme
- how the cookie will be encoded in as query string or as extra path info (SLASH
orSEMICOLON
)escape
-true
to escape ampersand.- Returns:
- the URL encoded with the session ID.
-
getSidFromURL
public static String getSidFromURL(jakarta.servlet.http.HttpServletRequest request)
Checks whether the encoded URL has session id or not. And then extracts the Session Id from it.- Parameters:
request
- , HTTPServletRequestObject- Returns:
- the extracted SessionID
-
getSidFromURL
public static String getSidFromURL(jakarta.servlet.http.HttpServletRequest request, String cookieName)
Checks whether the encoded URL has session id or not. And then extracts the Session Id from it.- Parameters:
request
- HTTP Servlet Request.cookieName
- Cookie name.- Returns:
- the extracted Session ID
-
buildCookieString
public static String buildCookieString(String url, String cookieStr, short encodingScheme, boolean escape)
Constructs the cookie string based on the URL and cookie String passed.- Parameters:
url
- URL which needs to be rewritten.cookieStr
- Cookie name and cookie value.encodingScheme
- how the cookie will be encoded in as query string or as extra path info (SLASH
orSEMICOLON
).escape
-true
to escape ampersand.- Returns:
- encoded URL.
-
-