Post/Get servlet with selector throwing error in dispatcher | Community
Skip to main content
New Participant
May 31, 2023
Solved

Post/Get servlet with selector throwing error in dispatcher

  • May 31, 2023
  • 4 replies
  • 1813 views

On Dispatcher POST/GET call with Selector is giving error but without selector it is working fine. But I want it to work with selector. I have allowed selector in filter still it is not working. This issue appeared after the shortening of the URL. Without shortening it was working fine.

 

My servlet is resource type binded with component

http://dev.sample.com/en-us/bloglisting/blog/jcr:content/root/responsivegrid/imagedownloader.downloadImage

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 EstebanBustamante

If the URL works on postman means your Page is cached, try flushing dispatcher cache and then try on incognito window 

4 replies

aanchal-sikka
New Participant
June 1, 2023

Hello @ronnie09 

 

1. Please use an extension while accessing the resource.

- That provides a better understanding of the response type 

- Selector would not be confused as extension

 

2. Please check the AEM publish logs and dispatcher logs. It will help you understand what request is hitting the publish server:

- Is any request hitting AEM publish?

- If yes, whats the URL? 

- Does the URL give the expected results when accessed on publish directly?

 

Aanchal Sikka
Ronnie09Author
New Participant
June 1, 2023

Hi @aanchal-sikka 
It is working now via postman but on Dispatcher URL first it is hitting full path of the servlet then its hitting shortened URL 2 calls are happening in total and giving 404 ... Same URL works on POSTMAN. 

EstebanBustamante
EstebanBustamanteAccepted solution
New Participant
June 1, 2023

If the URL works on postman means your Page is cached, try flushing dispatcher cache and then try on incognito window 

Esteban Bustamante
EstebanBustamante
New Participant
May 31, 2023

Which error are you getting? is it 40X? If so, it is clearly a dispatcher config issue, I think you have answered your own question, check the following:

1. The servlet is allowed (GET/POST) to the selector you are attempting to hit in the dispatcher filter configs

2. The rewrite rule is such, that you can get the full URL which will be understood by the publisher

3. Restart Apache to apply your changes.

 

For more details, you should set your dispatcher log's level to DEBUG and check what URL it is being hit, whit that info you will clearly see, if is it a correct (valid) URL that will be understood by the publisher. Is it being blocked? 

Esteban Bustamante
Kiran_Vedantam
New Participant
May 31, 2023

Hi @ronnie09 

 

Can you share the error that you are seeing?

 

Also If you don't define extensions but define selectors, your selectors can be used with extensions which means you can call only with selector(/content/my-site/en.testing). But it is not recommended. Define both selectors and extensions.

 

Hope it helps!

Thanks,
Kiran Vedantam.

Ronnie09Author
New Participant
June 1, 2023

@kiran_vedantam 

Through postman it is working fine now with selector and extension but on PAGE it is showing 301 redirect and converting POST call to GET 

Which gives response header location as 404 page path

iamnjain
New Participant
May 31, 2023

Hello @ronnie09 

Can you please put some sample URL and more details?

 

Ronnie09Author
New Participant
May 31, 2023