The moose likes Portals and Portlets and the fly likes JSR-286 question: Portlet / serveResource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "JSR-286 question: Portlet / serveResource" Watch "JSR-286 question: Portlet / serveResource" New topic

JSR-286 question: Portlet / serveResource

Hub Fel

Joined: Oct 21, 2009
Posts: 10
Hi all,

In doView() I want to display a PDF form, so I call response.createResourceURL() within doView() 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.
How do I achieve to display a PDF as response to a RenderRequest in doView()?

Thank you
Hub Fel

Joined: Oct 21, 2009
Posts: 10
with the following in doView()

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

my serveResource() does
OutputStream outstream = resourceResponse.getPortletOutputStream();

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

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)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:737)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.ja
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:126)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:570)
at org.apache.coyote.Response.doWrite(Response.java:560)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:354)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:83)

I agree. Here's the link: http://aspose.com/file-tools
subject: JSR-286 question: Portlet / serveResource
Similar Threads
Page Forward in Portlets
Portlet Cacheability Levels
images are not displayed in the portlet ... Please help
is session always required to accomplish this?
processAction method doubt