Package org.jclouds.rest

Examples of org.jclouds.rest.AuthorizationException


            if (message.contains("quota exceeded"))
               exception = new InsufficientResourcesException(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


      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

               : 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

      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

               : 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:
            Exception oldException = exception;        
            String sourcePath = command.getCurrentRequest().getFirstHeaderOrNull(SwiftHeaders.OBJECT_COPY_FROM);
            if (sourcePath != null) {
View Full Code Here

   }

   SshException propagate(Exception e, String message) {
      message += ": " + e.getMessage();
      if (e.getMessage() != null && e.getMessage().indexOf("Auth fail") != -1)
         throw new AuthorizationException("(" + toString() + ") " + message, e);
      throw e instanceof SshException ? SshException.class.cast(e) : new SshException(
               "(" + toString() + ") " + message, e);
   }
View Full Code Here

      try {
         // The response message is already properly populated by the
         // ResponseStatusFromPayloadHttpCommandExecutorService
         switch (response.getStatusCode()) {
            case 401:
               exception = new AuthorizationException(response.getMessage(), exception);
               break;
            case 404:
               exception = new ResourceNotFoundException(response.getMessage(), exception);
               break;
            default:
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

            .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

      switch (status) {
         case BAD_REQUEST:
            break;
         case UNAUTHORIZED:
         case FORBIDDEN:
            exception = new AuthorizationException(message, exception);
            break;
         case NOT_FOUND:
            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.