com.ning.http.client.webdav
Class WebDavCompletionHandlerBase<T>

java.lang.Object
  extended by com.ning.http.client.webdav.WebDavCompletionHandlerBase<T>
Type Parameters:
T -
All Implemented Interfaces:
AsyncHandler<T>

public abstract class WebDavCompletionHandlerBase<T>
extends Object
implements AsyncHandler<T>

Simple AsyncHandler that add support for WebDav's response manipulation.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ning.http.client.AsyncHandler
AsyncHandler.STATE
 
Constructor Summary
WebDavCompletionHandlerBase()
           
 
Method Summary
 AsyncHandler.STATE onBodyPartReceived(HttpResponseBodyPart content)
          Invoked as soon as some response body part are received.
 T onCompleted()
          Invoked once the HTTP response processing is finished.
abstract  T onCompleted(WebDavResponse response)
          Invoked once the HTTP response has been fully read.
 AsyncHandler.STATE onHeadersReceived(HttpResponseHeaders headers)
          Invoked as soon as the HTTP headers has been received.
 AsyncHandler.STATE onStatusReceived(HttpResponseStatus status)
          Invoked as soon as the HTTP status line has been received
 void onThrowable(Throwable t)
          Invoked when an unexpected exception occurs during the processing of the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebDavCompletionHandlerBase

public WebDavCompletionHandlerBase()
Method Detail

onBodyPartReceived

public final AsyncHandler.STATE onBodyPartReceived(HttpResponseBodyPart content)
                                            throws Exception
Invoked as soon as some response body part are received. Could be invoked many times.

Specified by:
onBodyPartReceived in interface AsyncHandler<T>
Parameters:
content - response's body part.
Returns:
a AsyncHandler.STATE telling to CONTINUE or ABORT the current processing.
Throws:
Exception - if something wrong happens

onStatusReceived

public final AsyncHandler.STATE onStatusReceived(HttpResponseStatus status)
                                          throws Exception
Invoked as soon as the HTTP status line has been received

Specified by:
onStatusReceived in interface AsyncHandler<T>
Parameters:
status - the status code and test of the response
Returns:
a AsyncHandler.STATE telling to CONTINUE or ABORT the current processing.
Throws:
Exception - if something wrong happens

onHeadersReceived

public final AsyncHandler.STATE onHeadersReceived(HttpResponseHeaders headers)
                                           throws Exception
Invoked as soon as the HTTP headers has been received. Can potentially be invoked morethan once if a broken server sent trailling headers.

Specified by:
onHeadersReceived in interface AsyncHandler<T>
Parameters:
headers - the HTTP headers.
Returns:
a AsyncHandler.STATE telling to CONTINUE or ABORT the current processing.
Throws:
Exception - if something wrong happens

onCompleted

public final T onCompleted()
                    throws Exception
Invoked once the HTTP response processing is finished.

Gets always invoked as last callback method.

Specified by:
onCompleted in interface AsyncHandler<T>
Returns:
T Value that will be returned by the associated Future
Throws:
Exception - if something wrong happens

onThrowable

public void onThrowable(Throwable t)
Invoked when an unexpected exception occurs during the processing of the response. The exception may have been produced by implementation of onXXXReceived method invokation.

Specified by:
onThrowable in interface AsyncHandler<T>
Parameters:
t - a Throwable

onCompleted

public abstract T onCompleted(WebDavResponse response)
                       throws Exception
Invoked once the HTTP response has been fully read.

Parameters:
response - The Response
Returns:
Type of the value that will be returned by the associated Future
Throws:
Exception


Copyright © 2011. All Rights Reserved.