OrcDocDomain File Download Link - (BC4J/ADF) - How to?

I am able to produce an Upload File in my web application - it works really nicely - , but I am lost on how to produce a download link for those files, once they are stored in the database.
I am creating an application that deals with document files for my company's intranet. I am using BC4J, ADF, the Oracle Database, and JDeveloper 10.1.3.2
The files are stored in the oracle database as OrcDocDomain columns.
As I mentioned at the beginning, I do am able to have my users to upload the files:
I use the af:inputFile tag to upload the file into the desired jbo View Row. BC4J commits the file storage into the database the way I want it later:
<af:inputFile value="#{bindings.WorkingDocumentsView1NewDocument.inputValue}"
label="#{bindings.WorkingDocumentsView1NewDocument.label}"
required="true"
binding="#{backing_app_Working_Document.inputText3}"
id="inputText3"
inlineStyle="font-size:x-small;" />
Sweet...
However, my question now is that, I want my users to be able to download the same file...but I am lost trying to put together a solution for it.
I have tried with <af:objectMedia source="#{bindings.DocOrd.Source}"/> but it does not work at all. (Please note that I can see that that there is a file in the binding variable DocOrd, because I can display it's mime type in the same web page).
I have also seen a documentation reference to the class "DownloadFile" of JHeadStart. I think that this class does what I should pretend to do: to render a link/call to the Intermedia Servlet that would produce the download.
However, I am not using JHeadStart to create my application.
Does someone know how could I generate this link/call without JHeadStart?
Thanks by anticipate.
Rafael.

Hi.
I was wondering if anyone has any thoughts or suggestions on above issue please?

Similar Messages

  • File Download links on ADF pages

    Hi All, My requirement is to display no. of document links in pages. I am trying to use <af:fileDownloadActionListener> .
    I am getting list of files/document while loading the page from backing bean and looping through it using <af:forEach>..
    when i click on any link to download the document then fileDownloadBean.download function is called. So in backing function
    download how i know which document user has clicked to download ? Any idea ?
    <af:panelList id="pl1" clientComponent="true" >
    <af:forEach var="file" items="#{fileDownloadBean.listFiles}" >
    <af:commandLink text="#{file}" actionListener="#{fileDownloadBean.buttonClicked}" />
    <af:commandLink text="#{file}" visible="false" id="cl2" actionListener="#{fileDownloadBean.buttonClicked}">
    <af:fileDownloadActionListener filename="#{file}"
    contentType="application/msword"
    method="#{fileDownloadBean.download}" />
    </af:commandLink>
    </af:forEach>
    </af:panelList>

    Hi Tim, I tried to follow same step as mentioned in your blog..but getting y error no object found by id...
    function customHandler(event){ 
    var exportCmd = AdfPage.PAGE.findComponentByAbsoluteId("::cl2");
    alert('hello');
    var actionEvent = new AdfActionEvent(exportCmd);
    actionEvent.forceFullSubmit();
    actionEvent.noResponseExpected();
    actionEvent.queue();
    In my program commandlink is rendering by for each loop...i think in for each loop...iterating component does not assign proper ids...
    <af:panelList id="pl1" clientComponent="true" >
    <af:forEach var="file" items="#{fileDownloadBean.listFiles}" >
    <af:commandLink text="#{file}" clientComponent="true" partialSubmit="true" actionListener="#{fileDownloadBean.buttonClicked}" />
    <af:commandButton text="#{file}" id="cl2" visible="false" clientComponent="true" >
    <af:fileDownloadActionListener filename="#{file}"
    contentType="application/msword"
    method="#{fileDownloadBean.download}" />
    </af:commandButton>
    </af:forEach>
    </af:panelList>
    I appreciate your help..
    Thanks

  • Creating a file download link on jsp

    I have the following on my jsp. The code worked fine until I tried to use it in a new html design page.
    <code>
    //page name is index.jsp
    try //DISPLAY THE CONTENTS OF THE DATA DIRECTORY
    File dirname = new File(PATH); // create an instance of the File class
    if (dirname.exists()&&dirname.isDirectory())//check to see if File class dirname exists and is valid
    String [] allfiles = dirname.list();//create an array of files in the dirname File class
              for (int i=0; i< allfiles.length; i+=2)//loop through allfiles[] and print out file links
    out.println("<br><table border='1' cellspacing='1' width='99%'>");
                   out.println("<tr><td width='50%' class='pageFont'><input type='checkbox' name='cb' value='"+allfiles[i]+"'>"+allfiles[i]+"      ");
    %>
    <a class="a" href="index.jsp?downfile=C:\\data\\<%=allfiles[i+1]%>">DOWNLOAD</a></td>
    <% if(i+1 < allfiles.length)//PRINTS OUT THE SECOND TD SO THAT WE HAVE 2 COLUMNS OF LINKS
    out.println("<td width='50%' class='pageFont'><input type='checkbox' name='cb' value='"+allfiles[i+1]+"'>"+allfiles[i+1]+"      ");
    %>
    <a class="a" href="index.jsp?downfile=C:\\data\\<%=allfiles[i+1]%>">DOWNLOAD</a></td></tr>
    <%
    out.println("</form></font></table>");
    catch (IOException excep)
         out.println("An IO exception has occured.");
    </code>
    Then when clicked this code is run:
    <code>
    try{
    //CHECK TO SEE IF THE FILE HAS BEEN CLICKED TO DOWNLOAD SINGLE FILE
    if (request.getParameter("downfile") != null)
    String filePath = request.getParameter("downfile");
    File f = new File(filePath);//CREATE AN INSTANCE OF THE FILE CLASS AND POINT IT TO THE LOCATION OF THE DIRECTORY CONTAINING THE FILES
    if (f.exists() && f.canRead())
    response.setContentType ("application/octet-stream");
    response.setHeader ("Content-Disposition", "attachment;filename=\""+f.getName()+"\"");
    response.setContentLength((int) f.length());
    BufferedInputStream fileInputStream = new BufferedInputStream(new FileInputStream(f));
    int i;
    out.clearBuffer();
    while ((i = fileInputStream.read()) != -1) out.write(i);
    fileInputStream.close();
    out.flush();
    </code>
    When I click on this link I get the download dialog box. If I open it I get the following open up in notepad(the files I am trying to give download links are .txt files)
    Below is what is displayed in notepad ALL on 1 line:
    <html>
    <head>
    <LINK rel="stylesheet" ty
    That is displayed in all of the links that I click on. It is the first few lines of html code for index.jsp.
    I know this code is probably not a good way of doing what I need but I got it to work fine until the change.
    I am sure there is an easier way to code the download link without resubmitting the page.
    Thanks in advance!!

    Well all was fine with this jsp until I moved it to ApacheJServ. Now the problem has resurfaced(although it is a little different now)
    I had moved the following code to the top of my page:
    //CHECK TO SEE IF EITHER DOWNFILE OR ZIPFILE VARIABLE EXIST, AND IF THEY DO SET CONTENT TYPE BEFORE SENDING ANY HTML CODE TO THE BROWSER
    try{
    //CHECK TO SEE IF THE FILE HAS BEEN CLICKED TO DOWNLOAD SINGLE FILE
        if (request.getParameter("downfile") != null)
                String filePath = request.getParameter("downfile");
                File f = new File(filePath);//CREATE AN INSTANCE OF THE FILE CLASS AND POINT IT TO THE LOCATION OF THE DIRECTORY CONTAINING THE FILES
                    if (f.exists() && f.canRead())
                        response.setContentType ("application/octet-stream");
                        response.setHeader ("Content-Disposition", "attachment;filename=\""+f.getName()+"\"");
                        response.setContentLength((int) f.length());
                        BufferedInputStream fileInputStream = new BufferedInputStream(new FileInputStream(f));
                        int i;
                        out.clearBuffer();
                        while ((i = fileInputStream.read()) != -1) out.write(i);
                            fileInputStream.close();
                            out.flush();
                            response.flushBuffer();
    catch (Exception e){}
    //This is where the java code ends and the javascript/html code begins.Then further into the page I create the file download links like so:
                            <a class="a" href="main.jsp?downfile=C:\\data\\<%=allfiles[i+1]%>">DOWNLOAD</a>I know this isnt a secure way of doing this but I am on a intranet.
    The problem I am having now is that when I click on one of the links and download the file and then open it, I get the contents of the file plus concatenated to the end of it is the first few HTML lines of the actual jsp that I downloaded the file from. Before I was just getting the first few lines of html from the jsp, not the actual contents of the downloaded file.
    This is an example of what I am getting:
    This is the contents of the file that I downloaded.//This is where the file contents ends.
    <html>
    <head>
    <LINK rel="stylesheet" type="text/css" href="default.css">
    <script language="JavaScript1.2">
    //function that allows user to select all checkboxes
    function doIt(v)
    for(var i=0;i<document.form1.cb.length;i++)
       document.form1.cb.checked=eval(v);
    function swap(imageName,image)
    imageName.src = "templateImages/"+image;
    function imageOver(imageSrc, imageName)
         changeImage = new Image();
         changeImage.src = imageSrc;
         document.images[imageName].src = changeImage.src;
    var hide = true;
    function hideShow( ) /
    Any morre ideas?
    TIA!
    BTW, I went to ApacheJServ because they wont let me use tomcat :(

  • Windows Vista, 7 and 8 ISO / Image file Download Links

    Series: How to Re-Install Windows when you don't have the Recovery Discs
    Intro: What is an ISO? Why is it used? 
    Step 1 - Get the ISO - ISO Download Links
    Step 2 - Burn the ISO to a DVD or USB   
    Step 3 - What to do with the ISO DVD/USB? Change the Boot Order  
    Step 4 - What to do After Windows is Installed? How to Get HP Drivers?    
    Step 1 - Get the ISO - ISO Download Links
    First, look at the Product Key label on the bottom of the computer and make sure you can still read it, before proceeding.
    How is this legal?   As long as you have the Product Key (from the bottom of a computer you paid for) for the corresponding version of Windows you download, it is perfectly legitimate and legal.
    The ISO Links: 
    Windows Vista SP1  32 & 64-bit
    *****With that link, you will have to combine the three files into an Image file (aka ISO) first (How to create an image file from files/folders) , using a program like ImgBurn.*****
    Windows 7 32 & 64-bit
    Windows 8 32 & 64-bit
    See Step 2 - Burn the ISO to a DVD or USB
    If you have any questions, create a new post (How to Create a New Post - Video), copy and paste it's link into a private message to me, and I will respond on your thread

    You shouldn't need to edit any of the files. The Windows 7 ISO is a retail, untouched version. It doesn't have a Product Key embedded into it.
    You should be able to use a Windows 7 Product Key from the label on the bottom of the computer with no issues. The installation will ask you for a Windows 7 Product Key. The only exception would be if the Product Key were in use on a different computer. From my understanding, as long as it is not already in use, it should activate.
    Please let me know if you have any questions on that

  • Securing file download links

    As per the File upload/download How-to at http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14377/up_dn_files.htm#sthref153
    downloading a file involves writing a stored procedure and invoking it directly using the DAD and mod_plsql. For example, /pls/htmldb/owner.procedure?p_file_id=1234
    This link bypasses the Apex show engine so even if I have all the security in the world in Apex using authentication schemes, authorization schemes, etc, a authenticated user in Apex can just right click on the Download link, shoot it off to someone else who can download the file without even logging in to my application!
    How can these "download links" be secured so that only authenticated users can access them only from an Apex session?
    Thanks

    Thank you Vikas.
    The reason I ask is I get a compilation error in my procedure.
    I am no PL/SQL expert so I am sure my syntax or logic is wrong.
    I am using APEX version 2.0
    Error(7,19): PLS-00103: Encountered the symbol "." when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table LONG_ double ref char time timestamp interval date binary national character nchar The symbol "<an identifier>" was substituted for "." to continue.
    CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
            v_mime  VARCHAR2(48);
            v_length  NUMBER;
            v_file_name VARCHAR2(2000);
            Lob_loc  BLOB;
            APEX_APPLICATION.G_FLOW_ID := 100;
    BEGIN
    --testing security
    IF NOT wwv_flow_custom_auth_std.is_session_valid then
        -- display this message or a custom message.
    htp.p('Unauthorized access - file will not be retrieved.');
        -- You can do whatever else you need to here to log the
        --     unauthorized access attempt, get the requestor's
        --     IP address, send email, etc.
        RETURN;
    END IF;
            SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
                    INTO v_mime,lob_loc,v_file_name,v_length
                    FROM file_subjects
                    WHERE id = p_file;
                  -- set up HTTP header
                        -- use an NVL around the mime type and
                        -- if it is a null set it to application/octect
                        -- application/octect may launch a download window from windows
                        owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
                    -- set the size so the browser knows how much to download
                    htp.p('Content-length: ' || v_length);
                    -- the filename will be used by the browser if the users does a save as
                    htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
                    -- close the headers           
                    owa_util.http_header_close;
                    -- download the BLOB
                    wpg_docload.download_file( Lob_loc );
    end download_my_file;
    /Thanks
    VC

  • Website image and zip file download links not working in Dreamweaver Air application

    Hi
    I have successfully created and AIR app for an existing business website using the Dreamweaver AIR Extension. The site works very well in all respects except for the part where we have high resolution images and zip files available for download. The download links refuse to do anything, and right-click (PC) / ctl-click (Mac) does nto work either.
    I suspect this may be an AIR sandbox/security issue but am I correct and what can I do to fix it?
    Thanks in advance for any assistance you may be able to give.
    Martin

    I am now facing the same problem. I wrote a servlet .
    code like this
             response = (HttpServletResponse) faces.getExternalContext().getResponse();
             response.setContentType("application/x-download");
             String agent = request.getHeader("USER-AGENT");
             boolean isIE=false;            
            if (null != agent && agent.indexOf("MSIE")!=-1) { 
                isIE=true;
            if (isIE) {
                fileName = URLEncoder.encode(fileName, "UTF-8");
            } else {
                fileName = new String(fileName.getBytes("utf-8"), "ISO-8859-1");
            response.setHeader("Content-Disposition","attachment;filename="+fileName);
            ServletOutputStream os = response.getOutputStream();
            byte b[]=new byte[1024];
            int n;
            while((n=in.read(b))!=-1){
                os.write(b,0,n);
           in.close();
           os.close();
    and i open a new window refer to above jsp ,also i set a breakPoint at os.close(),the program has passed through,but nothing happened in the window.
    If i use IE or FF ,the browser will open a small window to allow me select whether open or  save the file.So can anybody give me some advice.Is it because air using webkit engine and the engine does not do this kind of job?
            Thanks.

  • File download issue in ADF

    Hi All,
    I have written a code which downloads a file. This works absoltely fine but after the download when I click on empty area in the page the browser hangs(IE7).
    Here is the code snippet.
    //=======================================================//
    response.setContentType("Content-type: application/xml");
    response.setHeader("Content-disposition",
    "attachment; filename=File.xml");
    OutputStream out = response.getOutputStream();
    out.write(dataSting.getBytes());
    out.flush();
    out.close();
    FacesContext.getCurrentInstance().responseComplete();
    System.out.println("Done deal !!");
    //=======================================================//
    Any pointers for the problem ? But it works well in Mozilla.

    This example is slightly different.
    My Usecase:
    Page1-->Pop-up
    Pop-up closes and back to Page1
    Page1-->Send to browser(inside return listener I send to browser)
    And the browser hangs
    Example case:
    Page1-->Pop-up-->Send to browser
    It doesnt hang...
    So, I changed my use case to the second option.
    Nevertheless thanks for the support.
    Still the problem persist for "My Usecase"
    Message was edited by:
    user583382

  • Broken download link for adf faces

    http://download.oracle.com/otn/java/jdeveloper/1013/adf-faces-ea15.zip

    This one seems to be fine but please let us know what error or problem you get if it is still an issue for you.
    OTN

  • Download Linked File Save As interference with the Dock

    I have two LCD monitors running at 1440 x 900 (the OS recognizes these LG monitors and establishes the resolution). It seems when I switch to 800 dpi vertical the problem disappears.
    When I am on a web-site and Right-Click to save a file (Download Linked File Save As) option, the tab that Safari opens is so large that the SAVE and CANCEL options are behind the Dock Icons. This is very annoying as I usually move the Safari Window to the second monitor on the left in order to save the file.
    Is there a way to have Safari recognize the higher resolution?
    Thanks,
    Rob

    HI,
    Is there a way to have Safari recognize the higher resolution?
    I don't think so Rob.
    Possibly... Command - or + as you need it.
    will reduce or increase the size of the page first, then try.
    Carolyn

  • After running csv report, open the 'File Download Dialog'

    Hello,
    I would like that, if I run a report, then I liked directly File Download Dialogue gotten.
    How can i make this?
    Thank you!

    can you give more details on how you call the report.
    if you use url method to call , it will open the excel after the report is generated
    when appropriate desformat is given

  • JSF/ADF How to throw UI failure on SQLException?

    I have a button bound to the persistEntity action for a form listed on my page, but there can't be any mistake on whether this get's inserted in the database as it's part of a workflow. Failure was occurring and after checking the logs I found a SQLException for inserting a null value.
    While this is cleared up by more exact control of required fields, I would like to know if there is a way that I can set the persistEntity to cause a noticeable or blocking UI action so that users can't proceed with a workflow when there is an error in the SQL execution.
    Many thanks,
    Raymond

    Oop, sorry. Thanks for the redirect.
    -Raymond
    This post has been made at the following link: JSF/ADF How to throw UI failure on SQLException?

  • How to download a file under link in FF?

    there is a 'save target as...' popup menu option in "big" firefox, which I use to skip default action for specific files. I.e. to download a pdf file to read it later instead of open it in acroread right now.
    How can I get the same function in mobile version of FF?
    Thanks a lot.

    Since the last update I've got the same problem. When I click a download link (mp3), instead of downloading the file FF opens a new tab and start playing the mp3. This is not what I want. I want to download the file at home so that I can listen to it later when there is no internet connection available. When I long click the download link there are some options, but there is no option "save link as".
    Now I have to use Chrome to achieve my goal.
    Please help!

  • Safari "Download Linked File As ..." dialog box seems to convert 3 or more consecutive period chars (\056) in the new file name into a Unicode ellipsis char \342\200\246 in the file name.  How prevent this ?

    Safari "Download Linked File As ..." dialog box seems to convert 3 or more consecutive period chars (\056) into a Unicode ellipsis char ( \342\200\246 ) in the file name that I type.  How does one prevent this ?

    I know nothing about “EndNote”, but allow me to give you some general advice. Your first, commented-out, line (“--section to wait for window to pop up”) indicates that you need to change the basic way you are tackling what you want to do. When writing any script, if you know the name and location of a file or a directory (folder) you should not cause (or allow, or need) your script to open an Open or a Save window -- just use the path that you already know.
    Andreas

  • How to place download link on jsp page to download files eg. Download PDF

    Hi,
    I have made an appliaction in struts 2 which creates PDF,its working fine now i want to place a link on my jsp page from where i can click and download that PDF file which i have created and store on my local location. Also i want to to know can i place links on my jsp page to download other type of files if i want to give link on my page to download Images or songs how can i do that,
    Help plzzzzzzzzzzzz

    IF You are using jsf then simply <h:outputLink value="file:///D:/Me/Image000.jpg"/>. This generates HTML <a> tag and value attribute replacing with <a> tag's href attribute.If you are using other technologies try to find which tag generates HTML <a> tag.
    I think You also can simply place HTML <a> tag wherever You want

  • How do I create a downloadable link from an Interactive PDF file created out of InDesign CS6?

    Hello,
    I created an Interactive PDF file out of InDesign and would like to make the large file a downloadable link and share it with the user in an email. I do not want to use DropBox or GoogleDrive.
    The company I contract for has their own site - do I insert the file into the site or can I create a separate link for it?
    I will be recreating these presentation PDF's constantly, so I would like to know if there is a simple way to create this link for files in the size of 7-12MB.
    Any ideas on downloadable links? I do have flash - but rarely use, perhaps load the file out of flash?
    Thank you so much for your help,
    Megan

    Hi Willie,
    Thanks for your help. Most likely contact the company who maintains the
    site then to share the file with them I'm assuming?

Maybe you are looking for