org.apache.cactus.client
class HttpClientHelper

java.lang.Object
  |
  +--org.apache.cactus.client.HttpClientHelper
Known Advisors:
LogAspect

public class HttpClientHelper
extends java.lang.Object

Helper class to open an HTTP connection to the server redirector and pass to it HTTP parameters, Cookies and HTTP headers.

Version:
$Id: HttpClientHelper.java,v 1.4 2002/04/21 12:45:44 vmassol Exp $
Author:
Vincent Massol , Jason Robertson

Constructor Summary
HttpClientHelper(String theURL)
           
 
Method Summary
 HttpURLConnection connect(WebRequest theRequest)
          Connects to the Cactus Redirector using HTTP.
          Affected by: LogAspect
static String getDomain(WebRequest theRequest, URLConnection theConnection)
          Returns the domain that will be used to send the cookies.
          Affected by: LogAspect
static String getPath(WebRequest theRequest, URLConnection theConnection)
          Returns the path that will be used to validate if a cookie will be sent or not.
          Affected by: LogAspect
static int getPort(WebRequest theRequest, URLConnection theConnection)
          Returns the domain that will be used to send the cookies.
          Affected by: LogAspect
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientHelper

public HttpClientHelper(String theURL)
Parameters:
theURL - the URL that will be used for the HTTP connection.
Method Detail

connect

public HttpURLConnection connect(WebRequest theRequest)
                          throws java.lang.Throwable
Connects to the Cactus Redirector using HTTP.
Parameters:
theRequest - the request containing all data to pass to the server redirector.
Returns:
the HTTP Connection used to connect to the redirector.
Throws:
Throwable - Throwable if an unexpected error occured
Affected by:
around() in LogAspect.

getDomain

public static String getDomain(WebRequest theRequest,
                               URLConnection theConnection)
Returns the domain that will be used to send the cookies. If a host was specified using setURL() then the domain will be this host. Otherwise it will be the redirector host.
Parameters:
theRequest - the request containing all data to pass to the server redirector.
theConnection - the HTTP connection
Returns:
the cookie domain to use
Affected by:
around() in LogAspect.

getPath

public static String getPath(WebRequest theRequest,
                             URLConnection theConnection)
Returns the path that will be used to validate if a cookie will be sent or not. The algorithm is as follows : if the cookie path is not set (i.e. null) then the cookie is always sent (provided the domain is right). If the cookie path is set, the cookie is sent only if the request path starts with the same string as the cookie path. If setURL() has been called, return the path it has been set to (context + servletPath + pathInfo). Otherwise return the redirector path.
Parameters:
theRequest - the request containing all data to pass to the server redirector.
theConnection - the HTTP connection
Returns:
the path to use to decide if a cookie will get sent
Affected by:
around() in LogAspect.

getPort

public static int getPort(WebRequest theRequest,
                          URLConnection theConnection)
Returns the domain that will be used to send the cookies. If a host was specified using setURL() then the domain will be this host. Otherwise it will be the redirector host.
Parameters:
theRequest - the request containing all data to pass to the server redirector.
theConnection - the HTTP connection
Returns:
the cookie domain to use
Affected by:
around() in LogAspect.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.