Class IgnoreCookiesSpec
- java.lang.Object
-
- org.apache.commons.httpclient.cookie.IgnoreCookiesSpec
-
- All Implemented Interfaces:
CookieSpec
public class IgnoreCookiesSpec extends java.lang.Object implements CookieSpec
A cookie spec that does nothing. Cookies are neither parsed, formatted nor matched. It can be used to effectively disable cookies altogether.- Since:
- 3.0
-
-
Field Summary
-
Fields inherited from interface org.apache.commons.httpclient.cookie.CookieSpec
PATH_DELIM, PATH_DELIM_CHAR
-
-
Constructor Summary
Constructors Constructor Description IgnoreCookiesSpec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandomainMatch(java.lang.String host, java.lang.String domain)Performs domain-match as defined by the cookie specification.java.lang.StringformatCookie(Cookie cookie)Create a "Cookie" header value for an array of cookies.HeaderformatCookieHeader(Cookie cookie)Create a "Cookie" Header for single Cookie.HeaderformatCookieHeader(Cookie[] cookies)Create a "Cookie" Header for an array of Cookies.java.lang.StringformatCookies(Cookie[] cookies)Create a "Cookie" header value for an array of cookies.java.util.CollectiongetValidDateFormats()Returns theCollectionof date patterns used for parsing.booleanmatch(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie cookie)Determines if a Cookie matches a location.Cookie[]match(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie[] cookies)Returns an emptycookiearray.Cookie[]parse(java.lang.String host, int port, java.lang.String path, boolean secure, java.lang.String header)Returns an emptycookiearray.Cookie[]parse(java.lang.String host, int port, java.lang.String path, boolean secure, Header header)Returns an emptycookiearray.voidparseAttribute(NameValuePair attribute, Cookie cookie)Does nothing.booleanpathMatch(java.lang.String path, java.lang.String topmostPath)Performs path-match as defined by the cookie specification.voidsetValidDateFormats(java.util.Collection datepatterns)Does nothing.voidvalidate(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie cookie)Does nothing.
-
-
-
Method Detail
-
parse
public Cookie[] parse(java.lang.String host, int port, java.lang.String path, boolean secure, java.lang.String header) throws MalformedCookieException
Returns an emptycookiearray. All parameters are ignored.- Specified by:
parsein interfaceCookieSpec- Parameters:
host- the host which sent the Set-Cookie headerport- the port which sent the Set-Cookie headerpath- the path which sent the Set-Cookie headersecure- true when the Set-Cookie header was received over secure conectionheader- the Set-Cookie received from the server- Returns:
- an array of Cookies parsed from the Set-Cookie value
- Throws:
MalformedCookieException- if an exception occurs during parsing- See Also:
CookieSpec.validate(String, int, String, boolean, Cookie)
-
getValidDateFormats
public java.util.Collection getValidDateFormats()
Description copied from interface:CookieSpecReturns theCollectionof date patterns used for parsing. The String patterns are compatible with theSimpleDateFormat.- Specified by:
getValidDateFormatsin interfaceCookieSpec- Returns:
null
-
setValidDateFormats
public void setValidDateFormats(java.util.Collection datepatterns)
Does nothing.- Specified by:
setValidDateFormatsin interfaceCookieSpec- Parameters:
datepatterns- collection of date patterns
-
formatCookie
public java.lang.String formatCookie(Cookie cookie)
Description copied from interface:CookieSpecCreate a "Cookie" header value for an array of cookies.- Specified by:
formatCookiein interfaceCookieSpec- Parameters:
cookie- the cookie to be formatted as string- Returns:
null
-
formatCookieHeader
public Header formatCookieHeader(Cookie cookie) throws java.lang.IllegalArgumentException
Description copied from interface:CookieSpecCreate a "Cookie" Header for single Cookie.- Specified by:
formatCookieHeaderin interfaceCookieSpec- Parameters:
cookie- the Cookie format as a Cookie header- Returns:
null- Throws:
java.lang.IllegalArgumentException- if an input parameter is illegal
-
formatCookieHeader
public Header formatCookieHeader(Cookie[] cookies) throws java.lang.IllegalArgumentException
Description copied from interface:CookieSpecCreate a "Cookie" Header for an array of Cookies.- Specified by:
formatCookieHeaderin interfaceCookieSpec- Parameters:
cookies- the Cookies format into a Cookie header- Returns:
null- Throws:
java.lang.IllegalArgumentException- if an input parameter is illegal
-
formatCookies
public java.lang.String formatCookies(Cookie[] cookies) throws java.lang.IllegalArgumentException
Description copied from interface:CookieSpecCreate a "Cookie" header value for an array of cookies.- Specified by:
formatCookiesin interfaceCookieSpec- Parameters:
cookies- the Cookies to be formatted- Returns:
null- Throws:
java.lang.IllegalArgumentException- if an input parameter is illegal
-
match
public boolean match(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie cookie)Description copied from interface:CookieSpecDetermines if a Cookie matches a location.- Specified by:
matchin interfaceCookieSpec- Parameters:
host- the host to which the request is being submittedport- the port to which the request is being submittedpath- the path to which the request is being submittedsecure- true if the request is using a secure connectioncookie- the Cookie to be matched- Returns:
false
-
match
public Cookie[] match(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie[] cookies)
Returns an emptycookiearray. All parameters are ignored.- Specified by:
matchin interfaceCookieSpec- Parameters:
host- the host to which the request is being submittedport- the port to which the request is being submitted (currenlty ignored)path- the path to which the request is being submittedsecure- true if the request is using a secure protocolcookies- an array of Cookies to be matched- Returns:
- true if the cookie should be submitted with a request with given attributes, false otherwise.
-
parse
public Cookie[] parse(java.lang.String host, int port, java.lang.String path, boolean secure, Header header) throws MalformedCookieException, java.lang.IllegalArgumentException
Returns an emptycookiearray. All parameters are ignored.- Specified by:
parsein interfaceCookieSpec- Parameters:
host- the host which sent the Set-Cookie headerport- the port which sent the Set-Cookie headerpath- the path which sent the Set-Cookie headersecure- true when the Set-Cookie header was received over secure conectionheader- the Set-Cookie received from the server- Returns:
- an array of Cookies parsed from the header
- Throws:
MalformedCookieException- if an exception occurs during parsingjava.lang.IllegalArgumentException- if an input parameter is illegal- See Also:
CookieSpec.validate(String, int, String, boolean, Cookie)
-
parseAttribute
public void parseAttribute(NameValuePair attribute, Cookie cookie) throws MalformedCookieException, java.lang.IllegalArgumentException
Does nothing.- Specified by:
parseAttributein interfaceCookieSpec- Parameters:
attribute- cookie attribute from the Set-Cookiecookie- the to be updated- Throws:
MalformedCookieException- if an exception occurs during parsingjava.lang.IllegalArgumentException- if an input parameter is illegal
-
validate
public void validate(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie cookie) throws MalformedCookieException, java.lang.IllegalArgumentExceptionDoes nothing.- Specified by:
validatein interfaceCookieSpec- Parameters:
host- the host from which theCookiewas receivedport- the port from which theCookiewas receivedpath- the path from which theCookiewas receivedsecure- true when theCookiewas received using a secure connectioncookie- the Cookie to validate- Throws:
MalformedCookieException- if the cookie is invalidjava.lang.IllegalArgumentException- if an input parameter is illegal
-
domainMatch
public boolean domainMatch(java.lang.String host, java.lang.String domain)Description copied from interface:CookieSpecPerforms domain-match as defined by the cookie specification.- Specified by:
domainMatchin interfaceCookieSpec- Parameters:
host- The target host.domain- The cookie domain attribute.- Returns:
false
-
pathMatch
public boolean pathMatch(java.lang.String path, java.lang.String topmostPath)Description copied from interface:CookieSpecPerforms path-match as defined by the cookie specification.- Specified by:
pathMatchin interfaceCookieSpec- Parameters:
path- The target path.topmostPath- The cookie path attribute.- Returns:
false
-
-