| java.lang.Object org.apache.cactus.internal.util.CookieUtil
CookieUtil | public class CookieUtil (Code) | | Utility methods to manipulate cookies and transform Cactus cookie objects
to HttpClient cookie objects.
version: $Id: CookieUtil.java 238991 2004-05-22 11:34:50Z vmassol $ since: 1.5 |
Method Summary | |
public static Header | createCookieHeader(String theDomain, String thePath, org.apache.commons.httpclient.Cookie[] theCookies) Create a HttpClient
Header for cookies that matches
the domain and path. | public static org.apache.commons.httpclient.Cookie | createHttpClientCookie(WebRequest theRequest, URL theUrl, Cookie theCactusCookie) Create a Commons-HttpClient cookie from a Cactus cookie, with information
from the web request and the URL. | public static org.apache.commons.httpclient.Cookie[] | createHttpClientCookies(WebRequest theRequest, URL theUrl) Transforms an array of Cactus cookies into an array of Commons-HttpClient
cookies, using information from the request and URL. | public static String | getCookieDomain(WebRequest theRequest, String theRealHost) Returns the domain that will be used to send the cookies. | public static String | getCookiePath(WebRequest theRequest, String theRealPath) Returns the path that will be used to validate if a cookie will be
sent or not. | public static int | getCookiePort(WebRequest theRequest, int theRealPort) Returns the port that will be used to send the cookies. | public static String | getCookieString(WebRequest theRequest, URL theUrl) |
createCookieHeader | public static Header createCookieHeader(String theDomain, String thePath, org.apache.commons.httpclient.Cookie[] theCookies) throws ClientException(Code) | | Create a HttpClient
Header for cookies that matches
the domain and path.
Parameters: theDomain - the cookie domain to match Parameters: thePath - the cookie path to match Parameters: theCookies - the list of potential cookies the HttpClient Header containing the matching cookies throws: ClientException - if no cookie was matching the domainand path |
createHttpClientCookie | public static org.apache.commons.httpclient.Cookie createHttpClientCookie(WebRequest theRequest, URL theUrl, Cookie theCactusCookie)(Code) | | Create a Commons-HttpClient cookie from a Cactus cookie, with information
from the web request and the URL.
Parameters: theRequest - The request Parameters: theUrl - The URL Parameters: theCactusCookie - The Cactus Cookie object The HttpClient cookie |
createHttpClientCookies | public static org.apache.commons.httpclient.Cookie[] createHttpClientCookies(WebRequest theRequest, URL theUrl)(Code) | | Transforms an array of Cactus cookies into an array of Commons-HttpClient
cookies, using information from the request and URL.
Parameters: theRequest - The request Parameters: theUrl - The URL The array of HttpClient cookies |
getCookieDomain | public static String getCookieDomain(WebRequest theRequest, String theRealHost)(Code) | | Returns the domain that will be used to send the cookies. If a host
was specified using setURL() then the domain will be
this host. Otherwise it will be the real redirector host.
Parameters: theRequest - the request containing all data to pass to the serverredirector. Parameters: theRealHost - the real host to which we are connecting to. We willuse it if no simulation host has been specified. the cookie domain to use |
getCookiePath | public static String getCookiePath(WebRequest theRequest, String theRealPath)(Code) | | Returns the path that will be used to validate if a cookie will be
sent or not. The algorithm is as follows : if the cookie path is not
set (i.e. null) then the cookie is always sent (provided the domain
is right). If the cookie path is set, the cookie is sent only if
the request path starts with the same string as the cookie path. If
setURL() has been called, return the path it has been
set to (context + servletPath + pathInfo). Otherwise return the
real redirector path.
Parameters: theRequest - the request containing all data to pass to the serverredirector. Parameters: theRealPath - the real path to which we are connecting to. We willuse it if no simulation path has been specified. the path to use to decide if a cookie will get sent |
getCookiePort | public static int getCookiePort(WebRequest theRequest, int theRealPort)(Code) | | Returns the port that will be used to send the cookies. If a port
was specified using setURL() then the port sent will be
this port. Otherwise it will be the real redirector port.
Parameters: theRequest - the request containing all data to pass to the serverredirector. Parameters: theRealPort - the real port to which we are connecting to. We willuse it if no simulation port has been specified. the cookie domain to use |
getCookieString | public static String getCookieString(WebRequest theRequest, URL theUrl) throws ClientException(Code) | | the cookie string which will be added as a HTTP "Cookie" headeror null if no cookie has been set Parameters: theRequest - the request containing all data to pass to the serverredirector. Parameters: theUrl - the URL to connect to throws: ClientException - if an error occurred when creating the cookiestring |
|
|