public abstract class RESTWebServiceClient extends Object
| Constructor and Description |
|---|
RESTWebServiceClient() |
| Modifier and Type | Method and Description |
|---|---|
protected javax.ws.rs.client.Client |
buildJerseyClient(javax.ws.rs.ext.ContextResolver<com.fasterxml.jackson.databind.ObjectMapper> jsoncxtresolver)
Build a JAX-RS Client from Jersey Builder instead of automatic service
provider client.
|
boolean |
endSession()
End a user session by contacting the Access Control Manager using the current
authorization session tokens.
|
abstract String |
getClientID() |
String |
getPassword() |
String |
getUsername() |
boolean |
refreshSession()
Refresh a user session to avoid expiration of access.
|
abstract void |
setHTTPHeader(String name,
String value)
Set HTTP header for all subsequent requests (e.g.
|
void |
setPassword(String password)
Set the password to use for the authorized HTTP session.
|
protected void |
setSession(AccessControlManager.AccessTokens accesstokens)
Set the access tokens of this client to the specified ones.
|
void |
setUsername(String username)
Set the username to use for the authorized HTTP session.
|
boolean |
startSession()
Start a user session by contacting the Access Control Manager for
authentication using the credentials set with
setUsername(String) and
setPassword(String). |
public static final Logger logger
public abstract String getClientID()
public abstract void setHTTPHeader(String name, String value)
name - the name of the HTTP header.value - the value of the HTTP header.public String getUsername()
public void setUsername(String username)
username - the username to use for the authorized HTTP session.public String getPassword()
public void setPassword(String password)
password - the password to use for the authorized HTTP session.public boolean startSession()
setUsername(String) and
setPassword(String). Once this method returns
true all requests to the web service will be performed with
proper authorization and protected resources will be available.true if user session is authenticated,
false otherwise.public boolean endSession()
true the
user session is finished and all requests to the web service will only
succeed for unprotected resources and fail for protected ones.true if user session is properly ended,
false otherwise.public boolean refreshSession()
true if session access is refreshed successfully,
false otherwise.protected void setSession(AccessControlManager.AccessTokens accesstokens)
null, nothing
is done.accesstokens - valid access tokens.protected javax.ws.rs.client.Client buildJerseyClient(javax.ws.rs.ext.ContextResolver<com.fasterxml.jackson.databind.ObjectMapper> jsoncxtresolver)
jsoncxtresolver - the JSON object mapper context resolver.Client object from the JerseyClientBuilder.Copyright © 2020. All rights reserved.