public class CookieUtil
extends java.lang.Object
Constructor and Description |
---|
CookieUtil() |
Modifier and Type | Method and Description |
---|---|
static org.apache.commons.httpclient.Header |
createCookieHeader(java.lang.String theDomain,
java.lang.String thePath,
org.apache.commons.httpclient.Cookie[] theCookies)
Create a HttpClient
Header for cookies that matches
the domain and path. |
static org.apache.commons.httpclient.Cookie |
createHttpClientCookie(WebRequest theRequest,
java.net.URL theUrl,
Cookie theCactusCookie)
Create a Commons-HttpClient cookie from a Cactus cookie, with information
from the web request and the URL.
|
static org.apache.commons.httpclient.Cookie[] |
createHttpClientCookies(WebRequest theRequest,
java.net.URL theUrl)
Transforms an array of Cactus cookies into an array of Commons-HttpClient
cookies, using information from the request and URL.
|
static java.lang.String |
getCookieDomain(WebRequest theRequest,
java.lang.String theRealHost)
Returns the domain that will be used to send the cookies.
|
static java.lang.String |
getCookiePath(WebRequest theRequest,
java.lang.String theRealPath)
Returns the path that will be used to validate if a cookie will be
sent or not.
|
static int |
getCookiePort(WebRequest theRequest,
int theRealPort)
Returns the port that will be used to send the cookies.
|
static java.lang.String |
getCookieString(WebRequest theRequest,
java.net.URL theUrl) |
public static java.lang.String getCookieDomain(WebRequest theRequest, java.lang.String theRealHost)
setURL()
then the domain will be
this host. Otherwise it will be the real redirector host.theRequest
- the request containing all data to pass to the server
redirector.theRealHost
- the real host to which we are connecting to. We will
use it if no simulation host has been specified.public static int getCookiePort(WebRequest theRequest, int theRealPort)
setURL()
then the port sent will be
this port. Otherwise it will be the real redirector port.theRequest
- the request containing all data to pass to the server
redirector.theRealPort
- the real port to which we are connecting to. We will
use it if no simulation port has been specified.public static java.lang.String getCookiePath(WebRequest theRequest, java.lang.String theRealPath)
setURL()
has been called, return the path it has been
set to (context + servletPath + pathInfo). Otherwise return the
real redirector path.theRequest
- the request containing all data to pass to the server
redirector.theRealPath
- the real path to which we are connecting to. We will
use it if no simulation path has been specified.public static org.apache.commons.httpclient.Cookie createHttpClientCookie(WebRequest theRequest, java.net.URL theUrl, Cookie theCactusCookie)
theRequest
- The requesttheUrl
- The URLtheCactusCookie
- The Cactus Cookie objectpublic static org.apache.commons.httpclient.Cookie[] createHttpClientCookies(WebRequest theRequest, java.net.URL theUrl)
theRequest
- The requesttheUrl
- The URLpublic static org.apache.commons.httpclient.Header createCookieHeader(java.lang.String theDomain, java.lang.String thePath, org.apache.commons.httpclient.Cookie[] theCookies) throws ClientException
Header
for cookies that matches
the domain and path.theDomain
- the cookie domain to matchthePath
- the cookie path to matchtheCookies
- the list of potential cookiesHeader
containing the matching
cookiesClientException
- if no cookie was matching the domain
and pathpublic static java.lang.String getCookieString(WebRequest theRequest, java.net.URL theUrl) throws ClientException
theRequest
- the request containing all data to pass to the server
redirector.theUrl
- the URL to connect toClientException
- if an error occurred when creating the cookie
stringCopyright © 2000-2004 Apache Software Foundation. All Rights Reserved.