Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to download BLOB generated by PL/SQL function?

NeqJul 10 2013 — edited Jul 14 2013

Hi!

I have a problem with combining fileDownloadActionListener and BLOB returned by PL/SQL function.

Simply, I have a ADF table with some parameters for function and commandLink in each row. CommandLink calls some Java (getBlob method) to get BLOB (BlobDomain) from PL/SQL function. This part works perfectly.

Next, fileDownloadActionListener should call some method like this:

    public void downloadImage(FacesContext facesContext, OutputStream outputStream)
    {
        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

        // get an ADF attributevalue from the ADF page definitions
        AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("getBlob");
        if (attr == null)
        {
            return;
        }

        // the value is a BlobDomain data type
        BlobDomain blob = (BlobDomain) attr.getInputValue();

        try
        {   // copy hte data from the BlobDomain to the output stream
            IOUtils.copy(blob.getInputStream(), outputStream);
            // cloase the blob to release the recources
            blob.closeInputStream();
            // flush the outout stream
            outputStream.flush();
        }
        catch (IOException e)
        {
            // handle errors
            e.printStackTrace();
            FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
            FacesContext.getCurrentInstance().addMessage(null, msg);
        }
    }

and here is the problem: I get blank page. No errors, just nothing.

I'm not sure what is wrong. Thanks for any help.

I'm runing JDeveloper 11.1.1.6.0

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2013
Added on Jul 10 2013
7 comments
1,624 views