Making Dropbox Documents Available in AEM

04 / Feb / 2016 by Jatin Gupta 1 comments

Use Case

Consider a scenario where a company uploads thousands of document related to its policies or some other stuff in AEM. It would be an overhead for AEM to manage those documents resulting in the degradation of performance since AEM is already managing a lot of tasks.


One way of managing documents and avoid overhead in AEM is to use document management systems like Dropbox and Google Drive. On the AEM side, we would have some way to make those documents available for view/download purpose.

Following customization needs to be done:

  • Customization  of Touch UI content Finder:  Adding one more option in Asset category and to showcase dropbox documents in the content finder on the selection of this option.
  • Integration with Dropbox: Fetching the metadata of the documents using Importer
  • Creation of droppable component: Enabling user to drop asset from asset category onto the page.
  • Metadata management of Dropbox documents

Steps to Integrate Dropbox with AEM:


  • Java 1.8 (Only in case if you install the source code attached below as the source contains some Java 8 specific code snippet.)
  • You also need to install Jackson-core bundle as dropbox-SDK has dependency on it


Sign up in dropbox and create a developer app in dropbox using the following link:

For our integration Dropbox with AEM, we would be requiring the Access Token ( You need Click on “Generate Token” button to get the Access token. The reason we are generating the token from the dropbox portal only so that we can skip the manual flow of OAuth2. For OAuth2 flow you can access OAuth2.0 )


Create the cloud services config page for Dropbox that has authoring dialog for parameters like Access Token, Target URL, Client-Identifier, Interval (The last three parameters we would be needing for creating the custom importer)

For creating the custom cloud service, please refer Create Custom Cloud service

Dropbox Configuration

Step3: Adding dependencies related to dropbox. I have used the maven build tool.  Add the following dependency to the project’s pom.xml


Also, Embed transitive dependencies used by dropbox SDK using the following code:



Create the dropbox config page using the template that was created in Step2. You can go to “http://<domain>:<port-no>/miscadmin#/etc/cloudservices” and create the page. The page would be created under the directory in CRXDE:


Add configure the page accordingly. Please see the below snapshot for reference.


Step 5:

Till now we are done with basic setup required for integration.It’s time to code NOW.

Create a custom importer that will poll the dropbox and fetch the metadata of the documents. The importer will also create a node (of type dam: Asset) under the path specified in the cloud config dialog of Dropbox Cloud Configuration Page created in Step4.

For reference, you can download

Step6: Once the importer will be created, the only part left is to display the imported content in DAM’s content finder.

Note: The solution provided for displaying the content would only work in TOUCH UI because of the overlaying structure of the component.

(a) To add the option in dropdown for category under Asset tab in Content finder, we need do the following:

  • Overlay the following structure:  /libs/cq/gui/components/authoring/clientlibs/assetfinder/js in apps. Delete all the child folders under js.
  • Create a folder “dropboxdocument” and place the .js file under it. You can copy the .js file from /libs/cq/gui/components/authoring/clientlibs/assetfinder/js/document/documentController.js. Rename the file as per your wish and save.
  • Now open the above js file and then change the “name” property to “Dropbox Docs” and “itemResourceType” to the path “cq/gui/components/authoring/assetfinder/dropbox
  • Create js.txt in same hierarchy and add the path to the file created in above step and save all the above changes. Now open any page in TOUCH UI mode, you will find an extra option being added in dropdown.

Content finder

Key Properties:

  • name: The label that will be shown in the dropdown
  • itemResourceType: is the component that will be rendered in content finder for each asset
  • imageServlet: the service that will list of assets that match the mime types given in param and in response it will give the HTML code

(b) Now we need to customize the code the component mentioned in itemResourceType property so that it can show the desired properties of the asset in content finder. Copy dropbox.jsp to the path “/apps/cq/gui/components/authoring/assetfinder/dropbox/

Note: It can be any path. But according you need to change the itemResourceType property.

(c) We need to create the component in which dropbox documents can be dropped. So you can create a copy of OTB download component and modify the script accordingly.

That’s it……….


This is how the directory structure will look like:

folder hierarchy

Download Source Code: dropbox-integration


comments (1 “Making Dropbox Documents Available in AEM”)

Leave a comment -