POST servlet not getting called. | Community
Skip to main content
gargsahil099
New Participant
March 6, 2020
Solved

POST servlet not getting called.

  • March 6, 2020
  • 1 reply
  • 4133 views

Hi Experts,

 

I have a use case where i need to call the servlet which is registered with resourceType and method POST. Can someone please help me to suggest how can i achieve this. I have to call this on page load itself. Please suggest.

 

Thanks in advance.

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 BrianKasingli

@gargsahil099,

If you are testing from an HTTP Client such as postman, you will need to configure the "Apache Sling Referrer Filter" and "Adobe Granite CSRF Filter". Other than that, if your AEM page is making an HTTP Post request, it should be working as expected with only the "Apache Sling Referrer Filter" configured without the CSRF Filter. Check out this tutorial on how to make POST requests to your AEM instance - https://sourcedcode.com/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client

What is the AEM Apache Sling Referrer Filter OSGI configuration? https://sourcedcode.com/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration

 

1 reply

BrianKasingli
BrianKasingliAccepted solution
New Participant
March 6, 2020

@gargsahil099,

If you are testing from an HTTP Client such as postman, you will need to configure the "Apache Sling Referrer Filter" and "Adobe Granite CSRF Filter". Other than that, if your AEM page is making an HTTP Post request, it should be working as expected with only the "Apache Sling Referrer Filter" configured without the CSRF Filter. Check out this tutorial on how to make POST requests to your AEM instance - https://sourcedcode.com/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client

What is the AEM Apache Sling Referrer Filter OSGI configuration? https://sourcedcode.com/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration

 

gargsahil099
New Participant
March 9, 2020

Hi @briankasingli

 

I am looking for the solution where this servlet be called automatically on page load without any custom code as our doget method got called on sling:resourceType servlets.

 

Please suggest.