Package org.jclouds.http

Examples of org.jclouds.http.HttpResponseException


            exception = new AbiquoException(fromStatusCode(response.getStatusCode()), errors);
         } catch (Exception ex) {
            // If it is not an Abiquo Exception (can not be unmarshalled),
            // propagate a standard
            // HttpResponseException
            exception = new HttpResponseException(command, response, defaultMessage);
         }
      } else {
         // If it is not an Abiquo Exception (there is not an errors xml in the
         // payload)
         // propagate a standard HttpResponseException
         exception = new HttpResponseException(command, response, defaultMessage);
      }

      return exception;
   }
View Full Code Here


      @Override
      public Object createOrPropagate(Throwable from) throws Exception {
         Throwable exception = find(getCausalChain(from), hasResponse(from), null);

         if (exception != null) {
            HttpResponseException responseException = (HttpResponseException) exception;
            HttpResponse response = responseException.getResponse();

            if (response != null && response.getStatusCode() == Status.SEE_OTHER.getStatusCode()) {
               return null;
            }
         }
View Full Code Here

      @Override
      public Boolean createOrPropagate(Throwable from) throws Exception {
         Throwable exception = find(getCausalChain(from), hasResponse(from), null);

         if (exception != null) {
            HttpResponseException responseException = (HttpResponseException) exception;
            HttpResponse response = responseException.getResponse();

            if (response != null && response.getStatusCode() >= 500 && response.getStatusCode() < 600) {
               return false;
            }
         }
View Full Code Here

      public Boolean createOrPropagate(Throwable from) throws Exception {
         Throwable exception = find(getCausalChain(from), isNotAvailableException(from), null);

         if (exception != null) {
            if (exception instanceof HttpResponseException) {
               HttpResponseException responseException = (HttpResponseException) exception;
               HttpResponse response = responseException.getResponse();

               if (response != null && response.getStatusCode() >= 500 && response.getStatusCode() < 600) {
                  return false;
               }
            } else {
View Full Code Here

   @Override
   public VolumeManagementDto createOrPropagate(Throwable from) throws Exception {
      Throwable exception = find(getCausalChain(from), isMovedException(from), null);

      if (exception != null) {
         HttpResponseException responseException = (HttpResponseException) exception;
         HttpResponse response = responseException.getResponse();

         return parser.apply(response).getVolume();
      }

      throw propagate(from);
View Full Code Here

   public void handleError(HttpCommand command, HttpResponse response) {
      // it is important to always read fully and close streams
      byte[] data = closeClientButKeepContentStream(response);
      String message = data != null ? new String(data) : null;

      Exception exception = message != null ? new HttpResponseException(command, response, message)
              : new HttpResponseException(command, response);
      message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
              response.getStatusLine());
      Status status = Status.fromStatusCode(response.getStatusCode());
      switch (status) {
         case BAD_REQUEST:
View Full Code Here

   public void handleError(HttpCommand command, HttpResponse response) {
      // it is important to always read fully and close streams
      byte[] data = closeClientButKeepContentStream(response);
      String message = data != null ? new String(data) : null;

      Exception exception = message != null ? new HttpResponseException(command, response, message)
              : new HttpResponseException(command, response);
      message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
              response.getStatusLine());
      switch (response.getStatusCode()) {
         case 400:
            break;
View Full Code Here

      this.errorParser = errorParser;
   }

   public void handleError(HttpCommand command, HttpResponse response) {
      String message = errorParser.apply(response);
      Exception exception = new HttpResponseException(command, response, message);
      try {
         message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
               response.getStatusLine());
         switch (response.getStatusCode()) {
            case 401:
View Full Code Here

   protected Logger logger = Logger.NULL;

   public void handleError(HttpCommand command, HttpResponse response) {
      // it is important to always read fully and close streams
      String message = parseMessage(response);
      Exception exception = message != null ? new HttpResponseException(command, response, message)
            : new HttpResponseException(command, response);
      try {
         message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
               response.getStatusLine());
         switch (response.getStatusCode()) {
         case 400:
View Full Code Here

   protected Logger logger = Logger.NULL;

   public void handleError(HttpCommand command, HttpResponse response) {
      // it is important to always read fully and close streams
      String message = parseMessage(response);
      Exception exception = message != null ? new HttpResponseException(command, response, message)
            : new HttpResponseException(command, response);
      try {
         message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
               response.getStatusLine());
         switch (response.getStatusCode()) {
         case 400:
View Full Code Here

TOP

Related Classes of org.jclouds.http.HttpResponseException

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.