Package org.jclouds.rest

Examples of org.jclouds.rest.AuthorizationException


      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


            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

        }
      }

      // Create custom exception for error codes we know about
      if (response.getStatusCode() == 401) {
         exception = new AuthorizationException(message, exception);
      } else if (response.getStatusCode() == 403 || response.getStatusCode() == 404) {
         exception = new ResourceNotFoundException(message, exception);
      }

      command.setException(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

   @Override
   public HttpRequest filter(HttpRequest request) throws HttpException {
      Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
      if (currentCreds.identity.indexOf(':') == -1) {
         throw new AuthorizationException(String.format("Identity %s does not match format tenantId:username",
               currentCreds.identity), null);
      }
      String tenantId = currentCreds.identity.substring(0, currentCreds.identity.indexOf(':'));
      String username = currentCreds.identity.substring(currentCreds.identity.indexOf(':') + 1);
      return request.toBuilder().replaceHeader("TID", tenantId)
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 402:
               exception = new IllegalStateException(message, exception);
               break;
            case 404:
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

               : 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

         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

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.