Announcement Announcement Module
Collapse
No announcement yet.
Using a PDF as a view Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using a PDF as a view

    Hello,

    I am trying to use various static PDF files as the resulting Controller view in a Spring MVC implementation.

    I can do a redirect to a publicly accessible PDF file in my Controller and it works great but I need the PDF files to be stored in an non public folder (i.e. “WEB-INF/pdf/myfoldername/myfilename.pdf”).

    I can’t seem to find a configuration in the Spring viewResolver or other solution to make this happen.

    Any thought or suggestion would be appreciated.

    Thanks

    Sbrummer

  • #2
    I need the PDF files to be stored in an non public folder (i.e. “WEB-INF/pdf/myfoldername/myfilename.pdf”).
    i have a simple suggestion,
    i think that some controller should open your myfilename.pdf right?

    ok, if the answer is yes, you can use acegi to control the access for action/controller before to open some pdf, and you can have the folder in a public place

    HTH

    regards

    Comment


    • #3
      Originally posted by sbrummer View Post
      I can do a redirect to a publicly accessible PDF file in my Controller and it works great but I need the PDF files to be stored in an non public folder (i.e. “WEB-INF/pdf/myfoldername/myfilename.pdf”).
      This is a valid use case for going without a view. Therefore you create something like a DownloadController and it writes the PDF into the response's OutputStream. Instead of a ModelAndView instance the controller is supposed to return null in case of handling the response itself. See the 4th paragraph of the introduction of MVC in the reference.

      Joerg

      Comment

      Working...
      X