2 Replies Latest reply on Jul 17, 2006 2:31 AM by hubertg

    download non-html file from portlet

    hubertg

      Hi,

      a portlet normally provides a HTML fragment. All portlets of a portal must provide content of the same content type.

      Now, what if I want to have a link to a pdf, doc, xls .... file within a portlet? Within a servlet I just set the response's content type and write into the out stream. Is there a analogous way for portlets? Thank you very much!

      regards,
      hubert

        • 1. Re: download non-html file from portlet
          bdaw

          Best practise is to create a servlet just like you described, place it in the same web application as your portlet and just link/redirect to it from portlet. Because servlet can share session with your portlet (same web app) you can either secure downloads with some kind of token id passed in querystring and token placed in session. You can even generate content displayed inside your portlet that way

          Refer to attachments in ForumsPortlet implementation.

          • 2. Re: download non-html file from portlet
            hubertg

            Ok, I will try that! Thanks for the quick answer!