org.jclouds.digitalocean.http
Class ResponseStatusFromPayloadHttpCommandExecutorService

java.lang.Object
  extended by org.jclouds.http.internal.BaseHttpCommandExecutorService<HttpURLConnection>
      extended by org.jclouds.http.internal.JavaUrlHttpCommandExecutorService
          extended by org.jclouds.digitalocean.http.ResponseStatusFromPayloadHttpCommandExecutorService
All Implemented Interfaces:
org.jclouds.http.HttpCommandExecutorService

@Singleton
public class ResponseStatusFromPayloadHttpCommandExecutorService
extends org.jclouds.http.internal.JavaUrlHttpCommandExecutorService

Custom implementation of the HTTP driver to read the response body in order to get the real response status.

The DigitalOcean API always return 200 codes even if a request failed due to some internal error, but populates an ERROR string in the response payload.

This class will read the body of the response and populate a 500 status code if an error is found.

Author:
Sergi Castro, Ignasi Barrera

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jclouds.http.internal.BaseHttpCommandExecutorService
org.jclouds.http.internal.BaseHttpCommandExecutorService.HttpResponseCallable
 
Field Summary
static String ACCESS_DENIED
           
static String NOT_FOUND
           
 
Fields inherited from class org.jclouds.http.internal.JavaUrlHttpCommandExecutorService
DEFAULT_USER_AGENT, proxyForURI, sslContextSupplier, untrustedSSLContextProvider, verifier
 
Fields inherited from class org.jclouds.http.internal.BaseHttpCommandExecutorService
contentMetadataCodec, errorHandler, headerLog, ioExecutor, ioRetryHandler, logger, retryHandler, utils, wire
 
Method Summary
protected  org.jclouds.http.HttpResponse invoke(HttpURLConnection connection)
           
 
Methods inherited from class org.jclouds.http.internal.JavaUrlHttpCommandExecutorService
cleanup, configureRequestHeaders, convert, initConnection, writeNothing
 
Methods inherited from class org.jclouds.http.internal.BaseHttpCommandExecutorService
consumeOnClose, invoke, submit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCESS_DENIED

public static final String ACCESS_DENIED
See Also:
Constant Field Values

NOT_FOUND

public static final String NOT_FOUND
See Also:
Constant Field Values
Method Detail

invoke

protected org.jclouds.http.HttpResponse invoke(HttpURLConnection connection)
                                        throws IOException,
                                               InterruptedException
Overrides:
invoke in class org.jclouds.http.internal.JavaUrlHttpCommandExecutorService
Throws:
IOException
InterruptedException


Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.