Skip to main content

developerWorks >  Java technology  >  Forums  >  Server-side Java programming  >  developerWorks

File Download issue with JSF and portal server    Point your RSS reader here for a feed of the latest messages in this thread


     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
Permlink Replies: 0 - Pages: 1 Threads: [ Previous | Next ]
ushasree

Posts: 1
Registered: Oct 28, 2009 04:04:53 PM
File Download issue with JSF and portal server
Posted: Oct 28, 2009 04:20:56 PM
Click to report abuse...   Click to reply to this thread Reply
I need to create a link on a jsp page, to download a file from the server.
I am using a commandlink to invoke an action on click of this link. In the action method, I am trying to get the outputStream of response and this always returns null.
Here goes the sample code.

HttpServletResponse response = (HttpServletResponse) getFacesContext().getExternalContext().getResponse();
response.setContentType("application/force-download");
+response.setHeader("Content-Disposition", "attachment;filename=\"" ++
+ fileName + "\"");+
+ServletOutputStream os = response.getOutputStream();

response.getOutputStream() always returns null in the portlet.
Gping thropught begugger I noticed the response is of type ActionResponseWrapper. Not sure how to get the actual resposnefrom this and get the outputStream.

Any help is appreciated.

Thanks

 Tags
Help

Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular type of content or application that you're viewing.

My tags shows your tags for this particular type of content or application that you're viewing.

 

MoreLess 


Point your RSS reader here for a feed of the latest messages in all forums