Package org.jclouds.digitalocean.domain

Examples of org.jclouds.digitalocean.domain.BaseResponse


               close(originalInputStream, true);
            }
         }

         // Process the payload and look for errors
         BaseResponse responseContent = errorParser.apply(in);
         if (responseContent != null && responseContent.getStatus() == Status.ERROR) {
            // Yes, this is ugly, but the DigitalOcean API sometimes sets the status code to 200 for these errors and
            // the only way to know what happened is parsing the error message
            String message = responseContent.getMessage();
            if (ACCESS_DENIED.equals(message)) {
               response.statusCode(401);
            } else if (NOT_FOUND.equals(message)) {
               response.statusCode(404);
            } else {
               response.statusCode(500);
            }
            response.message(responseContent.getDetails());
         }

         // Reset the input stream and set the payload, so it can be read again
         // by the response and error parsers
         in.reset();
View Full Code Here


               close(originalInputStream, true);
            }
         }

         // Process the payload and look for errors
         BaseResponse responseContent = errorParser.apply(in);
         if (responseContent != null && responseContent.getStatus() == Status.ERROR) {
            // Yes, this is ugly, but the DigitalOcean API sometimes sets the status code to 200 for these errors and
            // the only way to know what happened is parsing the error message
            String message = responseContent.getMessage();
            if (ACCESS_DENIED.equals(message)) {
               response.statusCode(401);
            } else if (NOT_FOUND.equals(message)) {
               response.statusCode(404);
            } else {
               response.statusCode(500);
            }
            response.message(responseContent.getDetails());
         }

         // Reset the input stream and set the payload, so it can be read again
         // by the response and error parsers
         in.reset();
View Full Code Here

TOP

Related Classes of org.jclouds.digitalocean.domain.BaseResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.