com.noelios.restlet.http
Class CookieUtils

java.lang.Object
  extended by com.noelios.restlet.http.CookieUtils

public class CookieUtils
extends java.lang.Object

Cookie manipulation utilities.

Author:
Jerome Louvel

Constructor Summary
CookieUtils()
           
 
Method Summary
static java.lang.String format(Cookie cookie)
          Formats a cookie.
static void format(Cookie cookie, java.lang.Appendable destination)
          Formats a cookie setting.
static java.lang.String format(CookieSetting cookieSetting)
          Formats a cookie setting.
static void format(CookieSetting cookieSetting, java.lang.Appendable destination)
          Formats a cookie setting.
static java.lang.String format(java.util.List<Cookie> cookies)
          Formats a list of cookies as an HTTP header.
static void getCookies(java.util.List<Cookie> source, java.util.Map<java.lang.String,Cookie> destination)
          Gets the cookies whose name is a key in the given map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieUtils

public CookieUtils()
Method Detail

format

public static java.lang.String format(Cookie cookie)
                               throws java.lang.IllegalArgumentException
Formats a cookie.

Parameters:
cookie - The cookie to format.
Returns:
The formatted cookie.
Throws:
java.lang.IllegalArgumentException - If the Cookie contains illegal values.

format

public static void format(Cookie cookie,
                          java.lang.Appendable destination)
                   throws java.lang.IllegalArgumentException,
                          java.io.IOException
Formats a cookie setting.

Parameters:
cookie - The cookie to format.
destination - The appendable destination.
Throws:
java.io.IOException
java.lang.IllegalArgumentException - If the Cookie contains illegal values.

format

public static java.lang.String format(CookieSetting cookieSetting)
                               throws java.lang.IllegalArgumentException
Formats a cookie setting.

Parameters:
cookieSetting - The cookie setting to format.
Returns:
The formatted cookie setting.
Throws:
java.lang.IllegalArgumentException - If the CookieSetting can not be formatted to a String

format

public static void format(CookieSetting cookieSetting,
                          java.lang.Appendable destination)
                   throws java.io.IOException,
                          java.lang.IllegalArgumentException
Formats a cookie setting.

Parameters:
cookieSetting - The cookie setting to format.
destination - The appendable destination.
Throws:
java.io.IOException
java.lang.IllegalArgumentException - If the CookieSetting can not be formatted to a String

format

public static java.lang.String format(java.util.List<Cookie> cookies)
                               throws java.lang.IllegalArgumentException
Formats a list of cookies as an HTTP header.

Parameters:
cookies - The list of cookies to format.
Returns:
The HTTP header.
Throws:
java.lang.IllegalArgumentException - If one of the Cookies contains illegal values

getCookies

public static void getCookies(java.util.List<Cookie> source,
                              java.util.Map<java.lang.String,Cookie> destination)
Gets the cookies whose name is a key in the given map. If a matching cookie is found, its value is put in the map.

Parameters:
source - The source list of cookies.
destination - The cookies map controlling the reading.


Copyright © 2005-2008 Noelios Technologies.