Skip to content
Advertisement

Tag: resttemplate

Why handleResponse(URI url, HttpMethod method, ClientHttpResponse response) method of RestTemplate.class is getting called for a 200 Succeess response

I am calling an external API from my code using RestTemplate like below: This API call is returning 200 Success but when I debug it, it still goes to handleResponse(URI url, HttpMethod method, ClientHttpResponse response) method of RestTemplate.class And then it’s coming to my RestTemplateErrorHandler.java file Can someone lease help me to understand if it’s the correct behaviour. I suspect

Java Exception: Unauthorized: 401

I’m getting the error: Exception: org.springframework.web.client.HttpClientErrorException$Unauthorized: 401, when trying to connect to Jira through HttpHeader, and the credentials are configured in a configserver file, which would be this: And the method where I command to call the file above and where I get the error on the line ResponseEntity<String> result = restTemplate.exchange(url, HttpMethod.GET,this.requestEnt, String.class);, would be this: In fact, when

How do I retrieve Resource object using restTemplate in Spring Boot?

So, basically the title. I got 2 microservices. One generates and sends a zip file and the other one receives it, then does some magic, converts it to an array[] of bytes and then sends it somewhere else. But it’s just in theory – I coldn’t make it work. I need to download a Resource (https://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/resources.html) that contains InputStream that

Advertisement