org.ektorp.http
Class StdResponseHandler<T>

java.lang.Object
  extended by org.ektorp.http.StdResponseHandler<T>
Type Parameters:
T -
All Implemented Interfaces:
ResponseCallback<T>
Direct Known Subclasses:
BulkOperationResponseHandler, DocIdResponseHandler, EmbeddedDocViewResponseHandler, PageResponseHandler, RevisionResponseHandler

public class StdResponseHandler<T>
extends Object
implements ResponseCallback<T>

Author:
henrik lundgren

Constructor Summary
StdResponseHandler()
           
 
Method Summary
protected static
<T> T
checkResponseBodyOkAndReturnDefaultValue(HttpResponse hr, T defaultValue, com.fasterxml.jackson.databind.ObjectMapper mapper)
           
static DbAccessException createDbAccessException(HttpResponse hr)
          Creates an DbAccessException which specific type is determined by the response code in the http response.
 T error(HttpResponse hr)
           
protected static com.fasterxml.jackson.databind.JsonNode responseBodyAsNode(InputStream inputStream, com.fasterxml.jackson.databind.ObjectMapper mapper)
           
 T success(HttpResponse hr)
          Called when http response code is < 300
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StdResponseHandler

public StdResponseHandler()
Method Detail

createDbAccessException

public static DbAccessException createDbAccessException(HttpResponse hr)
Creates an DbAccessException which specific type is determined by the response code in the http response.

Parameters:
hr -
Returns:

responseBodyAsNode

protected static com.fasterxml.jackson.databind.JsonNode responseBodyAsNode(InputStream inputStream,
                                                                            com.fasterxml.jackson.databind.ObjectMapper mapper)
                                                                     throws IOException
Throws:
IOException

checkResponseBodyOkAndReturnDefaultValue

protected static <T> T checkResponseBodyOkAndReturnDefaultValue(HttpResponse hr,
                                                                T defaultValue,
                                                                com.fasterxml.jackson.databind.ObjectMapper mapper)
                                                     throws IOException
Throws:
IOException

error

public T error(HttpResponse hr)
Specified by:
error in interface ResponseCallback<T>

success

public T success(HttpResponse hr)
          throws Exception
Description copied from interface: ResponseCallback
Called when http response code is < 300

Specified by:
success in interface ResponseCallback<T>
Throws:
Exception


Copyright © 2017. All rights reserved.