Package org.jclouds.rest

Examples of org.jclouds.rest.AuthorizationException


            .addHeader(AUTHORIZATION, basic(input.identity, input.credential)) //
            .build());

      Optional<Cookie> token = readAuthenticationToken(response);
      if (!token.isPresent()) {
         throw new AuthorizationException("Could not obtain a new authentication token");
      }

      return token.get().getValue();
   }
View Full Code Here


               : new HttpResponseException(command, response);
      message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
               response.getStatusLine());
      switch (response.getStatusCode()) {
         case 401:
            exception = new AuthorizationException(exception.getMessage(), exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               String path = command.getCurrentRequest().getEndpoint().getPath();
               Matcher matcher = CONTAINER_PATH.matcher(path);
View Full Code Here

            case 400:
               exception = new IllegalArgumentException(message, exception);
               break;
            case 401:
            case 403:
               exception = new AuthorizationException(message, exception);
               break;
            case 404:
               if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
                  exception = new ResourceNotFoundException(message, exception);
               }
View Full Code Here

      } else if (ILLEGAL_STATE_PATTERN.matcher(error).matches()) {
         refinedException = new IllegalStateException(error, exception);
      } else if (ILLEGAL_ARGUMENT_PATTERN.matcher(error).matches()) {
         refinedException = new IllegalArgumentException(error, exception);
      } else if (AUTH_PATTERN.matcher(error).matches()) {
         refinedException = new AuthorizationException(error, exception);
      } else if (NOT_IMPLEMENTED_PATTERN.matcher(error).matches()) {
         refinedException = new UnsupportedOperationException(error, exception);
      }
      return refinedException;
   }
View Full Code Here

            case 401:
            case 403:
               // Authorization exceptions do not return an errors DTO, so we
               // encapsulate a
               // generic exception
               exception = new AuthorizationException(defaultMessage, new HttpResponseException(command, response,
                     defaultMessage));
               break;
            case 404:
               exception = new ResourceNotFoundException(defaultMessage, getExceptionToPropagate(command, response,
                     defaultMessage));
View Full Code Here

               : new HttpResponseException(command, response);
      message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
               response.getStatusLine());
      switch (response.getStatusCode()) {
         case 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
View Full Code Here

      switch (response.getStatusCode()) {
         case 400:
            break;
         case 401:
         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
View Full Code Here

         message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
                  response.getStatusLine());
         switch (response.getStatusCode()) {
            case 401:
            case 403:
               exception = new AuthorizationException(message, exception);
               break;
            case 404:
               if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
                  exception = new ResourceNotFoundException(message, exception);
               }
View Full Code Here

      super(json, TypeLiteral.get(GlacierError.class));
   }

   private static Exception refineException(GlacierError error, Exception exception) {
      if ("AccessDeniedException".equals(error.getCode())) {
         return new AuthorizationException(error.getMessage(), exception);
      } else if ("InvalidParameterValueException".equals(error.getCode())) {
         return new IllegalArgumentException(error.getMessage(), exception);
      } else if ("LimitExceededException".equals(error.getCode())) {
         return new InsufficientResourcesException(error.getMessage(), exception);
      } else if ("ResourceNotFoundException".equals(error.getCode())) {
View Full Code Here

               exception = new IllegalStateException(message, exception);
            else
               exception = new IllegalArgumentException(message, exception);
            break;
         case 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
View Full Code Here

TOP

Related Classes of org.jclouds.rest.AuthorizationException

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.