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, WebConnectionResourceSource wc)
          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(HttpHeader request)
          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,
                           WebConnectionResourceSource wc)
This method does nothing.

Specified by:
handleResponse in interface ClientListener
Parameters:
request - the request made
response - the response header
wc - the actual resource

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(HttpHeader request)
Handle any cleanup in this method.

Specified by:
requestDone in interface ClientListener