You need create a direct link to a file not a portlet URL .
For static file use request.getContextPath()
For dynamic file create an URL to a servlet in the same web application and pass data to it using PortletSession.APPLICATION_SCOPE.
I tried setting:
in the doView method, and I get Content type not accepted.
No. You simply can't do this like that. This is the same problem as "I want to download a file that I store in database from inside a portlet and .setContentType() doesn't work...".
Portal agregates content from all portlets on the portal page, so you always generate only page fragment in a portlet. If you have the static file in your web archive then use DIRECT URL to it. If it's dynamic content you MUST use an URL to servlet that will do the job for you.