ADF and BLOBs

Hi All,
What is the best way to display a PDF document stored in a blob column using ADF, BC4J and Struts?
Thanks,
Matt

Hi Matt,
here is my solution I use in an Jdev904 appliation with Tomcat as Webcontainer. I have delete some code to show just the important parts. The solution works for me, but everyone is invited to post some improvements.
Markus
1.) EntityObject with attribute of type BlobDomain (and a default VO based on EO).
2.) a JSP containing a line like
download
3.) showPDFDocument.do Action:
public class ShowPDFDocument extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
BlobDomain blob = (BlobDomain) row.getAttribute("Blob");
byte[] blobArray = blob.toByteArray();
String docURI = (String)rows[0].getAttribute("Name");
if (docURI.endsWith(".pdf") == false){
docURI += ".pdf";
docURI = "pdfs/" + docURI;
request.getSession().setAttribute("PDFfilename", docURI);
request.getSession().setAttribute("thePDF", blobArray);
return new ActionForward(docURI, true);
4.) The redirect calls the PDFResponseServlet:
public class PDFResponseServlet extends HttpServlet {
protected void doPost(HttpServletRequest p0, HttpServletResponse p1)
throws ServletException, IOException {
byte[] blobArray = (byte[]) request.getAttribute("thePDF");
if (blobArray == null){
blobArray = (byte[]) request.getSession().getAttribute("thePDF");
Boolean isDownload = (Boolean) request.getSession().getAttribute("doPDFDownload");
if (isDownload != null && isDownload.booleanValue() == true){
String filename = (String) request.getSession().getAttribute("PDFfilename");
if (filename == null || filename.length()==0){
filename = "myPDF.pdf";
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
response.setContentType("application/pdf;charset=windows-1252");
response.setContentLength(blobArray.length);
response.getOutputStream().write(blobArray);
response.getOutputStream().flush();
5.) web.xml
<servlet>
<servlet-name>PDFResponse</servlet-name>
<servlet-class>com.trivadis.efa.controller.PDFResponseServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>PDFResponse</servlet-name>
<url-pattern>/pdfs/*</url-pattern>
</servlet-mapping>

Similar Messages

  • About "Upload and download files from ADF into blob type colum."

    hi
    Using JDeveloper 10.1.3.3.0 I have tried the example available for download from this blog post by Jakub Pawlowski:
    "Upload and download files from ADF into blob type colum."
    at http://kuba.zilp.pl/?id=1
    First a thank you to Jakub for this interesting example.
    I have a question about a PDF file that I uploaded using the example.
    The file has a size of 10445518 bytes.
    After I upload that file, the blob column has a value with a size of 10445516 bytes, 2 bytes less.
    SQL> select file_name, dbms_lob.getlength(stored_file) from blob_table;
    FILE_NAME
    DBMS_LOB.GETLENGTH(STORED_FILE)
    ADF-DeveloperGuide-4GL-B25947_01.pdf
                           10445516If I download that file using the example, it has the same size as the blob value, 10445516 bytes.
    If I open the downloaded file, using Adobe Reader 8.1.1, it first shows this message:
    "The file is damaged but is being repaired."
    After that, there is not problem using the PDF file in Adobe Reader.
    I have tried this with both Internet Explorer 6 and Firefox 2.0.0.11.
    I have also tried this with other (smaller) files, and those upload and download correctly.
    question:
    Why are those 2 bytes lost during upload?
    many thanks
    Jan Vervecken

    Hi!
    I can only post you my code that works for me and as I said I had same problems but can't remember what solved them. My code:
      public void fileUploaded(ValueChangeEvent event)
        FacesContext fc = FacesContext.getCurrentInstance();
        UploadedFile file = (UploadedFile) event.getNewValue();
        if (file != null && file.getLength() > 0)
          // here I have some messages written and a call to the method on AM to save the uploaded file to the DB
      private BlobDomain newBlobDomainForInputStream(InputStream in)
        throws SQLException, IOException
        BlobDomain loBlob = new BlobDomain();
        OutputStream out = loBlob.getBinaryOutputStream();
        writeInputStreamToWriter(in, out);
        in.close();
        out.close();
        return loBlob;
      private static void writeInputStreamToWriter(InputStream in,
                                                   OutputStream out)
        throws IOException
        byte[] buffer = new byte[8192];
        int charsRead = 0;
        while ((charsRead = in.read(buffer, 0, 8192)) != -1)
          out.write(buffer, 0, charsRead);
       * Launch the upload - see fileUploaded() for actual upload handling.
       * @return null navigation event - we stay on this page
      public String UploadButton_action()
        if (this.getMyInputFile().getValue() == null)
          FacesContext context = FacesContext.getCurrentInstance();
          FacesMessage message =
            new FacesMessage(FacesMessage.SEVERITY_WARN, JSFUtils.getStringFromBundle("fileupload.emptyfielderror"),
                             null);
          context.addMessage(this.getMyInputFile().getId(), message);
        return null;
       * Setter for inputFile UI Component.
       * @param inputFile inputFile UI component
      public void setMyInputFile(CoreInputFile inputFile)
        this.myInputFile = inputFile;
       * Getter for inputFile UI Component.
       * @return inputFile UI component
      public CoreInputFile getMyInputFile()
        return myInputFile;
      }fileUploaded is a valueChangeListener on inputFile and UploadButton_action is as the name says the action for upload button.
    Hope this helps. If not, than your problem is probably not the same as mine was, although the message about file corrupted was the same.
    Next thing you can check in this case is if your file exceeds max file upload size. I don't know the exact default value, but if the file is too long I think this upload logic will upload only a part of the file and save it to the DB which can also lead to the same file corrupted error.
    You can set the max upload value in web.xml like this:
    <context-param>
    <!-- Maximum memory per request (in bytes) -->
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name>
    <!-- Use 5000K -->
    <param-value>5120000</param-value>
    </context-param>
    <context-param>
    <!-- Maximum disk space per request (in bytes) -->
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name>
    <!-- Use 10,000K -->
    <param-value>15360000</param-value>
    </context-param>

  • Out of Order Primary Keys and Blob fields

    Hi,
    I am using Oracle Migration Workbench to transfer the data from SQLServer 2000 to ORacle 9i. I am running into the following issues and was wondering if you had any ideas what may be going on:
    1.) Primary keys are out of order
    2.) Blob fields are inserted into the incorrect row
    Ex. BLOB field stating 'Application active' should be associated with Act_key (primary key) = 5 and it ends up transfering over with act_key 28.
    Thank you for any information you may have on this.
    AK

    I am very interested in this thread because I have encountered a similar problem with BLOB columns, except that I am also seeing this with CLOB's.
    Essentially the all the data gets 'migrated', but the CLOB and BLOB columns are all mixed up!
    Any solutions?

  • ADF and 100 tables

    Hi
    I'm new in ADF technology so I suppose my question is very simple.
    How can I create ComboBox witch have a fields with all tables in databes??
    I don't wont write manually, but I want that my application read all tables from database (JDBC connected)!!
    Then if I choose one of them the NavigationBar will be for selected table..
    If something is not clear pleas ask me, because my english is not very good :/
    Thank you for help.

    Shay:
    Could you give me more details or links where this is explained??
    Sorry but I'm new in ADF and Swing technology..
    Frank:
    I want to modify, add and erase rows in tables which someone select that table in ComboBox..
    For example I want to do something like this:
    http://www.oracle.com/technology/products/jdev/viewlets/1013/ADF_Swing_viewlet_swf.html
    but in ComboBox I must selected tables with my database!!

  • ERRORS in the Lab - Developer Day: Oracle ADF and Fusion Middleware Dev

    I atteneded the Developer Day on Oracler ADF and Fusion Middleware Development on 11/19. I did the lab (following step by step instructions) and encountered the following errors:
    1) Export to Excel (Step 4, actions 5-9) - Got run-time 500 error when run app. I had to skip these steps to be able to continue with the lab.
    2) Click on Printable Page (Step 4, action 16) - I looks like it works, but nothing shown up on the browser or printing actually happened.
    3) Click on Create Insert (Step 4, action 26) - Got Java.Lang.NumberFormatException
    4) There is no lab for mobile application development. Where should I start? [getting mobile plug-in software, lab tutorials]
    The instructor said that I could post any questions on the Forum. I hope that this is the correct Forum to post these types of questions. Thanks much in advance for your responses.
    Thoai

    Perfect, I get the exact same page when I login, however, this page doesn't have any links to the actual sessions.  If I remember correctly, after logging in another window used to open in which we could select the session to play.
    Please let me know how I can access the session from the page that is displayed after logging in.  Thank you for taking time to check, appreciate your help.

  • Oracle ADF and Oracle Applications

    Hi All,
    Can we use Oracle ADF with current version of Oracle E-business suite (R11i 2 in my case)? Or we need to use only OAF and ADF can be used only for future release of Oracle ERP?
    It will be great if someone can list the benefits of OAF over ADF for Oracle EBS 11i 2. I want to convince the customer that ADF is not safe or not a good platform for the customizations in current release (R11i 2) and even for next immediate version (R12).
    Thanks in advance,
    CAH

    Hi,
    I don't think ADF can be used with Apps 11i,it can be user in R12(this is my understanding), if you want to run ADF pages from Apps then these pages should be located on External server and you can access this as an External Application.
    As far as customization is concrened, it can't be done using ADF only new Applications be developed in ADF and if you are planning to develop some custom application in Apps then ADf will be a good choice as migration to 11g will be easier(but it will not support Apps specific features like KFF, DFF, Attachments etc.)
    Please check Metalink Note 563047.1 on metalink for this and you can check some articles on this www.apps2fusion.com and Mukul's Blog.
    I hope you will get some clear picture on this.
    Regards,
    Reetesh Sharma

  • Oracle ADF and OAS licencing

    Hi all,
    I have been doing a research on JSF component, ADF and ADF Faces for our project. I have found some intresting things that
    ADF faces(donated to Apache by Oracle) is free but it is only for front end (not complete) as of ADF.
    ADF is more promising and good frame work. ADF is free to be deployed on OAS. but i am unable to find pricing for Oracle Application Server is it free ?.. and what is the price for Deploying ADF on Tomcat or other Open source Servers...?.Can i get this information I need it urgently. Thanks..

    Hi,
    the Oracle AS licence depends on the edition you want to use. I suggest to get in touch with a local sales office to get the pricing information.
    ADF Faces / ADF deployed to 3rd party servers has a licence cost of 5k USD per CPU (at least this is my latest information. So you better check this too)
    Frank

  • Oracle ADF and ECM workflow

    Hi,
    I'm looking for ideas on how to implement this which will involve using Oracle ADF and ECM Workflow.
    1. Oracle ADF App that will check-in an item into ECM.
    2. Using Oracle ECM workflow, an email is sent to the manager that a item has been checked in and is ready for review. The manager access the ADF app , clicks on a "Awaiting approval" and reviews the doc(in an iframe), makes comments(if possible) and then approves it in which case it is published or rejects it in which case it sent back to the employee.
    3. I found a similar posting to this Re: Custom pages at each workflow step in UCM
    Thoughts, ideas?
    Thanks.

    Everything, from checking in, to get a list of approvals, is available by services. You can call the service from an ADF and use the result of that service as a dataset to use in a table. In the administration menu, there are WSDL descriptors for each part for example the check in service, the search service, the workflow service,...

  • How we handle CLOB and BLOB Datatypes in HANA DB

    Dear HANA Gurus,
    We have would like to build EDW using HANA base on our source system Oracle and it's supports CLOB and BLOB datatypes
    Would you please suggest how do we handle in HANA DB.
    Let not say it's oracle specific.
    Regards,
    Manoj

    Hello,
    check SAP HANA SQL Reference Guide for list of data types:
    (page 14 - Classification of Data Types)
    https://service.sap.com/~sapidb/011000358700000604922011
    For this purpose might be useful following data types:
    Large Object (LOB) Types
    LOB (large objects) data types, CLOB, NCLOB and BLOB, are used to store a large amount of data such as text documents and images. The maximum size of an LOB is 2 GB.
    BLOB
    The BLOB data type is used to store large binary data.
    CLOB
    The CLOB data type is used to store large ASCII character data.
    NCLOB
    The NCLOB data type is used to store a large Unicode character object.
    Tomas

  • Best Practices for BI, ADF and Oracle Forms installations on Weblogic

    Hi, I'm researching options on upgrading to Oracle 11g Middleware. My company currently has Oracle Forms 10g running on Oracle Application Server.
    We are interested in using Oracle Forms 11g, ADF and Jdeveloper, and Business Intelligence with Oracle's Weblogic 10.3.5.
    Is there any whitepapers or documentation on best practices for installing alll of these components together?
    For instance, can ADF ( with JSF 2.x ) be installed in the same domain as Oracle Forms 11g but use different managed servers?
    Will Business Intelligence need to be in a seperate Oracle Home with it's own weblogic installation? I spend a lot of time trying to get the JSF upgraded to 2.x in the Business Intelligence installation and could not get it to work.
    I know it's a pretty broad question but thank you for any direction on this.

    Thanx for the reply! I read through the documents and they are very good at explaining how to install the different components individually. I still can't find much on installing them together. I hope it's not just going to be a trial and error thing.
    So far I've installed done the following successfully:
    Installed 10.3.5 weblogic
    Forms and Reports 11g on top of 10.3.5
    I've created an additional managed server for our ADF applications.
    My next step is upgrading the JSF to 2.x. I would have to stage patches 12917525 and 12979653. I'm afraid it will break the forms and reports though. Any ideas?

  • Dbms_crypto and blob datatypes

    Hi everyone
    I've been trying to learn how to encrypt data (a file uploaded) using blob datatype. This is me first attempt at encrypting and have been doing some research on this. I need to use the BLOB as I am encrypting a file that is uploaded to the system. Does anyone have experience in this or know of a good example that I can take a look at?
    Ray

    Hello,
    check SAP HANA SQL Reference Guide for list of data types:
    (page 14 - Classification of Data Types)
    https://service.sap.com/~sapidb/011000358700000604922011
    For this purpose might be useful following data types:
    Large Object (LOB) Types
    LOB (large objects) data types, CLOB, NCLOB and BLOB, are used to store a large amount of data such as text documents and images. The maximum size of an LOB is 2 GB.
    BLOB
    The BLOB data type is used to store large binary data.
    CLOB
    The CLOB data type is used to store large ASCII character data.
    NCLOB
    The NCLOB data type is used to store a large Unicode character object.
    Tomas

  • Hi, im a beginner in ADF and JDeveloper. Can anyone suggest me any video links for learning Oracle ADF?

    Hi, im a beginner in ADF and JDeveloper. Can anyone suggest me any video links for learning Oracle ADF?
    Thanks,
    Vijay

    Refer the below link as a starting point.
    https://blogs.oracle.com/shay/entry/how_do_i_start_learning_oracle_adf_and_jdeveloper
    http://sameh-nassar.blogspot.com.au/2010/04/main-references-to-learn-oracle-adf.html
    Cheers
    AJ

  • ADF and WebCenter 11g libraries upgrade paths for WLS 12.1.3

    We want to upgrade one of our WLS from 10.3.6 to 12.1.3.
    (1) The application hosted on this instance uses the following ADF and WebCenter libraries (also deployed on the same WLS). Please confirm if these can be deployed in WLS12c without any changes or if we need to check on an upgrade path to ADF or Webcenter 12c components as well:
    adf.oracle.businesseditor(1.0,11.1.1.2.0)
    adf.oracle.domain(1.0,11.1.1.2.0)
    adf.oracle.domain.webapp(1.0,11.1.1.2.0)
    oracle.adf.dconfigbeans(1.0,11.1.1.2.0)
    oracle.adf.desktopintegration(1.0,11.1.1.2.0)
    oracle.adf.desktopintegration.model(1.0,11.1.1.2.0)
    oracle.adf.management(1.0,11.1.1.2.0)
    oracle.bi.adf.model.slib(1.0,11.1.1.2.0)
    oracle.bi.adf.view.slib(1.0,11.1.1.2.0)
    oracle.bi.adf.webcenter.slib(1.0,11.1.1.2.0)
    oracle.bi.composer(11.1.1,0.1)
    oracle.bi.jbips(11.1.1,0.1)
    oracle.bpm.mgmt(11.1.1,11.1.1)
    oracle.webcenter.composer(11.1.1,11.1.1)
    oracle.webcenter.skin(11.1.1,11.1.1)
    oracle.wsm.seedpolicies(11.1.1,11.1.1)
    orai18n-adf(11,11.1.1.1.0)
    (There are other libraries too but not anything related to ADF or Webcenter)
    (2) We also have EM extension template in WLS 10.3.6. How can we upgrade this? Do we need to delete this and install FMW infra 12c with the additional DB schema and then try to extend the 12c domain?

    Moved your thread to the WLS Communities since you are not asking if products are certified.
    Thanks,
    Lisa Fedynich

  • ADFS and BYOD in azure

    Hello ,
    We are in the process of moving all servers into azure , and deploying BYOD infrastructure hence no need for clients machine to be joined to the domain “obviously”
    My question is , if my clients are non-domain joined ? why do I need to deploy ADFS in azure at all ? since no on premise servers anyways 

    Avoiding Federation Now That Password Hash Sync Is Available
    A key driver for federation deployments with ADFS used to be that it enables users to use a single password across on-premises and cloud sessions. However, federation deployments take some effort due to the additional servers and network implementation.
    The on-premises servers also have to be Internet accessible through any corporate firewalls in a secure way, and they also have to be highly available since logins are not possible if they or their Internet connectivity are offline. Because password hash sync
    is a feature of directory synchronization, it is initiated from the on-premises server and doesn’t incur many of the infrastructure requirements and costs of federation. It only requires a single server and whilst that server requires outgoing access to the
    Internet in order to connect to Azure AD there is no requirement for inbound connections, custom firewall openings or highly available configurations.
    There are still some reasons why some customers will still prefer ADFS and directory federation over DirSync and password hash synchronization. These include:
    ADFS can be configured such that users who are already logged on to a domain joined and connected machine do not require any password re-entry to sign in at Office 365. This gives you true single sign-on since re-entry of the password is not required. With
    DirSync and password hash synchronization a user must still re-enter their password, although it will be the same password as they use on-premises.
    ADFS allows for client access filtering, which restricts access to Exchange Online to users based on their IP address.
    ADFS will honor Active Directory configured login time restrictions for users.
    ADFS can include web pages for users to change their passwords while they are outside the corporate network.
    With ADFS the authentication decision is always made on-premises and no password hashes are synchronized to the cloud. This may be obvious but can be sometimes a security policy requirement.
    With ADFS an administrator can immediate block a user to remove access where-as DirSync synchronizes these changes every three hours. Only password changes are synchronized by DirSync every two minutes.
    ADFS permits use of on-premises deployed multi-factor authentication products. Note that Azure AD supports multi-factor authentication but many third party multi-factor authentication products require on-premises integration.
    Where Microsoft Forefront Identity Manger (FIM) is required for some other FIM capability. FIM directory synchronization does not include password hash synchronization so ADFS will still be required for SSO login.
    Some on-premises to cloud hybrid scenarios require ADFS such as hybrid search.
    If you need any of these then Active Directory Federation Services is still the best option.

  • ADF And/Or JSF : A Shift to Future

    Hi All,
    I am using Oracle Forms since 1996 and worked in different versions of it. Now there is a move away from Forms to J2EE based solutions like ADF/JSF to name a few. Even Steve is writing a book for Oracle ADF Development for Forms Developers. I have few questions in mind, that
    1. What is the best way of learning these technologies means following the book Steve / Grant is writing will help us.
    2. One must know ADF before he could learn JSF, Is it a prerequisite ?
    3. For a Forms Developer what is a right tool (ADF/JSF) which is closed to form concepts he knows so that the shift could be easy and smooth and after that he can learn more.
    Thanks In Advance

    You got is a little mixed up - JSF is one technology that the ADF framework uses.
    So it is not two options - it is one option.
    A great way to start learning development using JDeveloper ADF and JSF is visiting the special center we built for people just like you - Forms developer who want to move to Java.
    http://www.oracle.com/technology/formsdesignerj2ee
    Try for example the hands-on scripts there.
    Then you can continue with the rest of the resource on the JDeveloper home page on OTN.

Maybe you are looking for