I have a problem statement where I need to pass HttpServletRequest from one controller to another so that I can extract the Authorization header in another controller. Any lead appreciated please let me know how I can pass it through feign client API request and How I accept it in another controller.
Thanks in advance.
This is the simple example that how you will pass the Httprequest from one controller to other controller.
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);
MultiValueMap<String, Object> form = new LinkedMultiValueMap<>();
form.add("name", request.getParameter("name"));
form.add("abc", request.getParameter("abc"));
form.add("xyz", request.getParameter("xyz"));
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(form, httpHeaders);
restTemplate.postForEntity("http:localhost:8080/save", requestEntity, String.class);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.