I am new in Java, In our application we are using RedirectView for redirecting to particular URL. My question here is there any way by which I can set Headers to this RedirectView Url. As we need to send some data at the redirected Page. I know its a silly question, I have just started studying Java :) Regards, Manish
springboot
RedirectView redirectView = new RedirectView("redirect:/users");
redirectView.setPropagateQueryParams(true);
return redirectView;
You can set using response
. I have taken the example for file attachment.
@RequestMapping(value="",method=RequestMethod.Method)
public myMethod(HttpServletResponse response) throws IOException
{
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + filename);
response.setContentType("application/XXX");
}
You can set the following methods to set response Header
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.