|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cactus.util.CookieUtil
Utility methods to manipulate cookies and transform Cactus cookie objects to HttpClient cookie objects.
Constructor Summary | |
CookieUtil()
|
Method Summary | |
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 org.apache.commons.httpclient.HttpState |
createHttpState(WebRequest theRequest,
java.net.URL theUrl)
Create an HttpClient HttpState object containing all cookies
stored in the passed WebRequest object. |
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CookieUtil()
Method Detail |
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 object
public static org.apache.commons.httpclient.Cookie[] createHttpClientCookies(WebRequest theRequest, java.net.URL theUrl)
theRequest
- The requesttheUrl
- The URL
public 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 cookies
Header
containing the matching
cookies
ClientException
- 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 to
ClientException
- if an error occurred when creating the cookie
stringpublic static org.apache.commons.httpclient.HttpState createHttpState(WebRequest theRequest, java.net.URL theUrl)
HttpState
object containing all cookies
stored in the passed WebRequest
object.
theRequest
- the request containing the cookies to use when calling
the server sidetheUrl
- the URL to connect to
HttpState
object which has been set with
the cookies
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |