org.apache.jcs.auxiliary.remote.http.client
Class RemoteHttpCacheDispatcher

java.lang.Object
  extended by org.apache.jcs.auxiliary.remote.http.client.AbstractHttpClient
      extended by org.apache.jcs.auxiliary.remote.http.client.RemoteHttpCacheDispatcher
All Implemented Interfaces:
IRemoteCacheDispatcher

public class RemoteHttpCacheDispatcher
extends AbstractHttpClient
implements IRemoteCacheDispatcher

Calls the service.


Constructor Summary
RemoteHttpCacheDispatcher(RemoteHttpCacheAttributes remoteHttpCacheAttributes)
           
 
Method Summary
protected  java.lang.String addParameters(RemoteCacheRequest remoteCacheRequest, java.lang.String baseUrl)
           
 RemoteCacheResponse dispatchRequest(RemoteCacheRequest remoteCacheRequest)
          All requests will go through this method.
protected  void doWebserviceCall(org.apache.commons.httpclient.HttpMethod post)
          Extracted method that can be overwritten to do additional things to the post before the call is made.
 void postProcessWebserviceCall(org.apache.commons.httpclient.HttpMethod post, org.apache.commons.httpclient.HttpState httpState)
          Called after the executeMethod on the client.
 org.apache.commons.httpclient.HttpState preProcessWebserviceCall(org.apache.commons.httpclient.HttpMethod post)
          Called before the executeMethod on the client.
protected  byte[] processRequest(byte[] requestAsByteArray, java.lang.String url)
           
 
Methods inherited from class org.apache.jcs.auxiliary.remote.http.client.AbstractHttpClient
configureClient, getConnectionManager, getHttpClient, getRemoteHttpCacheAttributes, setConnectionManager, setHttpClient, setRemoteHttpCacheAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteHttpCacheDispatcher

public RemoteHttpCacheDispatcher(RemoteHttpCacheAttributes remoteHttpCacheAttributes)
Parameters:
remoteHttpCacheAttributes -
Method Detail

dispatchRequest

public RemoteCacheResponse dispatchRequest(RemoteCacheRequest remoteCacheRequest)
                                    throws java.io.IOException
All requests will go through this method.

TODO consider taking in a URL instead of using the one in the configuration.

Specified by:
dispatchRequest in interface IRemoteCacheDispatcher
Parameters:
remoteCacheRequest -
Returns:
RemoteCacheResponse
Throws:
java.io.IOException

processRequest

protected byte[] processRequest(byte[] requestAsByteArray,
                                java.lang.String url)
                         throws java.io.IOException,
                                org.apache.commons.httpclient.HttpException
Parameters:
requestAsByteArray -
url -
Returns:
byte[] - the response
Throws:
java.io.IOException
org.apache.commons.httpclient.HttpException

addParameters

protected java.lang.String addParameters(RemoteCacheRequest remoteCacheRequest,
                                         java.lang.String baseUrl)
Parameters:
remoteCacheRequest -
baseUrl -
Returns:
String

doWebserviceCall

protected final void doWebserviceCall(org.apache.commons.httpclient.HttpMethod post)
                               throws java.io.IOException
Extracted method that can be overwritten to do additional things to the post before the call is made.

Parameters:
post - the post that is about to get executed.
Throws:
java.io.IOException - on i/o error

preProcessWebserviceCall

public org.apache.commons.httpclient.HttpState preProcessWebserviceCall(org.apache.commons.httpclient.HttpMethod post)
                                                                 throws java.io.IOException
Called before the executeMethod on the client.

Parameters:
post - http method
Returns:
HttpState
Throws:
java.io.IOException

postProcessWebserviceCall

public void postProcessWebserviceCall(org.apache.commons.httpclient.HttpMethod post,
                                      org.apache.commons.httpclient.HttpState httpState)
                               throws java.io.IOException
Called after the executeMethod on the client.

Parameters:
post - http method
httpState - state
Throws:
java.io.IOException


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