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
or QUERY
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.
Modifier and Type | Field and Description |
---|---|
static String |
AMPERSAND |
static String |
AMPERSAND_ESC |
static Debug |
debug |
String |
delimiter |
static String |
EQUAL |
static String |
QUERY |
static String |
SESS_DELIMITER |
static Hashtable |
sidHash |
static String |
SLASH_SESS_DELIMITER |
Constructor and Description |
---|
SessionEncodeURL()
Constructs
SessionEncodeURL |
Modifier and Type | Method and 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(javax.servlet.http.HttpServletRequest request)
Checks whether the encoded URL has session id or not.
|
static String |
getSidFromURL(javax.servlet.http.HttpServletRequest request,
String cookieName)
Checks whether the encoded URL has session id or not.
|
public static Debug debug
public final String delimiter
public static Hashtable sidHash
public static final String SESS_DELIMITER
public static final String SLASH_SESS_DELIMITER
public static final String QUERY
public static final String AMPERSAND
public static final String AMPERSAND_ESC
public static final String EQUAL
public static String encodeURL(String sidString, String url, short encodingScheme, boolean escape)
protocol://server:port/path?cookieName=cookieValue
if escape is false then no entity escaping of ampersand.
protocol://server:port/path?queryString& cookieName=cookieValueif escape is true then entity escaping of ampersand
protocol://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
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
or
SEMICOLON
)escape
- true
to escape ampersand.public static String getSidFromURL(javax.servlet.http.HttpServletRequest request)
request
- ,
HTTPServletRequestObjectpublic static String getSidFromURL(javax.servlet.http.HttpServletRequest request, String cookieName)
request
- HTTP Servlet Request.cookieName
- Cookie name.public static String buildCookieString(String url, String cookieStr, short encodingScheme, boolean escape)
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
or
SEMICOLON
).escape
- true
to escape ampersand.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.