edu.wisc.my.webproxy.beans.http
Class HttpManagerImpl

java.lang.Object
  extended by edu.wisc.my.webproxy.beans.http.HttpManager
      extended by edu.wisc.my.webproxy.beans.http.HttpManagerImpl
All Implemented Interfaces:
ProxyComponent
Direct Known Subclasses:
ShibbolethEnabledHttpManagerImpl

public class HttpManagerImpl
extends HttpManager

This class is the implementation of the methods defined in the (@link edu.wisc.my.webproxy.beans.http.HttpManager) interface

Version:
$Id: HttpManagerImpl.java 20993 2010-07-02 19:32:47Z edalquist $
Author:
nramzan

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
HttpManagerImpl()
          Default constructor
 
Method Summary
 void addCookie(org.apache.http.cookie.Cookie cookie)
          Add a cookie to the HttpManager.
 void addCookies(org.apache.http.cookie.Cookie[] cookies)
          Add an array of cookies to the HttpManager.
 void clearCookies()
          Clear all cookies currently available in the HttpManager.
 void clearData()
          Called at the end of a request that the component was used in.
protected  org.apache.http.conn.ClientConnectionManager createClientConnectionManager(javax.portlet.PortletRequest request, org.apache.http.params.HttpParams params)
          Creates a new ClientConnectionManager to be used by the HttpClient.
protected  org.apache.http.impl.client.DefaultHttpClient createHttpClient(javax.portlet.PortletRequest request)
          Create a new THREAD SAFE HttpClient instance using the available portlet preferences.
 Request createRequest()
          Creates an empty request object.
 Response doRequest(Request request)
          Performs the request with the given request object.
 List<org.apache.http.cookie.Cookie> getCookies()
          Return a list of all currently set cookies in the HttpManager.
 org.apache.http.auth.Credentials getCredentials()
          Return the user authentication credentials.
protected  org.apache.http.impl.client.DefaultHttpClient getHttpClient(javax.portlet.PortletRequest request)
           
 String getName()
          Returns a displayable name for the component.
 void setCredentials(org.apache.http.auth.Credentials credentials)
          Set the user authentication credentials.
 void setup(javax.portlet.PortletRequest request)
          Responsible for setting up the HttpManager.
 
Methods inherited from class edu.wisc.my.webproxy.beans.http.HttpManager
getCookieLock, setActionData, setRenderData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

HttpManagerImpl

public HttpManagerImpl()
Default constructor

Method Detail

doRequest

public Response doRequest(Request request)
                   throws HttpTimeoutException,
                          IOException
Description copied from class: HttpManager
Performs the request with the given request object.

Specified by:
doRequest in class HttpManager
Parameters:
request - the (@link Request) object that contains all the necessary data to make the remote request.
Returns:
response the (@link Response) object that contains the result/content of the the request made.
Throws:
HttpTimeoutException
IOException

createRequest

public Request createRequest()
Description copied from class: HttpManager
Creates an empty request object.

Specified by:
createRequest in class HttpManager
Returns:
request the (@link Request) object with no attributes set on it

getName

public String getName()
Description copied from interface: ProxyComponent
Returns a displayable name for the component.


clearData

public void clearData()
Description copied from interface: ProxyComponent
Called at the end of a request that the component was used in. It clears the references to the request and response objects. It should be called from a finally block to ensure its execution.


setup

public void setup(javax.portlet.PortletRequest request)
Description copied from class: HttpManager
Responsible for setting up the HttpManager. This component must be callable from a servlet as well so the portlet request and response methods are not available. This method *must* be called prior to attempting to use the HttpManager.

Specified by:
setup in class HttpManager

addCookie

public void addCookie(org.apache.http.cookie.Cookie cookie)
Description copied from class: HttpManager
Add a cookie to the HttpManager.

Specified by:
addCookie in class HttpManager

addCookies

public void addCookies(org.apache.http.cookie.Cookie[] cookies)
Description copied from class: HttpManager
Add an array of cookies to the HttpManager.

Specified by:
addCookies in class HttpManager

clearCookies

public void clearCookies()
Description copied from class: HttpManager
Clear all cookies currently available in the HttpManager.

Specified by:
clearCookies in class HttpManager

getCookies

public List<org.apache.http.cookie.Cookie> getCookies()
Description copied from class: HttpManager
Return a list of all currently set cookies in the HttpManager.

Specified by:
getCookies in class HttpManager
Returns:

getCredentials

public org.apache.http.auth.Credentials getCredentials()
Description copied from class: HttpManager
Return the user authentication credentials.

Specified by:
getCredentials in class HttpManager
Returns:

setCredentials

public void setCredentials(org.apache.http.auth.Credentials credentials)
Description copied from class: HttpManager
Set the user authentication credentials.

Specified by:
setCredentials in class HttpManager

getHttpClient

protected final org.apache.http.impl.client.DefaultHttpClient getHttpClient(javax.portlet.PortletRequest request)

createHttpClient

protected org.apache.http.impl.client.DefaultHttpClient createHttpClient(javax.portlet.PortletRequest request)
Create a new THREAD SAFE HttpClient instance using the available portlet preferences. This method may be used by subclasses to provide an alternate instance of DefaultHttpClient. The returned client should be sure to use a thread-safe client connection manager.

Parameters:
prefs -
Returns:
new DefaultHttpClient instance

createClientConnectionManager

protected org.apache.http.conn.ClientConnectionManager createClientConnectionManager(javax.portlet.PortletRequest request,
                                                                                     org.apache.http.params.HttpParams params)
Creates a new ClientConnectionManager to be used by the HttpClient. Configures the SchemeRegistry as well as setting up connection related HttpParams



Copyright © 2010 Jasig. All Rights Reserved.