Restrict POST request from a specific SlingAllMethodsServlet | Community
Skip to main content
priyadarshi_cts
April 21, 2020
Solved

Restrict POST request from a specific SlingAllMethodsServlet

  • April 21, 2020
  • 1 reply
  • 2818 views

Hi,

I have defined both doGet() and doPost() methods for SlingAllMethodsServlet as below

@9944223

protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException {

}

@9944223
protected void doPost(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException {

}

Why are both GET and POST requests in this servlet accessible from Postman even though sling.servlet.methods has been explicitly declared as GET  as shown below? 

@8220494(
service = { Servlet.class },
property = {
"sling.servlet.methods=" + HttpConstants.METHOD_GET,
"sling.servlet.paths="+ "/bin/sling/requestchecker",
},
)

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 aemmarc2

See : https://sling.apache.org/documentation/the-sling-engine/servlets.html

 

sling.servlet.methods is only applicable on registration of a servlet via sling.servlet.resourceTypes

 

your servlet example is registered on sling.servlet.paths

1 reply

aemmarc2Adobe EmployeeAccepted solution
Adobe Employee
April 22, 2020

See : https://sling.apache.org/documentation/the-sling-engine/servlets.html

 

sling.servlet.methods is only applicable on registration of a servlet via sling.servlet.resourceTypes

 

your servlet example is registered on sling.servlet.paths