July 09
Most portals can't handle portlet content types other than
'text/html'. The reason is that the content has to be rendered inside
the overall web page of the portal (which is generally in html) and it
has no way to render other mime types within that page. So, in order to
download a dynamically generated file (such as a Excel spreadsheet or a
PDF) or to include a dynamically generated image in your portlet, you
have to create a link to a non-portlet URL that will return the desired
content. This is usually done with a traditional servlet from within
the same webapp as your portlet. There are some important factors to
consider when doing this:
- Security: If the content coming from your servlets is
at all sensitive in nature, you need to make sure they are secure and
that a cut-and-paste of a URL doesn't give direct access to
unauthorized users. If you are currently relying only on portal-based
security, then this can be a problem. You will need to make sure that
the servlet can properly verify the authentication and authorization of
the user. The most likely way to do this is by sharing some session
data between the portlet and servlet.