Displaying doc and xls files using page flows/jsp & ByteArrayInputStream - Weblogic

This is a discussion on Displaying doc and xls files using page flows/jsp & ByteArrayInputStream - Weblogic ; I am getting a ByteArrayInputStream object from the backend into my pageflow. The object is a doc/xls/pdf/zip file which is being retrieved and needs to be opened or saved by giving the user a open/save option. I put the object ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Displaying doc and xls files using page flows/jsp & ByteArrayInputStream

  1. Displaying doc and xls files using page flows/jsp & ByteArrayInputStream


    I am getting a ByteArrayInputStream object from the backend into my pageflow. The
    object is a doc/xls/pdf/zip file which is being retrieved and needs to be opened
    or saved by giving the user a open/save option. I put the object in the request
    context as follows:

    ByteArrayInputStream bStream = null; try { DMQueryResults dm = new DMQueryResults();
    bStream = dm.getFileObjectStream(docName, docID); getRequest().setAttribute("FILEDATA",
    bStream);

    }

    and retrieve it in the jsp as follows:

    ByteArrayInputStream bs = null; bs = (ByteArrayInputStream)request.getAttribute("FILEDATE");


    while(bs.available() > 0) bs.read(); bs.close();

    response.setContentType("application/octet-stream");

    How do I display the file(present the open/save option) to the user in the browser?
    When I try to do

    byte[] data = bs.buf; I get

    This field of type java.io.ByteArrayInputStream is not accessible

    Please respond soon. Thanks


  2. Re: Displaying doc and xls files using page flows/jsp & ByteArrayInputStream


    We are also looking forward to solution to this problem...


    "Joe" wrote:
    >
    >I am getting a ByteArrayInputStream object from the backend into my pageflow.
    >The
    >object is a doc/xls/pdf/zip file which is being retrieved and needs to
    >be opened
    >or saved by giving the user a open/save option. I put the object in the
    >request
    >context as follows:
    >
    >ByteArrayInputStream bStream = null; try { DMQueryResults dm = new DMQueryResults();
    >bStream = dm.getFileObjectStream(docName, docID); getRequest().setAttribute("FILEDATA",
    >bStream);
    >
    >}
    >
    >and retrieve it in the jsp as follows:
    >
    >ByteArrayInputStream bs = null; bs = (ByteArrayInputStream)request.getAttribute("FILEDATE");
    >
    >
    >while(bs.available() > 0) bs.read(); bs.close();
    >
    >response.setContentType("application/octet-stream");
    >
    >How do I display the file(present the open/save option) to the user in
    >the browser?
    >When I try to do
    >
    >byte[] data = bs.buf; I get
    >
    >This field of type java.io.ByteArrayInputStream is not accessible
    >
    >Please respond soon. Thanks
    >



  3. Re: Displaying doc and xls files using page flows/jsp & ByteArrayInputStream


    From thepageflow call the jsp. from the jsp call a servlet. get the data directly
    using ByteArrayInputStream object from the backend into the servlet and write
    to the response from the servlet. This will work. Getting the data int the jpf
    will not work.

    "Rama" wrote:
    >
    >We are also looking forward to solution to this problem...
    >
    >
    >"Joe" wrote:
    >>
    >>I am getting a ByteArrayInputStream object from the backend into my

    >pageflow.
    >>The
    >>object is a doc/xls/pdf/zip file which is being retrieved and needs

    >to
    >>be opened
    >>or saved by giving the user a open/save option. I put the object in

    >the
    >>request
    >>context as follows:
    >>
    >>ByteArrayInputStream bStream = null; try { DMQueryResults dm = new DMQueryResults();
    >>bStream = dm.getFileObjectStream(docName, docID); getRequest().setAttribute("FILEDATA",
    >>bStream);
    >>
    >>}
    >>
    >>and retrieve it in the jsp as follows:
    >>
    >>ByteArrayInputStream bs = null; bs = (ByteArrayInputStream)request.getAttribute("FILEDATE");
    >>
    >>
    >>while(bs.available() > 0) bs.read(); bs.close();
    >>
    >>response.setContentType("application/octet-stream");
    >>
    >>How do I display the file(present the open/save option) to the user

    >in
    >>the browser?
    >>When I try to do
    >>
    >>byte[] data = bs.buf; I get
    >>
    >>This field of type java.io.ByteArrayInputStream is not accessible
    >>
    >>Please respond soon. Thanks
    >>

    >



+ Reply to Thread