serveResource() question

View: New views
2 Messages — Rating Filter:   Alert me  

serveResource() question

by hub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

1.

Problem:
In doView() I want to display a PDF form. I call response.createResourceURL() and expect that my serveResource() function will be called, but this does not happen -- i get a blank page (there is no other output). The created resource URL is OK, if I copy/paste it to the browser, my serveResource() is called and the PDF is displayed.
Question:
How do I achieve to display a PDF as response to a RenderRequest ?

Thank you
Hubert

Re: serveResource() question

by hub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

in doView()

response.setContentType("text/html");
PrintWriter writer = response.getWriter();
ResourceURL resURL = response.createResourceURL();
String p = "<object data=\"" + resURL.toString() + "\"" + "type=\"application/pdf\" width=\"100%\" height=\"100%\"";
writer.print(p);

serveResource() is called then.

This works for IE and firefox but....
in IE without problems, in firefox I get a Stacktrace although I get the document in the browser, but sometimes firefox also crashes

Does someone perhaps have a clue?
Thank you
Hubert

17:55:47,953 ERROR [[WorkflowPortlet]] Servlet.service() for servlet WorkflowPortlet threw exception
java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)