SlingServlet to handle GET requests from multiple extensions | Community
Skip to main content
Level 2
September 27, 2019

SlingServlet to handle GET requests from multiple extensions

  • September 27, 2019
  • 1 reply
  • 5944 views

Hi All,

I'm using AEM6.4 and for a particular case I have a custom sling servlet must address get requests from multiple extensions.

Eg:

Hence, for any GET request from any of the above URLs('/content/rc/*/*.zip' ,etc).

Now, I have the below code snippet which works completely fine for '.pdf' extension but fails for any other extension.

I doubt that if it has to do anything with the way I have defined multiple extensions because as do notice below pdf is the second extension defined, i.e. its ignoring all other extensions.

How can I address this?

Any suggestions/help would be highly appreciated.

arunpatidar26smacdonald2008

Thanks & Regards,

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

1 reply

Theo_Pendle
Level 8
September 27, 2019

Hi,

You say it works fine for .pdf extensions, but could you be more specific about how it is failing for the others?

Are you getting a 404 - Resource not found? Are you getting a 200 but an error during the execution of doGet()? Etc.

Could you also give us an XML sample of the node structure under /content/rc/abs/en/membership/interviews/AESSVID0250 please?

I think I have an idea but need more info

arunpatidar
Community Advisor
Community Advisor
September 27, 2019

Hi,

There is a chance to having another servlet which is being resolved and has the highest ranking.

Can you check your request at http://localhost:4502/system/console/servletresolver

Check which servlet is getting called for zip,xls and ppt extensions.

Arun Patidar
Level 2
September 27, 2019

Hi Arun,

That's what I guessed, bcz when I updated the following property under '/system/console/configMgr' :

'Apache Sling GET Servlet => xml:pdf,zip,ppt '

The requests get handled by the default GET servlet and it downloads the asset(.zip,.ppt,etc) from the dam(what we want to achieve) but the control still never came to our custom servlet.

Thanks to you, now I do see which default servlet handles the request with extension .zip,.ppt, etc

BUT, how do I get my custom servlet to handle such request and possibly override any default servlet handlers?

Thanks & Regards,