org.jclouds.vcloud.director.v1_5.handlers
Class InvalidateSessionAndRetryOn401AndLogoutOnClose

java.lang.Object
  extended by org.jclouds.http.handlers.BackoffLimitedRetryHandler
      extended by org.jclouds.vcloud.director.v1_5.handlers.InvalidateSessionAndRetryOn401AndLogoutOnClose
All Implemented Interfaces:
HttpRetryHandler, IOExceptionRetryHandler

public class InvalidateSessionAndRetryOn401AndLogoutOnClose
extends BackoffLimitedRetryHandler

If the credentials supplied in the authentication header are invalid, or if the token has expired, the server returns HTTP response code 401. The token expires after a configurable interval of api inactivity. The default is 30 minutes after the token is created. After the token expires, you must log in again to obtain a new token.

Author:
Adrian Cole

Field Summary
protected  Logger logger
           
 
Fields inherited from class org.jclouds.http.handlers.BackoffLimitedRetryHandler
INSTANCE
 
Fields inherited from interface org.jclouds.http.HttpRetryHandler
ALWAYS_RETRY, NEVER_RETRY
 
Fields inherited from interface org.jclouds.http.IOExceptionRetryHandler
ALWAYS_RETRY, NEVER_RETRY
 
Constructor Summary
protected InvalidateSessionAndRetryOn401AndLogoutOnClose(com.google.common.cache.LoadingCache<Credentials,SessionWithToken> authenticationResponseCache, SessionApi sessionApi)
           
 
Method Summary
 void logoutOnClose()
          it is important that we close any sessions on close to help the server not become overloaded.
 boolean shouldRetryRequest(HttpCommand command, HttpResponse response)
          Return true if the command should be retried.
 
Methods inherited from class org.jclouds.http.handlers.BackoffLimitedRetryHandler
imposeBackoffExponentialDelay, imposeBackoffExponentialDelay, imposeBackoffExponentialDelay, shouldRetryRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger
Constructor Detail

InvalidateSessionAndRetryOn401AndLogoutOnClose

@Inject
protected InvalidateSessionAndRetryOn401AndLogoutOnClose(com.google.common.cache.LoadingCache<Credentials,SessionWithToken> authenticationResponseCache,
                                                                SessionApi sessionApi)
Method Detail

shouldRetryRequest

public boolean shouldRetryRequest(HttpCommand command,
                                  HttpResponse response)
Description copied from interface: HttpRetryHandler
Return true if the command should be retried. This method should only be invoked when the response has failed with a HTTP 5xx error indicating a server-side error.

Specified by:
shouldRetryRequest in interface HttpRetryHandler
Overrides:
shouldRetryRequest in class BackoffLimitedRetryHandler

logoutOnClose

@PreDestroy
public void logoutOnClose()
it is important that we close any sessions on close to help the server not become overloaded.



Copyright © 2009-2012 jclouds. All Rights Reserved.