Package com.cloudcontrolled.api.response

Examples of com.cloudcontrolled.api.response.CreateTokenResponse


  public void renewToken() {
    CreateTokenRequest createTokenRequest = new CreateTokenRequest();
    createTokenRequest.setUser(credentials.getUserName());
    createTokenRequest.setPassword(credentials.getPassword());

    CreateTokenResponse createTokenResponse;
    try {
      createTokenResponse = send(createTokenRequest);
    } catch (ValidationConstraintViolationException vcve) {
      throw new AuthorizationException(vcve);
    }

    HttpStatus status = HttpStatus.getStatus(createTokenResponse.getStatusCode());
    if (status.isError()) {
      if (status.equals(HttpStatus.Unauthorized)) {
        throw new AuthorizationException(HttpStatus.Unauthorized.toString());
      } else {
        throw new CommunicationErrorException(status);
      }
    }

    String newToken = createTokenResponse.getToken();
    tokenStore.setToken(newToken);
  }
View Full Code Here

TOP

Related Classes of com.cloudcontrolled.api.response.CreateTokenResponse

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.