8 Replies Latest reply: May 24, 2013 12:41 AM by KTM RSS

    Downloading document from UCM.

    KTM
      Hi All,

      I have a custom table, which has content-id (of UCM document) stored in. I am showing data from this table in UI. Against each record I need to provide a download option. This download should query UCM based on content-id and download the document.

      How can I achieve it?

      Regards,
      Kotresh
        • 1. Re: Downloading document from UCM.
          Daniel Merchán
          Hi.

          Use next approach:
          <af:goLink targetFrame="_blank" source="#{WCAppContext.applicationURL}/content/conn/[YourUCMConnName]/uuid/dDocName:#{yourdDocNameTakenFromYourBinding}"/>
          You have to replace connection name that you are using for UCM and put your dDocName

          Regards.
          • 2. Re: Downloading document from UCM.
            KTM
            Hi ,
            Thank you for the replay.

            It's works perfectly fine for .doc files. but not for .txt, .png, .pdf and others and for all these it opens the content present in these documents in new tab. I want to achieve for all type of documents, so what additional functionality i need add to this ?


            Regards,
            Kotresh
            • 3. Re: Downloading document from UCM.
              Daniel Merchán
              Hi again.

              Could you explain with more details your sceneario?.

              Are you in a Content Presenter Template or default .jsff or .jspx code?.

              It's only to know if you can use something OOTB or other way instead of the approach that I sent you.

              Regards.
              • 4. Re: Downloading document from UCM.
                Daniel Merchán
                Hi.

                Try this approach better.

                Include in your schema at the top next taglib:
                xmlns:cmfn="http://xmlns.oracle.com/webcenter/content/functions

                And use this code with your dDocName:
                {code}
                <af:goLink targetFrame="_blank" destination="#{cmfn:getNodeById(yourdDocNameBinding).url.downloadUrl}"/>
                {code}

                Regards.
                • 5. Re: Downloading document from UCM.
                  KTM
                  Hi,

                  I am trying in .jsff page not in Content Presenter Template.

                  I tried with

                  "<af:goLink targetFrame="_blank" destination="#{cmfn:getNodeById(yourdDocNameBinding).url.downloadUrl}"/> " . but not able to achieve the required functionality.

                  Thank you.
                  Regards,
                  Kotresh
                  • 6. Re: Downloading document from UCM.
                    Daniel Merchán
                    Hi.

                    Are you getting error or something using cmfn???. It should work. It provides a node type like Content Presenter where you can access to renderUrl and downloadUrl.

                    Regards.
                    • 7. Re: Downloading document from UCM.
                      KTM
                      Hi,

                      I used cmfn, once i click on download option it throws "Error 403--Forbidden ; The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable. "

                      Please suggest.

                      Thank you
                      • 8. Re: Downloading document from UCM.
                        KTM
                        Hi,

                        Below is the way i am using cmfn

                        <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
                        xmlns:f="http://java.sun.com/jsf/core"
                        xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                        xmlns:c="http://java.sun.com/jsp/jstl/core"
                        xmlns:tr="http://myfaces.apache.org/trinidad"
                        xmlns:cmfn="http://xmlns.oracle.com/webcenter/content/functions">

                        on xmlns:cmfn line i have warning in jspx page as 'The prefix cmfn is never used in the document', but I believe that is ok.



                        <af:goLink text="test" id="gl13"
                        destination="#{cmfn:getNodeById('VMOHSKEND05482001326').url.downloadUrl}"
                        targetFrame="_blank"/>


                        ---------------------------------------------------------------------------------------------

                        The final html that I have in my browser is
                        <div>
                        <a id="r1:0:gl13" class="xft" target="_blank" href="#">test</a>
                        </div>

                        -----------------------------------------------------------------------------------------

                        Looks like the expression #{cmfn:getNodeById('VMOHSKEND05482001326').url.downloadUrl} is not working. I don't have anything in log.

                        Is there any tag library that I need to add to make it working?

                        Thanks