com.jayway.restassured.response
Class Cookie.Builder

java.lang.Object
  extended by com.jayway.restassured.response.Cookie.Builder
Enclosing class:
Cookie

public static class Cookie.Builder
extends Object


Constructor Summary
Cookie.Builder(String name)
          Create a cookie with no value
Cookie.Builder(String name, String value)
          Create a cookie with name and value
 
Method Summary
 Cookie build()
          Build a Cookie from the specified parameters.
 Cookie.Builder setComment(String comment)
          Set the comment describing the purpose of this cookie.
 Cookie.Builder setDomain(String domain)
          Set domain attribute of the cookie.
 Cookie.Builder setExpiryDate(Date date)
          Set the expiration Date of the cookie.
 Cookie.Builder setMaxAge(int maxAge)
          Set the maximum age of the cookie, specified in seconds, By default, -1 indicating the cookie will persist until browser shutdown.
 Cookie.Builder setPath(String path)
          Set the path attribute of the cookie.
 Cookie.Builder setSecured(boolean secured)
          Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
 Cookie.Builder setVersion(int version)
          Sets the version of the cookie protocol this cookie complies with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cookie.Builder

public Cookie.Builder(String name)
Create a cookie with no value

Parameters:
name - The name of the cookie

Cookie.Builder

public Cookie.Builder(String name,
                      String value)
Create a cookie with name and value

Parameters:
name - The name of the cookie
value - the cookie value
Method Detail

setComment

public Cookie.Builder setComment(String comment)
Set the comment describing the purpose of this cookie.

Parameters:
comment - The comment
Returns:
The builder

setExpiryDate

public Cookie.Builder setExpiryDate(Date date)
Set the expiration Date of the cookie.

Parameters:
date - The date to set
Returns:
The builder

setDomain

public Cookie.Builder setDomain(String domain)
Set domain attribute of the cookie. The value of the Domain attribute specifies the domain for which the cookie is valid.

Parameters:
domain - The domain
Returns:
The builder

setPath

public Cookie.Builder setPath(String path)
Set the path attribute of the cookie. The value of the Path attribute specifies the subset of URLs on the origin server to which this cookie applies.

Parameters:
path - The path
Returns:
The builder

setMaxAge

public Cookie.Builder setMaxAge(int maxAge)
Set the maximum age of the cookie, specified in seconds, By default, -1 indicating the cookie will persist until browser shutdown.

Returns:
an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie persists until browser shutdown

setSecured

public Cookie.Builder setSecured(boolean secured)
Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL. The default value is false.

Parameters:
secured - true if sectured
Returns:
The builder

setVersion

public Cookie.Builder setVersion(int version)
Sets the version of the cookie protocol this cookie complies with. Version 0 complies with the original Netscape cookie specification. Version 1 complies with RFC 2109. Since RFC 2109 is still somewhat new, consider version 1 as experimental; do not use it yet on production sites. Parameters:

Parameters:
version - 0 if the cookie should comply with the original Netscape specification; 1 if the cookie should comply with RFC 2109
Returns:
The builder

build

public Cookie build()
Build a Cookie from the specified parameters.

Returns:
The Cookie


Copyright © 2010-2012. All Rights Reserved.