Coverage Report - org.apache.commons.latka.http.Session
 
Classes in this File Line Coverage Branch Coverage Complexity
Session
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 1999-2002,2004 The Apache Software Foundation.
 3  
  * 
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  * 
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  * 
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.apache.commons.latka.http;
 18  
 
 19  
 import java.net.URL;
 20  
 
 21  
 /**
 22  
  * A Latka Session is a container that manages state information
 23  
  * over 1+ HTTP request/response pairs over 1+ HTTP servers.
 24  
  *
 25  
  * @author <a href="mailto:dsale@us.britannica.com">Doug Sale</a>
 26  
  * @author <a href="mailto:mdelagra@us.britannica.com">Morgan Delagrange</a>
 27  
  * @author dIon Gillard
 28  
  * @version $Id: Session.java 155424 2005-02-26 13:09:29Z dirkv $
 29  
  */
 30  
 public interface Session {
 31  
 
 32  
     /**
 33  
      * Creates a request object with the specified URL, HTTP Method,
 34  
      * and version.
 35  
      * 
 36  
      * @param url        The URL to request of the HTTP server.
 37  
      * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
 38  
      *      used to communicate with server.
 39  
      * @param version A String representing the version of the HTTP request, i.e.
 40  
      *      1.0 or 1.1.
 41  
      * @return a new {@link Request} object representing the <code>url</code>
 42  
      *      and <code>httpMethod</code>
 43  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
 44  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
 45  
      */
 46  
     Request createRequest(URL url, int httpMethod, String version);
 47  
     
 48  
     /** 
 49  
      * Creates a labeled request object, with the specified URL, HTTP Method,
 50  
      * version, and redirect handling behavior.
 51  
      *
 52  
      * @param label a name used to identify the request
 53  
      * @param url The URL to request of the HTTP server.
 54  
      * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
 55  
      *      used to communicate with server.
 56  
      * @param version A String representing the version of the HTTP request, i.e.
 57  
      *      1.0 or 1.1.
 58  
      * @param followRedirects whether to follow HTTP redirection responses
 59  
      * @return a new {@link Request} object representing the <code>url</code>
 60  
      *      and <code>httpMethod</code>
 61  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
 62  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
 63  
      */
 64  
     Request createRequest(String label, URL url, int httpMethod,
 65  
         String version, boolean followRedirects);
 66  
 
 67  
     /**
 68  
      * Creates a request object with the specified URL, HTTP Method, and 
 69  
      * version to be accessed via the provided proxy.
 70  
      * 
 71  
      * @param url The URL to request of the HTTP server.
 72  
      * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
 73  
      *      used to communicate with server.
 74  
      * @param proxy a proxy to use during the request
 75  
      * @param version A String representing the version of the HTTP request, i.e.
 76  
      *      1.0 or 1.1.
 77  
      * @return a new {@link Request} object representing the <code>url</code>
 78  
      *      and <code>httpMethod</code>.
 79  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
 80  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
 81  
      * @see org.apache.commons.latka.http.Proxy
 82  
      */
 83  
     Request createRequest(URL url, int httpMethod, Proxy proxy, String version);
 84  
 
 85  
     /** 
 86  
      * Create a labeled request with the specified URL, HTTP method, version, and
 87  
      * redirect handling behavior, using the given proxy for communication.
 88  
      *
 89  
      * @param label a name used to identify the request
 90  
      * @param url The URL to request of the HTTP server.
 91  
      * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
 92  
      *    used to communicate with server.
 93  
      * @param version A String representing the version of the HTTP request, i.e.
 94  
      *      1.0 or 1.1.
 95  
      * @param followRedirects whether to follow HTTP redirection responses
 96  
      * @param proxy a proxy to use during the request
 97  
      * @return a new {@link Request} object representing the <code>url</code> 
 98  
      * and <code>httpMethod</code>
 99  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
 100  
      * @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
 101  
      * @see org.apache.commons.latka.http.Proxy
 102  
      */
 103  
     Request createRequest(String label, URL url, int httpMethod,
 104  
         String version, boolean followRedirects, Proxy proxy);
 105  
 
 106  
     /**
 107  
      * Adds a cookie to all HTTP requests whose domain and path match 
 108  
      * (according to RFC2109).
 109  
      *
 110  
      * @param domain  the domain to which the cookie should apply
 111  
      * @param path    the path to which the cookie should apply
 112  
      * @param name    the name of the cookie
 113  
      * @param value   the value of the cookie
 114  
      */
 115  
     void addCookie(String domain, String path,
 116  
                         String name, String value);
 117  
 
 118  
     /**
 119  
      * Returns the value of cookie <code>name</code>.
 120  
      *
 121  
      * @param name  the name of the cookie
 122  
      *
 123  
      * @return the value of the cookie, or null if the cookie isn't set
 124  
      */
 125  
     String getCookieValue(String name);
 126  
 
 127  
 }