I am using OAuth2RestTemplate
class of spring-security-oauth2-2.1.1.RELEASE
for rest client services. Ideally, whenever an access token expires, the template should retry the failed request by fetching the new access token. But at times, when an access token is expired on post requests, the template is exiting with the following error:
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "REQUEST-URL": cannot retry due to server authentication, in streaming mode; nested exception is java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
Upon searching, I got to know that this behavior is due to the outputStreaming
variable of SimpleClientHttpRequestFactory
and this is set to true by default. I tried to set this variable to false and everything works fine. But I am not aware of what happens if set outputStreaming
variable to false. So I am trying to understand it's purpose which helps me in deciding whether should I go ahead disabling the outputStreaming
.
Thanks in advance!