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

Spring boot server receiving param with %20 instead of space

I have spring boot server with controller and one endpoint: And another spring boot application which is sending request with restTemplate.getForEntity info log with url prints this: Reference data URL http://some-name:8080/readProperty?channel=E&service_name=Some%20Value Problem is that when I call this endpoint with curl command and with restTemplate.getForEntity I receive different values for service_name param in controller 1. Curl When I copy this

Deserialising JSON array using RestTemplate

I’m trying to convert JSON data to a java class using Rest Template. The JSON data has this format and cannot be changed: The java class to save the data is: To receive the JSON data and deserialize i’m doing: But i’m getting this exception: I’ve done this before and it worked, but the JSON data had a slightly different

Advertisement