Showing posts with the label REST

Spring RestTemplate : Follow Redirect Automatically

Follow Redirect Automatically in Spring RestTemplate.... Now since the boost of micro-service based architecture we use web-services a lot. Spring boot is one of the popular framework to work on Micro-service based architecture. Soap web-services are legacy swords and REST( Representational State transfer ) is now the modern time weapon in everybody's arsenal. When we use REST with Spring we have lot of inbuilt functionalities (Converting Response and request to Domain objects, Error handling, HttpStatus code and many more...) offered by Spring. Today we are going to check about RestTemplate. Spring's central class for synchronous client-side HTTP access. This is what Spring says about RestTemplate. RestTemplate provides support to all HTTP Methods. Most popular are GET and POST. So when we are calling any webservice endpoint using RestTemplate GET or POST there are chances that in response you get Redirect response (302 HTTP Status code). Which indicates that this