0

I have an application that I deploy in Tomcat. When I run app it generate static data (js, css, html etc) for report with html report page and put it in user.home directory. After that I want to redirect to that html report page. I've tried to redirect with ModelAndView, RedirectView, "redirect:/" and etc. but all browsers show me ERR_UNSAFE_REDIRECT since I can't open external file from browser for security reasons. So how can I open that page from my app? Thank you in advance.

@GetMapping("/reports")
    public ModelAndView getReportsView() {
        return new ModelAndView("redirect:" + "C:/Users/…/html-reports/overview-tags.html");
    }
3
  • You can't. You need to generate the report and stream it via the HttpServletResponse instance you can specify as a method argument. stackoverflow.com/questions/27741283/… Commented Jul 17, 2019 at 7:53
  • Possible duplicate of Downloading a file from spring controllers Commented Jul 17, 2019 at 7:55
  • Thanks, it helps to copy that page in httpServletResponse but now I faced with problem how to show that page using static resources (as js and css styles, fonts etc) because page generated with that static data and when I copied through the stream I move only html! Commented Jul 17, 2019 at 8:27

1 Answer 1

0

Finally i solve my problem with Apache HTTPD server. In spring controller I redirect to Apache http server that configured to show static data in folder

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.