rabbit.client
Class ClientListenerAdapter

java.lang.Object
  extended by rabbit.client.ClientListenerAdapter
All Implemented Interfaces:
ClientListener

public class ClientListenerAdapter
extends Object
implements ClientListener

A basic ClientListener.

Author:
Robert Olofsson

Constructor Summary
ClientListenerAdapter(Logger logger)
           
 
Method Summary
 boolean followRedirects()
          This method returns true, override if you want different behaviour.
 Logger getLogger()
           
 void handleFailure(HttpHeader request, Exception e)
          Logs an error to the logger and calls requestDone().
 void handleResponse(HttpHeader request, HttpHeader response, WebConnection wc, BufferHandle bufferHandle, boolean keepalive, boolean isChunked, long dataSize)
          This method does nothing.
 void handleTimeout(HttpHeader request)
          Logs an error to the logger and calls requestDone().
 void redirected(HttpHeader request, String location, ClientBase base)
          Create the redirected url and calls redirectedTo() and requestDone().
 void redirectedTo(String url)
          This method does nothing, override to perform actual request.
 void requestDone()
          Handle any cleanup in this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientListenerAdapter

public ClientListenerAdapter(Logger logger)
Method Detail

getLogger

public Logger getLogger()

redirected

public void redirected(HttpHeader request,
                       String location,
                       ClientBase base)
Create the redirected url and calls redirectedTo() and requestDone().

Specified by:
redirected in interface ClientListener
Parameters:
request - the request that was redirected
location - the location the redirect gives

redirectedTo

public void redirectedTo(String url)
                  throws IOException
This method does nothing, override to perform actual request.

Throws:
IOException

handleResponse

public void handleResponse(HttpHeader request,
                           HttpHeader response,
                           WebConnection wc,
                           BufferHandle bufferHandle,
                           boolean keepalive,
                           boolean isChunked,
                           long dataSize)
This method does nothing.

Specified by:
handleResponse in interface ClientListener
Parameters:
request - the request made
response - the response header
bufferHandle - the BufferHandle used, may contain resource data
keepalive - a flag indicating if keepalive seems possible for this connection.
isChunked - a flag to tell if the resource is chunked or not
dataSize - the size of the resource, may be -1 if unknown

followRedirects

public boolean followRedirects()
This method returns true, override if you want different behaviour.

Specified by:
followRedirects in interface ClientListener

handleTimeout

public void handleTimeout(HttpHeader request)
Logs an error to the logger and calls requestDone().

Specified by:
handleTimeout in interface ClientListener

handleFailure

public void handleFailure(HttpHeader request,
                          Exception e)
Logs an error to the logger and calls requestDone().

Specified by:
handleFailure in interface ClientListener

requestDone

public void requestDone()
Handle any cleanup in this method.