AEM 6.5 Documents for Download. | Community
Skip to main content
New Participant
May 19, 2020
Solved

AEM 6.5 Documents for Download.

  • May 19, 2020
  • 1 reply
  • 6528 views

We are developing a OSGI module that uses a SlingRequest as input. 

 

We have no issues with the input. These are uploaded documents by authenticated users.

The  module will use various document services to generate a new document.

 

Questions.

Is there any sample document/website on how these documents can be stored in the JCR, to be available for the user for download?

How do we generate a URL that we can return through the SlingResponse for the user to use as a link access the document?

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Theo_Pendle

Hi @eric_stricker,

So if I've understood, you want to:

  1. Create documents programatically
  2. Provide a download link to a user
  3. Store that document long-term

If that's the case, then the simplest solution I can think of is to use the DAM 🙂 You can run your business logic to create a document (a PDF for example) and then store it as a DAM asset using the AssetManager API (javadoc here). Once you have stored the asset, you can simply send a link pointing to its location in the DAM. If you want to share the asset with non-authorized users, you can use the Asset Link Sharing feature.

Does all of that answer your requirements?

1 reply

Theo_Pendle
Theo_PendleAccepted solution
New Participant
May 19, 2020

Hi @eric_stricker,

So if I've understood, you want to:

  1. Create documents programatically
  2. Provide a download link to a user
  3. Store that document long-term

If that's the case, then the simplest solution I can think of is to use the DAM 🙂 You can run your business logic to create a document (a PDF for example) and then store it as a DAM asset using the AssetManager API (javadoc here). Once you have stored the asset, you can simply send a link pointing to its location in the DAM. If you want to share the asset with non-authorized users, you can use the Asset Link Sharing feature.

Does all of that answer your requirements?

New Participant
May 20, 2020
Thank you. Yes, it looks oke. Actual the document will be for short term only (ie, 1 or 2 hours), but we can write a separate cron job to remove document older than x seconds.