This servlet show cases a way to use the Java HTTP Servlet library to forward requests to internal resources within the repository.
mvn clean install
- Build the bundle
- Go to /system/console/bundles
- Install > Provide Bundle > Check Start Bundle > Install or Update
The ProxyServlet retrieves the resource that was requested and gets the property proxyPath and then uses the RequestDispatcher to forward the request to another resource.
This in turn allows for the resource that is being rendered to be rendered using the correct scripts.
- Install wknd project
- Create a node
/apps(sling:Folder)/wknd-site(nt:folder) - Copy
/content/wknd/language-masters/en/magazineto/apps/wknd-site - Create a node called
/content(sling:OrderedFolder)/proxies(sling:Folder)/magazine(nt:unstructured) - Set the following properties on the magazine node
proxyPath=/apps/wknd-site/magazinesling:resourceType=aem/support/proxy
- Make a GET request to
/content/proxies/magazine.htmlthe rendered page will be the one copied to/apps/wknd-site/magazine
- Create a node
/content(sling:Orderedfolder)/licenses(nt:unstructured)/eula(nt:unstructured) - Set the following properties under the eula node
-
isExternal={Boolean}true-proxyPath=https://www.fornav.com/documents/EULA.pdf-sling:resourceType=aem/support/proxy - Upload an asset to the dam
- Put a node property the metadata node with the following value
xmpRights:WebStatement=/content/licenses/eula.html(see https://experienceleague.adobe.com/en/docs/experience-manager-brand-portal/using/download/manage-digital-rights-of-assets) - Go download the asset you uploaded in step 3 and you will be presented with https://www.fornav.com/documents/EULA.pdf
- Create a node
/content(sling:Orderedfolder)/licenses(nt:unstructured)/eula(nt:unstructured) - Set the following properties under the eula node
-
isExternal={Boolean}true-sling:resourceType=aem/support/proxy - Upload an asset to the dam
- Put a node property the metadata node with the following value
xmpRights:WebStatement=/content/licenses/eula.html(see https://experienceleague.adobe.com/en/docs/experience-manager-brand-portal/using/download/manage-digital-rights-of-assets) - Go download the asset you uploaded in step 3 and you will be presented with https://www.fornav.com/documents/EULA.pdf