|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.social.oauth1.AbstractOAuth1ApiBinding
public abstract class AbstractOAuth1ApiBinding
Base class for OAuth 1-based provider API bindings.
Constructor Summary | |
---|---|
protected |
AbstractOAuth1ApiBinding()
Constructs the API template without user authorization. |
protected |
AbstractOAuth1ApiBinding(java.lang.String consumerKey,
java.lang.String consumerSecret,
java.lang.String accessToken,
java.lang.String accessTokenSecret)
Constructs the API template with OAuth credentials necessary to perform operations on behalf of a user. |
Method Summary | |
---|---|
protected void |
configureRestTemplate(RestTemplate restTemplate)
Subclassing hook to enable customization of the RestTemplate used to consume provider API resources. |
protected ByteArrayHttpMessageConverter |
getByteArrayMessageConverter()
Returns a ByteArrayHttpMessageConverter to be used by the internal RestTemplate when consuming image or other binary resources. |
protected FormHttpMessageConverter |
getFormMessageConverter()
Returns an FormHttpMessageConverter to be used by the internal RestTemplate . |
protected MappingJacksonHttpMessageConverter |
getJsonMessageConverter()
Returns a MappingJacksonHttpMessageConverter to be used by the internal RestTemplate . |
protected java.util.List<HttpMessageConverter<?>> |
getMessageConverters()
Returns a list of HttpMessageConverter s to be used by the internal RestTemplate . |
RestTemplate |
getRestTemplate()
Obtains a reference to the REST client backing this API binding and used to perform API calls. |
boolean |
isAuthorized()
Returns true if this API binding has been authorized on behalf of a specific user. |
void |
setRequestFactory(ClientHttpRequestFactory requestFactory)
Set the ClientHttpRequestFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractOAuth1ApiBinding()
protected AbstractOAuth1ApiBinding(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String accessToken, java.lang.String accessTokenSecret)
consumerKey
- the application's consumer keyconsumerSecret
- the application's consumer secretaccessToken
- the access tokenaccessTokenSecret
- the access token secretMethod Detail |
---|
public void setRequestFactory(ClientHttpRequestFactory requestFactory)
requestFactory
- the request factorypublic boolean isAuthorized()
ApiBinding
isAuthorized
in interface ApiBinding
MissingAuthorizationException
public RestTemplate getRestTemplate()
RestTemplate.setMessageConverters(java.util.List)
,
RestTemplate.setErrorHandler(org.springframework.web.client.ResponseErrorHandler)
protected void configureRestTemplate(RestTemplate restTemplate)
restTemplate
- the RestTemplate to configure.protected java.util.List<HttpMessageConverter<?>> getMessageConverters()
HttpMessageConverter
s to be used by the internal RestTemplate
.
By default, this includes a StringHttpMessageConverter
, a MappingJacksonHttpMessageConverter
, a ByteArrayHttpMessageConverter
, and a FormHttpMessageConverter
.
The FormHttpMessageConverter
is set to use "UTF-8" character encoding.
Override this method to add additional message converters or to replace the default list of message converters.
protected FormHttpMessageConverter getFormMessageConverter()
FormHttpMessageConverter
to be used by the internal RestTemplate
.
By default, the message converter is set to use "UTF-8" character encoding.
Override to customize the message converter (for example, to set supported media types or message converters for the parts of a multipart message).
To remove/replace this or any of the other message converters that are registered by default, override the getMessageConverters() method instead.
protected MappingJacksonHttpMessageConverter getJsonMessageConverter()
MappingJacksonHttpMessageConverter
to be used by the internal RestTemplate
.
Override to customize the message converter (for example, to set a custom object mapper or supported media types).
To remove/replace this or any of the other message converters that are registered by default, override the getMessageConverters() method instead.
protected ByteArrayHttpMessageConverter getByteArrayMessageConverter()
ByteArrayHttpMessageConverter
to be used by the internal RestTemplate
when consuming image or other binary resources.
By default, the message converter supports "image/jpeg", "image/gif", and "image/png" media types.
Override to customize the message converter (for example, to set supported media types).
To remove/replace this or any of the other message converters that are registered by default, override the getMessageConverters() method instead.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |