ADF - listener to download files of component - defining the name of the output file

Studio Edition Version 11.1.1.2.0


Hi, I would like to learn how to set the name of the output than the current data file + file name. I have a button with the component listener downloading files with theses parameters

Content/Type: application/pdf
File name: test.pdf
Method: fullReportPDF()

I needed when the user clicks the button, it returns the current date + the statically defined file name.


How can I do this?

A bean, you implement a method that returns the date soul filen and static part concatenated and set it as EL in the af: fileDownloadActionListener

// on the page


// in the bean
    public String getFilename()
    {
        String fn = (new Date()).toString() + "static_part.xyz";
        return fn;
    }

    public void fullReportPDF(FacesContext facesContext, OutputStream outputStream) { ... }

where XYZBean is the bean where you have implemented, the method fullReportPDF.

Timo

Tags: Java

Similar Questions

  • ADF 12.2.1 and Glassfish 4.1 cannot download files and export to excel on table throws the error

    Hi all

    I use JDEV12.2 and Glassfish Server 4.1.1.

    I am facing issue while using the export to excel feature on table and file download and download throw Error Server glassfish 4.1.1 as follows:

    [SERIOUS] [[org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl]]

    java.io.EOFException

    at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._skipBoundary(MultipartFormHandler.java:229)

    to org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler. < init > (MultipartFormHandler.java:102)

    to org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler. < init > (MultipartFormHandler.java:75)

    at org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl.beginRequest(FileUploadConfiguratorImpl.java:139)

    at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._startConfiguratorServiceRequest(GlobalConfiguratorImpl.java:746)

    at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:227)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:184)

    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:166)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)

    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)

    to com.sun.enterprise.v3.services.impl.ContainerMapper$ HttpHandlerCallable.call (ContainerMapper.java:459)

    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)

    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)

    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)

    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)

    to org.glassfish.grizzly.filterchain.ExecutorResolver$ 9.execute(ExecutorResolver.java:119)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)

    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)

    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)

    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)

    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)

    in org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$ 100 (WorkerThreadIOStrategy.java:56)

    to org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$ WorkerThreadRunnable.run (WorkerThreadIOStrategy.java:137)

    to org.glassfish.grizzly.threadpool.AbstractThreadPool$ Worker.doWork (AbstractThreadPool.java:565)

    to org.glassfish.grizzly.threadpool.AbstractThreadPool$ Worker.run (AbstractThreadPool.java:545)

    to java.lang.Thread.run(Thread.java:745).

    Since it was a bug and slipped in glassfish 3.1.2.2.What will be work it around for that please someone help me.

    Thank you

    Hello

    It s a bug on the class MultipartFormHandler of the Trinity - impl.jar. You can download the sources of trinidad-impl (trinidad-impl - 2.0.0 - sources.jar.zip) and replace the following code to the _parseBoundary method:

    Source language:

    Analyze the text content type limit

    public static private String _parseBoundary (final String contentType)

    {

    final int boundaryStart = contentType.indexOf (_BOUNDARY_PARAMETER);

    If (boundaryStart<>

    {

    Returns a null value.

    }

    Limit begins with ' - '.

    return "-" + contentType.substring (boundaryStart + _BOUNDARY_PARAMETER.length ());

    }

    New:

    Analyze the text content type limit

    public static private String _parseBoundary (final String contentType)

    {

    final int boundaryStart = contentType.indexOf (_BOUNDARY_PARAMETER);

    If (boundaryStart<>

    {

    Returns a null value.

    }

    String limit = contentType.substring (boundaryStart + _BOUNDARY_PARAMETER.length ());

    final int semicolonIndex = boundary.indexOf(";");

    If (semicolonIndex >-1) {}

    Boundary = boundary.substring (0, semicolonIndex);

    }

    Limit begins with ' - '.

    return '-' + limit;

    }

    You can find the jar trinidad - impl.jar update here.

    ADF 12 c + Glassfish4 + trinidad-impl

    Replace the jar trinidad - impl.jar in your EARS or your deployment.

    It will be useful,

    Alex

  • InputFile component remembers the last downloaded file

    Hello

    JDeveloper 11.1.1.5

    I have a file download button in my page.
    File upload works fine, but the InputFile component seems to remember only the last file downloaded what so ever.
    It shows just the name of the file, but in fact, doesn't have the file associated with the component for the second time.

    For simplicity, I want the component to display an empty field always.

    So, I try before displaying the pop-up window to reset the component InputFile with the following code.
    But it still shows the name of file read-only.

    Code in the page...

    < af:inputFile label = "Select the CSV file" id = "if1" value = "#{pageFlowScope.workbookHelper.uploadedFile}" binding="#{pageFlowScope.workbookHelper.uploadedFileHandle}"/ > "

    The bean code...

    ....
    Private RichInputFile uploadedFileHandle;
    private UploadedFile-uploadedFile.
    .....
    public void showXPopup (ActionEvent actionEvent)
    {
    getUploadedFileHandle () .resetValue (); approach 1
    setUploadedFile (null); approach 2
    File UploadedFile = getUploadedFile();
    If (file! = null)
    leader. Dispose(); approach 3

    ADFUtils.invokePopup (getXPopup () .getClientId (FacesContext.getCurrentInstance ()));
    }
    ....

    Can you please tell me how to show component of the input file empty whenever the component is displayed in the pop-up window?

    Thanks for any help.
    Sameer

    Hello

    the input file is in an af:popup, so have you tried

    
    

    ?

    Another thing, to hide the frame supports a direct api:

    public void showPopup(ActionEvent event)
     {
       UIComponent source = (UIComponent) event.getSource();
       RichPopup popup = this.getPopup();
       RichPopup.PopupHints hints = new RichPopup.PopupHints();
       hints.add(RichPopup.PopupHints.HintTypes.HINT_ALIGN_ID, source)
            .add(RichPopup.PopupHints.HintTypes.HINT_LAUNCH_ID, source)
            .add(RichPopup.PopupHints.HintTypes.HINT_ALIGN, RichPopup.PopupHints.AlignTypes.ALIGN_AFTER_END);
       popup.show(hints);
     }
    

    And the binding of a UI component to a scope as 'pageFlowScope' is not a 'best practice' ;)

    Martin

  • A few questions about the use of a XML file to add text in a component defined in HTML TextArea

    I use AS2 in Flash CS3.

    I have a TextArea component in the scene that load its XML text and I was able to use the ul and li tags to create lists. However, when I try to include a nested list, he inserts just a line break between the nested list and the main list rather than he dash away. Is there a solution for this problem?

    Otherwise, how would I be able to add spaces nonbreaking in the XML so that they will be inside the TextArea element? I tried and & #160; without success. I've been searching the net for some help with this and find information about the change of the incorporation of xml file with a new entry for the non-breaking space of police and that has not worked either, which leaves me a bit confused.

    Flash does not support nested lists (as you know).  You can work around this limitation by using css and create your own styles of dash.  CSS have a property marginLeft, that you can use.

  • Download file in/from DB Oracle Clob column

    Hello

    12.1.3 Jdev

    I have a database table that has a Clob column to store the file and a varchar2 column to store the file name.

    I want to have a screensaver to download files in this table.

    Would like to know the best way to achieve this functionality.

    See you soon

    AJ

    The files are usually stored in BLOB column (and not on the CLOB type)

    Here is an example that you can follow: https://tompeez.wordpress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-2/

    Dario

  • Not able to download files with the iPhone from the outside

    Hello

    I'm not able to download files from my iPhone when the iPhone connects to the workspace to external. We have deployed nginx as reverse proxy in our DMZ which transmits requests internally will bridge.

    The download start (number of bytes transferred to the top), then the transfer ends with "error".

    I could not find errors in the log files, but maybe I didn't look in the right places

    If the iPhone is connected to the internal workspace, the problem does not occur

    Any ideas on this subject?

    Thank you

    What is the waiting period that you define in the nginx Server in the DMZ? All other additional configurations?

  • ADF - Re - opening download distributes not appropriate content.

    I use JDeveloper 11.1.1.4 and have a problem with downloading files. The first time that a user clicks on the link command, the file opens correctly. If the user closes the file open in the application, and clicks the same link to re - open the file (in this case a PDF) they Gets an error from Adobe indicating the uploaded file is not a supported or because file type that the file has been damaged. It seems that he reads every file. I use a similar code to other posts I've found on this discussion forum. I'm adding my java code below and the Weblogic Server log messages and would appreciate all good advice for this problem.
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.servlet.http.HttpServletResponse;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.jbo.Row;
    import oracle.jbo.ViewObject;
    import oracle.jbo.domain.BlobDomain;
    
    public class Download {
        public Download() {
            super();
        }
    
        public void downloadFile(FacesContext facesContext,
                                 OutputStream outputStream) throws IOException {
            String mime = null;
            ExternalContext extContext = facesContext.getExternalContext();
    
            DCBindingContainer dc =
                (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            System.out.println("Before getting iterator");
            DCIteratorBinding iter =
                dc.findIteratorBinding("hot_biz_docs_view1Iterator");
            ViewObject vo = iter.getViewObject();
            Row r = vo.getCurrentRow();
            BlobDomain bDomain = (BlobDomain)r.getAttribute("Document");
            String file = r.getAttribute("FileName").toString();
    
            String ext = file.toLowerCase();
            System.out.println("In MimeTypes:" + ext);
    
            if (ext.endsWith(".pdf")) {
                mime = "application/PDF";
            } else if (ext.endsWith(".doc")) {
                mime = "application/msword";
            } else if (ext.endsWith(".docx")) {
                mime =
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            } else if (ext.endsWith(".xls")) {
                mime = "application/vnd.ms-excel";
            } else if (ext.endsWith(".xls")) {
                mime =
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            } else if (ext.endsWith(".txt")) {
                mime = "text/plain";
            } else if (ext.endsWith(".ppt")) {
                mime = "application/vnd.ms-powerpoint";
            } else if (ext.endsWith(".rar")) {
                mime = "application/octet-stream";
            } else if (ext.endsWith(".zip")) {
                mime = "application/zip";
            } else if (ext.endsWith(".jpg")) {
                mime = "image/jpeg";
            }
            Long length = bDomain.getLength();
    
            HttpServletResponse response =
                (HttpServletResponse)extContext.getResponse();
            response.setHeader("Content-Disposition",
                               "attachment;filename=\"" + file + "\"");
            response.setContentLength((int)length.intValue());
            System.out.println(mime);
            response.setContentType(mime);
            InputStream in = null;
            try {
                in = bDomain.getBinaryStream();
                outputStream = response.getOutputStream();
    
                byte[] buf = new byte[1024];
                int count;
                while ((count = in.read(buf)) >= 0) {
                    outputStream.write(buf, 0, count);
                    if (count <= 0) {
                        System.out.println("End if while loop");
                        break;
                    }
                }
    
            } catch (IOException ex) {
                System.out.println(ex.getMessage());
                ex.printStackTrace();
            }
            in.close();
            outputStream.flush();
            outputStream.close();
            response.flushBuffer();
            facesContext.responseComplete();
            System.out.println("closed and responseComplete");
        }
    < 22 August 2011 4:11:11 PM CDT > < error > < HTTP > < BEA-101083 > < connection failure.
    java.net.ProtocolException: did not said Content-Length, wrote: '0' bytes instead of a stated: '3544' bytes.
    at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:446)
    at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1432)
    at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1511)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1462)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    Truncated. check the log file full stacktrace
    >
    < 22 August 2011 4:11:11 PM CDT > < HTTP > < BEA-101104 > < error > < execution of the Servlet in the servlet context "[ServletContext@33250642[app:LIB_Test module: root LIB_Test-LibTestVC-context-path: / LIB_Test-LibTestVC-context-root spec-version: 2.5] ' failed, java.net.ProtocolException: did not said Content-Length, wrote: '0' bytes instead of a said: '3544' bytes...
    java.net.ProtocolException: did not said Content-Length, wrote: '0' bytes instead of a stated: '3544' bytes.
    at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:446)
    at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1432)
    at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1511)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1462)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    Truncated. check the log file full stacktrace
    >

    You must close the stream blob, otherwise that you can't read.
    Use the method blob.closeInputStream () on your blob.

    Timo

  • conclusion downloaded file

    I downloaded a component of the District of flash and I was wondering
    If anyone knows where I can find it on my drive C:\
    I looked in that folder, but could not find?
    C:\Program 8\en\Configuration\Components of Macromedia Flash
    Can you advise?

    Kevin

    Kevin raleigh;
    It would have downloaded every time that you specified should be in the
    Download dialog, or in the application used to download it if you used
    something other than ie. You can try to search for your drive c for the latter
    files with the extension .mxp-Tom Unger

  • How to add the listener password password file?

    Oracle 10g. I put a password for current listener. Is there such a thing that I would add a password for the listener to the password file? Please notify.

    Thank you

    S.

    ski123 wrote:
    Oracle 10g. I put a password for current listener. Is there such a thing that I would add a password for the listener to the password file? Please notify.

    Thank you

    S.

    Documentation on setting up a listening port password is clear enough and does not address file a/the password. You define the listener password by issuing the appropriate lsnrctl command. The password is encrypted and stored in the listener.ora file. That's all.

    And at least from 10 g, if your OS account is member of the dba group, the Auditor considers you authenticated OS (just like "/ as sysdba" to sqlplus) and will not require a password. The password protects against accounts that are NOT members of the dba group.

  • Using the component from the tree of the ADF

    Hello!

    I wonder if someone could show me an example of a component of the tree with predefined columns.

    Thank you in advance for your help!

    You can get some code examples of the ADF Faces of WAR demo file tree:
    http://www.Oracle.com/technology/products/ADF/adffaces/11/doc/demo/adf_faces_rc_demo.html

  • Downloading files over 2 meg are missing in Firefox but not Chrome or IE

    I have a problem when using Firefox to download files in cPanel and even in WordPress when adding themes or plugins. It will download WordPress plug-ins, but I think the point that it starts failing is when the plugin zip file is complete 2meg. It is not related to the server I checked it it works fine in Chrome and IE.

    I refreshed Firefox and deleted all cookies and cache several times.

    I think it may have started after upgrading Windows 10 but not positive.

    Separate the issue;
    Shows details of the system;

    Plug-ins installed

    Adobe PDF plugin for Firefox and Netscape 15.8.20082
    Adobe PDF plugin for Firefox and Netscape 10.1.15

    Having multiple versions of a program can cause problems.
    You must remove older programs. Then download the current full installer.

  • Can not find the downloaded file

    I regularly download files, and they will 'always' in the same directory. Now, I downloaded fedora-live-workstation-i686-22-3.iso
    of https://getfedora.org/en/workstation/download/and (a) I didn't get the usual "save/open" Download dialog and (b) I can not find the downloaded file. The < downloads - tools > FF screen displays the file as downloaded, but not (AFAICT) where he was placed.

    Any clarification would be appreciated. Thank you.

    (OP) Well, I downloaded the same file again and this time everything went as it should. For example, some of my 'facts' above must be wrong, but I don't know who. I suspect some personal deficiencies.

  • Remove the downloaded files.

    When I press Quit, Firefox deletes downloaded files. I don't have clear downloads in the clear now the settings selected. Help, please.

    GoTo setting-> privacy and check if you have selected clear on the exit option and check what options are chosen to clear leaving if selected.

  • Why Firefox does not download files correctly?

    Hello
    At least 6 times, when I used Firefox to download, it fails to successfully download files.
    What happens after about 3 minutes is an error saying failed
    I usually like using Firefox, but it cannot be considered reliable. On the other hand Opera
    the same file download perfectly. The file was a 667 MB iso image file from Sourceforge
    Firefox has managed only 42.2 MB before failing. Little more work is needed to perform downloads
    comparable in reliability to the opera

    My operating system is linux Mint xfce 17.1

    See you soon / Chris

    First check to make sure that nothing is blocking the downloads is to say: Firewall:

    Try these troubleshooting tips:

  • I have a lot of downloaded files, but since last week, none of them will open.

    There is a kind of glitch happening with Firefox as a setting Gmail also will work with him while he does in Internet Explorer. But everything else seems OK except downloads. It's as if all the files have been dimmed. They meet a double click or option open on right click.

    Open your antivirus protection. Check the log file and the quarantine folder.

    snhawaii said

    What happens if I click on "download copy link"?

    The link is copied to your Clipboard. You can then paste it anywhere.

Maybe you are looking for