활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
Hi All,
Can someone please tell me what is the difference between SlingAllMethodsServlet and SlingSafeMethodServlet ?
We use them when writing servlets but i am not sure which should be given preference.
Thanks
Jai
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
Hi Jai,
Basically, SlingAllMethodsServlet is another layer of interface which extends SlingSafeMethodServlet which has doPost, doDelete and doPut operations for the request, response.
Refer [1] and [2] for more details on each interface
[1] https://sling.apache.org/apidocs/sling5/org/apache/sling/api/servlets/SlingSafeMethodsServlet.html
[2] https://sling.apache.org/apidocs/sling5/org/apache/sling/api/servlets/SlingAllMethodsServlet.html
조회 수
답글
좋아요 수
Hi Jai,
Basically, SlingAllMethodsServlet is another layer of interface which extends SlingSafeMethodServlet which has doPost, doDelete and doPut operations for the request, response.
Refer [1] and [2] for more details on each interface
[1] https://sling.apache.org/apidocs/sling5/org/apache/sling/api/servlets/SlingSafeMethodsServlet.html
[2] https://sling.apache.org/apidocs/sling5/org/apache/sling/api/servlets/SlingAllMethodsServlet.html
조회 수
답글
좋아요 수
Hi Jai,
to add to the reply from bsloki, if your servlet will only ever be called with GET requests, then use SlingSafeMethodsServlet. If your servlet will be called with POST(and GET) requests, then use SlingAllMethodsServlet.
From the documentation:
SlingSafeMethodsServlet: Helper base class for read-only Servlets used in Sling
SlingAllMethodsServlet: Helper base class for data modifying Servlets used in Sling
Basically, if your servlet is not modifying anything in the repository, then use SlingSafeMethodsServlet.
Regards,
Opkar
조회 수
답글
좋아요 수
Hi Jai,
In Addition to that, also please check this development article that based on SlingAllMethodsServlet:
Submitting Adobe CQ form data to Java Sling Servlets: https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html.
For deeper understanding of Sling in AEM, please go-through the recorded May session of ASK the AEM Experts: http://scottsdigitalcommunity.blogspot.com/2015/05/may-session-of-aem-ask-community-experts.html , that will cover sling concepts in depth.
Thanks,
Ratna Kumar.
조회 수
답글
좋아요 수