Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RPCRequest Servlet OutputStream

    We are making a DMI call to download a PDF file. Is there a way to get the output stream from the RPCRequest? We've been doing
    Code:
    rpcRequest.getRPCManager().getContext().response.getOutputStream()
    which does work, we get the PDF document in the browser. However, in the console we then get the error stack trace:
    Code:
    java.lang.IllegalStateException: STREAM
        at org.eclipse.jetty.server.Response.getWriter(Response.java:910)
        at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:152)
        at com.isomorphic.servlet.ProxyHttpServletResponse.getWriter(ProxyHttpServletResponse.java:173)
        at com.isomorphic.servlet.RequestContext.out(RequestContext.java:528)
        at com.isomorphic.rpc.RPCManager.completeResponse(RPCManager.java:1460)
        at com.isomorphic.rpc.RPCManager.send(RPCManager.java:690)
        at com.isomorphic.rpc.RPCManager.processRPCTransaction(RPCManager.java:2917)
    Is there a correct way to get the output stream from the RPCRequest that won't cause this error? Or should this be coming through a DSRequest from a data source?

    #2
    You have to tell the framework that you're taking over response writing, via calling RPCManager.doCustomResponse(). Then the stream is all yours. Complete sample here.

    Comment


      #3
      Perfect! Exactly what I was looking for. Thank you

      Comment

      Working...
      X