-1

How to do the resttemplate configuration to make call over https and the response will be a 302 redirect.

Trying to make rest tamplate call to a server over https with a Bearer token after authentication of the token the server do a 302 redirect.

String redirectUrl="https://example.com/redirect";
String authHeader="Bearer eyJhbGciO";
HttpHeaders requestHeaders = new HttpHeaders();
        requestHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        requestHeaders.set("Authorization", authHeader);
        Map<String, Object> uriVariables = new HashMap<>();
        HttpEntity<String> requestEntity = new HttpEntity<>(null, requestHeaders);
        ResponseEntity<ModelAndView> modelres = restTemplate.exchange(redirectUrl,HttpMethod.GET,requestEntity, ModelAndView.class,uriVariables);

How to make rest client call over https?

1 Answers1

0

You need to configure the SSL certificate to make an https call. Get the certificate and configure. This post may help you

Nagaraja R
  • 19
  • 5