org.apache.commons.latka.http
Interface Session

All Known Implementing Classes:
SessionImpl

public interface Session

A Latka Session is a container that manages state information over 1+ HTTP request/response pairs over 1+ HTTP servers.

Version:
$Id: Session.java 155424 2005-02-26 13:09:29Z dirkv $
Author:
Doug Sale, Morgan Delagrange, dIon Gillard

Method Summary
 void addCookie(java.lang.String domain, java.lang.String path, java.lang.String name, java.lang.String value)
          Adds a cookie to all HTTP requests whose domain and path match (according to RFC2109).
 Request createRequest(java.lang.String label, java.net.URL url, int httpMethod, java.lang.String version, boolean followRedirects)
          Creates a labeled request object, with the specified URL, HTTP Method, version, and redirect handling behavior.
 Request createRequest(java.lang.String label, java.net.URL url, int httpMethod, java.lang.String version, boolean followRedirects, Proxy proxy)
          Create a labeled request with the specified URL, HTTP method, version, and redirect handling behavior, using the given proxy for communication.
 Request createRequest(java.net.URL url, int httpMethod, Proxy proxy, java.lang.String version)
          Creates a request object with the specified URL, HTTP Method, and version to be accessed via the provided proxy.
 Request createRequest(java.net.URL url, int httpMethod, java.lang.String version)
          Creates a request object with the specified URL, HTTP Method, and version.
 java.lang.String getCookieValue(java.lang.String name)
          Returns the value of cookie name.
 

Method Detail

createRequest

public Request createRequest(java.net.URL url,
                             int httpMethod,
                             java.lang.String version)
Creates a request object with the specified URL, HTTP Method, and version.

Parameters:
url - The URL to request of the HTTP server.
httpMethod - An integer representing the HTTP method (e.g. GET, PUT) used to communicate with server.
version - A String representing the version of the HTTP request, i.e. 1.0 or 1.1.
Returns:
a new Request object representing the url and httpMethod
See Also:
Request.HTTP_METHOD_GET, Request.HTTP_METHOD_POST

createRequest

public Request createRequest(java.lang.String label,
                             java.net.URL url,
                             int httpMethod,
                             java.lang.String version,
                             boolean followRedirects)
Creates a labeled request object, with the specified URL, HTTP Method, version, and redirect handling behavior.

Parameters:
label - a name used to identify the request
url - The URL to request of the HTTP server.
httpMethod - An integer representing the HTTP method (e.g. GET, PUT) used to communicate with server.
version - A String representing the version of the HTTP request, i.e. 1.0 or 1.1.
followRedirects - whether to follow HTTP redirection responses
Returns:
a new Request object representing the url and httpMethod
See Also:
Request.HTTP_METHOD_GET, Request.HTTP_METHOD_POST

createRequest

public Request createRequest(java.net.URL url,
                             int httpMethod,
                             Proxy proxy,
                             java.lang.String version)
Creates a request object with the specified URL, HTTP Method, and version to be accessed via the provided proxy.

Parameters:
url - The URL to request of the HTTP server.
httpMethod - An integer representing the HTTP method (e.g. GET, PUT) used to communicate with server.
proxy - a proxy to use during the request
version - A String representing the version of the HTTP request, i.e. 1.0 or 1.1.
Returns:
a new Request object representing the url and httpMethod.
See Also:
Request.HTTP_METHOD_GET, Request.HTTP_METHOD_POST, Proxy

createRequest

public Request createRequest(java.lang.String label,
                             java.net.URL url,
                             int httpMethod,
                             java.lang.String version,
                             boolean followRedirects,
                             Proxy proxy)
Create a labeled request with the specified URL, HTTP method, version, and redirect handling behavior, using the given proxy for communication.

Parameters:
label - a name used to identify the request
url - The URL to request of the HTTP server.
httpMethod - An integer representing the HTTP method (e.g. GET, PUT) used to communicate with server.
version - A String representing the version of the HTTP request, i.e. 1.0 or 1.1.
followRedirects - whether to follow HTTP redirection responses
proxy - a proxy to use during the request
Returns:
a new Request object representing the url and httpMethod
See Also:
Request.HTTP_METHOD_GET, Request.HTTP_METHOD_POST, Proxy

addCookie

public void addCookie(java.lang.String domain,
                      java.lang.String path,
                      java.lang.String name,
                      java.lang.String value)
Adds a cookie to all HTTP requests whose domain and path match (according to RFC2109).

Parameters:
domain - the domain to which the cookie should apply
path - the path to which the cookie should apply
name - the name of the cookie
value - the value of the cookie

getCookieValue

public java.lang.String getCookieValue(java.lang.String name)
Returns the value of cookie name.

Parameters:
name - the name of the cookie
Returns:
the value of the cookie, or null if the cookie isn't set


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.