I want to make a link for telecharger file PDF, in a portlet, but that does not work, i
have a error.
Here is my code in the portlet:
public void doView(RenderRequest req, RenderResponse rep)
| throws PortletException, IOException {
| String filename = (String) req.getParameter("filename");
|
| if (filename!=null) {
| rep.setContentType("application/pdf");
| File file= new File ("C://Documents and Settings/"+filename);
| InputStream in = new FileInputStream(ff);
| OutputStream outs = rep.getPortletOutputStream(); try {
| int bit = in.read();
| while ((bit) >= 0) {
| outs.write(bit);
| bit = in.read();
| }
| } catch (Exception e) {
| e.printStackTrace(System.out);
| }
| outs.flush();
| outs.close();
| in.close();
| }
| }
i have this exception:
Cause: javax.portlet.PortletException: org.apache.jasper.JasperException:
java.lang.IllegalStateException: The window output stream is already used
Message: org.apache.jasper.JasperException: java.lang.IllegalStateException: The window
output stream is already used
StackTrace:
javax.portlet.PortletException: org.apache.jasper.JasperException:
java.lang.IllegalStateException: The window output stream is already used
at
org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:91)
at portal.portlets.PListeFormation.doView(Unknown Source)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155442#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...