com.jayway.restassured.response
Class Cookies

java.lang.Object
  extended by com.jayway.restassured.response.Cookies
All Implemented Interfaces:
Iterable<Cookie>

public class Cookies
extends Object
implements Iterable<Cookie>

Represents the a number of response cookies


Constructor Summary
Cookies(Cookie... cookies)
           
Cookies(List<Cookie> cookies)
           
 
Method Summary
static Cookies cookies(Cookie cookie, Cookie... additionalCookies)
          An alternative way to create a Cookies object from the constructor.
 boolean exist()
           
 Cookie get(String cookieName)
          Get a single cookie with the supplied name.
 List<Cookie> getList(String cookieName)
          Get all cookies with the supplied name.
 String getValue(String cookieName)
          Get a single cookie value with the supplied name.
 List<String> getValues(String cookieName)
          Get all cookie values of the cookie with the supplied name.
 boolean hasCookieWithName(String cookieName)
          See if a cookie with the given name exists
 Iterator<Cookie> iterator()
           
protected  List<Cookie> list()
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cookies

public Cookies(Cookie... cookies)

Cookies

public Cookies(List<Cookie> cookies)
Method Detail

size

public int size()
Returns:
The size of the cookies

exist

public boolean exist()
Returns:
true if one or more cookies are defined, false otherwise.

hasCookieWithName

public boolean hasCookieWithName(String cookieName)
See if a cookie with the given name exists

Parameters:
cookieName - The name of the cookie to check
Returns:
true if the cookie exists

list

protected List<Cookie> list()
Returns:
All cookies as a list.

get

public Cookie get(String cookieName)
Get a single cookie with the supplied name. If there are several cookies match the cookieName then the first one is returned.

Parameters:
cookieName - The name of the cookie to find
Returns:
The found cookie or null if no cookie was found.

getValue

public String getValue(String cookieName)
Get a single cookie value with the supplied name. If there are several cookies matching the cookieName then the first one is returned.

Parameters:
cookieName - The name of the cookie to find
Returns:
The found cookie or null if no cookie was found.

getList

public List<Cookie> getList(String cookieName)
Get all cookies with the supplied name. If there's only one cookie matching the cookieName then a list with only that cookie is returned.

Parameters:
cookieName - The name of the cookie to find
Returns:
The found cookies or empty list if no cookie was found.

getValues

public List<String> getValues(String cookieName)
Get all cookie values of the cookie with the supplied name. If there's only one header matching the cookieName then a list with only that cookie value is returned.

Parameters:
cookieName - The name of the header to find
Returns:
The found header values or empty list if no header was found.

iterator

public Iterator<Cookie> iterator()
Specified by:
iterator in interface Iterable<Cookie>
Returns:
Cookies iterator

cookies

public static Cookies cookies(Cookie cookie,
                              Cookie... additionalCookies)
An alternative way to create a Cookies object from the constructor.

Parameters:
cookie - The cookie to be included
additionalCookies - Additional cookies to be included (optional)
Returns:
A new cookies object containing the specified cookies

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2012. All Rights Reserved.