Forum Stats

  • 3,759,907 Users
  • 2,251,613 Discussions
  • 7,870,862 Comments

Discussions

ADF 12c (12.2.1.3.0) fileDownloadActionListener contentType does not work as expected

Rigas
Rigas Member Posts: 24 Blue Ribbon
edited Oct 6, 2021 12:14PM in JDeveloper and ADF

We have a ADF 12.2.1.3.0 project, and in a few pages we have added, under a link tag, the tag fileDownloadActionListener to allow the user to download a file:

<af:fileDownloadActionListener method="#{pageFlowScope.backingBean.documentSource}" filename="#{bindings.Title.inputValue} contentType="#{bindings.MimeType.inputValue}">

However, contentType does not do anything. The file is always getting downloaded as generic file. The binding has always the correct value we want. Even if we write a specific contentType i.e. "application/pdf" the file will still be downloaded as a generic file.

<af:fileDownloadActionListener method="#{pageFlowScope.backingBean.documentSource}" filename="#{bindings.Title.inputValue} contentType="application/pdf">

Only if the filename (as coming from the Title binding) contains an extension, the file will be downloaded as the type of the extension. But we know that the extension may be slightly different than the actual mime type that is stored in the system.

Same behavior occurs for many different browsers (Firefox, Chrome, Edge, Brave).

Based on this https://docs.oracle.com/en/middleware/developer-tools/adf/12.2.1.4/tag-reference-faces/tagdoc/af_fileDownloadActionListener.html it should work as we expect.

Is this a 12.2.1.3.0 issue? Shouldn't this work and always try to save the file in the correct type?

Tagged:

Best Answer

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,566 Red Diamond
    Accepted Answer

    What I understand is that the a:fileDownloadListener sets the correct mime type to the response. So the problem is the browser and not the af:fileDownloadListener.

    Timo


Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,566 Red Diamond

    Have you checked what mime type is received at the client?

    What I can say is that this works for me in my applications.


    Timo


  • Rigas
    Rigas Member Posts: 24 Blue Ribbon

    Hello Timo,


    yes the mime type on the request is the correct one:

    I've also created a new clean ADF application, that has a simple jsf page, with a table of documents binded to a view from my DB. Again, content type does not do anything:

    The fileDownloadActionListener is same as in my original project and the backing bean has only the method used to download:


  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,566 Red Diamond
    Accepted Answer

    What I understand is that the a:fileDownloadListener sets the correct mime type to the response. So the problem is the browser and not the af:fileDownloadListener.

    Timo


  • Rigas
    Rigas Member Posts: 24 Blue Ribbon

    Well... I can confirm that it works as expected only in the following browser:

    • Mozilla Firefox 93.0 (64-bit) - latest version

    In all the other browsers it does not:

    • Google Chrome Version 94.0.4606.71 (Official Build) (64-bit) - latest version
    • Opera Version 80.0.4170.16 - latest version
    • Microsoft Edge Version 94.0.992.38 (Official build) (64-bit) - latest version
    • Brave Version 1.30.87 Chromium: 94.0.4606.71 (Official Build) (64-bit) - latest version
    • Mozilla Firefox 78.15.0esr (32-bit) - older version

    However, our client does not work only with the latest Firefox (as also we do not).

    Should I open an SR for this?

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,566 Red Diamond

    Sure, you can open an SR. However, I don't see where. It looks to be a browser problem. My guess is Oracle support will not work on this but tell you to ask the browser manufacturer for help.

    Timo


  • Rigas
    Rigas Member Posts: 24 Blue Ribbon

    Tough... I'll maybe go with a hardcoded workaround for specific extensions.

    Thanks for all the help!

    Rigas