Class OAuthTokenRestTemplate
- java.lang.Object
-
- org.springframework.http.client.support.HttpAccessor
-
- org.springframework.http.client.support.InterceptingHttpAccessor
-
- org.springframework.web.client.RestTemplate
-
- ca.corefacility.bioinformatics.irida.repositories.remote.resttemplate.OAuthTokenRestTemplate
-
- All Implemented Interfaces:
org.springframework.web.client.RestOperations
public class OAuthTokenRestTemplate extends org.springframework.web.client.RestTemplate
Rest Template used to communicate with OAuth2 enabled REST APIs. Uses aRemoteAPITokenService
to read OAuth2 tokens to use.
-
-
Constructor Summary
Constructors Constructor Description OAuthTokenRestTemplate(RemoteAPITokenService tokenService, RemoteAPI remoteAPI)
Create a new OAuthTokenRestTemplate with the givenRemoteAPITokenService
and connecting to the givenRemoteAPI
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.http.client.ClientHttpRequest
createRequest(java.net.URI uri, org.springframework.http.HttpMethod method)
Add an OAuth token from the tokenRepository to the requestorg.springframework.web.client.ResponseErrorHandler
getErrorHandler()
void
setRemoteAPI(RemoteAPI remoteAPI)
Set the API this rest template will communicate with-
Methods inherited from class org.springframework.web.client.RestTemplate
acceptHeaderRequestCallback, delete, delete, delete, doExecute, exchange, exchange, exchange, exchange, exchange, exchange, exchange, exchange, execute, execute, execute, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, getMessageConverters, getUriTemplateHandler, handleResponse, headersExtractor, headForHeaders, headForHeaders, headForHeaders, httpEntityCallback, httpEntityCallback, optionsForAllow, optionsForAllow, optionsForAllow, patchForObject, patchForObject, patchForObject, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put, responseEntityExtractor, setDefaultUriVariables, setErrorHandler, setMessageConverters, setUriTemplateHandler
-
Methods inherited from class org.springframework.http.client.support.InterceptingHttpAccessor
getInterceptors, getRequestFactory, setInterceptors, setRequestFactory
-
-
-
-
Constructor Detail
-
OAuthTokenRestTemplate
public OAuthTokenRestTemplate(RemoteAPITokenService tokenService, RemoteAPI remoteAPI)
Create a new OAuthTokenRestTemplate with the givenRemoteAPITokenService
and connecting to the givenRemoteAPI
- Parameters:
tokenService
- theTokenService
to get OAuth2 tokens fromremoteAPI
- theRemoteAPI
this rest template will communicate with
-
-
Method Detail
-
createRequest
protected org.springframework.http.client.ClientHttpRequest createRequest(java.net.URI uri, org.springframework.http.HttpMethod method) throws java.io.IOException
Add an OAuth token from the tokenRepository to the request- Overrides:
createRequest
in classorg.springframework.http.client.support.HttpAccessor
- Throws:
java.io.IOException
-
getErrorHandler
public org.springframework.web.client.ResponseErrorHandler getErrorHandler()
- Overrides:
getErrorHandler
in classorg.springframework.web.client.RestTemplate
-
-