Created a sling fliter to rename image name having space with "-" | Community
Skip to main content
Level 2
September 24, 2024
Solved

Created a sling fliter to rename image name having space with "-"

  • September 24, 2024
  • 3 replies
  • 917 views

Hi,

I have created a sling fliter to rename image name having space with "-". It's working in aem sdk but not working on RDE,DEV or higher environment.

I have done the same code as mentioned here:

https://experience-aem.blogspot.com/2020/08/aem-6550-modify-filename-on-upload-before-executing-dam-update-asset-workflow.html

final var requestParts = (Iterator<?>) slingRequest.getAttribute("request-parts-iterator");
this is null in higher environment(RDE, DEV, Stage...) but working in local.
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 martin_ecx_io

I wonder if this is due to the way AEM Cloud Service differs from AEM 6.5 and technically a local SDK instance when it comes to asset processing.  In 6.5 assets were processed on the author instance so the file upload goes direct to the instance.  In CS the upload actually goes directly into blob storage and processing is handled outside of AEM.

 

Theres an Adobe Tech blog which goes into the details here: https://blog.developer.adobe.com/introduction-to-aem-as-a-cloud-service-asset-upload-http-api-fc560ffd7221

 

This likely means you don't get the same data in the incoming "createasset" request on any CS instance compared to a local SDK or 6.5 instance.

3 replies

TarunKumar
Community Advisor
Community Advisor
September 24, 2024

Hi @samikshash1 ,

Please follow below steps to troubleshoot it. This may be happening due to caching mechanism available in other environment while there is no caching in your local and secondly you can check for pattern that you have given in your sling filter.

 

1. Apply log in your sling filter and check if any request is going through it.

2. Check your filter functionality for DEV publisher and not in dispatcher.

3. If it is working in Publisher then issue might be due to cached content and filter pattern on dispatcher.

4. Flush the dispatcher cache and see if it is working.

5. Check the filter pattern

property = { Constants.SERVICE_DESCRIPTION + "=Demo to filter incoming requests", EngineConstants.SLING_FILTER_SCOPE + "=" + EngineConstants.FILTER_SCOPE_REQUEST, Constants.SERVICE_RANKING + ":Integer=-100", EngineConstants.SLING_FILTER_REQUEST_PATTERN + "=/content/dam/.*", })

, it should look something like above.  If you already have this then look for URL rewrite pattern in dispatcher for DAM asset and do the modification there so that request go through "content/dam".

 

 

-Tarun

 

 

-Tarun

Level 2
September 24, 2024

Hi @tarunkumar ,

 

I have applied logs , I am getting null at below line -

final var requestParts = (Iterator<?>) slingRequest.getAttribute("request-parts-iterator");

 Also,

I tried to deploy on RDE , even on RDE it's not working.

martin_ecx_io
Community Advisor and Adobe Champion
martin_ecx_ioCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
September 24, 2024

I wonder if this is due to the way AEM Cloud Service differs from AEM 6.5 and technically a local SDK instance when it comes to asset processing.  In 6.5 assets were processed on the author instance so the file upload goes direct to the instance.  In CS the upload actually goes directly into blob storage and processing is handled outside of AEM.

 

Theres an Adobe Tech blog which goes into the details here: https://blog.developer.adobe.com/introduction-to-aem-as-a-cloud-service-asset-upload-http-api-fc560ffd7221

 

This likely means you don't get the same data in the incoming "createasset" request on any CS instance compared to a local SDK or 6.5 instance.

kautuk_sahni
Community Manager
Community Manager
September 25, 2024

@samikshash1 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni