Comments on: Sling Servlet in AEM http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/ Mon, 05 Apr 2021 05:55:04 +0000 hourly 1 https://wordpress.org/?v=6.4.4 By: Ankur Ahlawat http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-172548 Thu, 01 Apr 2021 11:49:17 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-172548 In reply to Giuliano Peretti.

Hello Giuliano,

Ajax POST call is jus a sample, that if you have to make a POST ajax call, you can use mentioned syntax. doGet example i am showing using browser hit directly. I am sorry , if i failed to explain. I will take out some time this weekend and restructure it for your better clarity.

]]>
By: Giuliano Peretti http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-172545 Mon, 22 Mar 2021 23:25:17 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-172545 This article is a mess…
You declare a Servlet with GET method and call it with POST, using resourceType implies that you have to use “jcr:content” to invoke it

]]>
By: Satish http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-172511 Wed, 26 Feb 2020 15:20:40 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-172511 Hi Ankur,

I am little bit confused.

You created servlet with resource type and same resource type you mentioned in page level jcr:content property. Now you are accessing servlet by using below URL.

http://localhost:4502/content/geometrixx/en/jcr:content.data.html.

The above URL is looks like page URL.

Now I have a component there in that I am making ajax call using above URL and I added this component in same page. Now my question is can I use same component in different page(Ajax call will work). I will not add any resource type in that page.

Could you please help me.

Thanks,
Satish

]]>
By: SV http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-172499 Fri, 24 Jan 2020 06:08:01 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-172499 Hi, Will implementing the resource type servlet I am getting additional this HTML code in the response. If I call a servlet through the ajax then it will give an error due to this. So how can I stop this additional code. Is there any other way in which we can provide the path of the node instead of /app/demo/component/page, the node is present in the /content/ and we can add selector also.

]]>
By: Ritu http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-130997 Tue, 03 Sep 2019 13:03:58 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-130997 @Satish – is POST call to sling servlet with resource type resolved? I am also facing the same issue. Already check:
1. Passing method is “POST”
2. extended SlingAllMethodsServlet

@Ankur – Can you please help here?

AEM version is 6.2

]]>
By: Ankur Ahlawat http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-125891 Sat, 10 Aug 2019 04:26:39 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-125891 In reply to satish.

2 things for post check that you are passing methods = “POST” and instead of SlingSafeMethodsServlet you are extending SlingAllMethodsServlet

]]>
By: satish http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-122991 Tue, 23 Jul 2019 20:40:24 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-122991 Hi,
I am trying to implement the post servlet in similar manner.
– created a servlet with resourceType = “/bin/customPath”
– created a page with ‘sling:resourceType = /bin/customPath”
– when I tried to hit the page URL as post method with proper payload, request is not hitting my servlet.
– the same thing worked for GET though.
Am I missing any config changes here?

Any suggestion would be helpful.
Thank you!

]]>
By: Prashant http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-54317 Fri, 05 Oct 2018 10:07:32 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-54317 In reply to kumar.

You cannot call OSGi service from front-end (AJAX). OSGI services can be injected into a component as well as servlets. OSGi services and servlets serve a completely different purpose. Infact it’s always a good practice to use OSGi service inside a servlet. Any interactions with JCR, or complex business logic are best segregated to an OSGI service. Servlets should be created if you need the JCR content to be exposed to external REST based clients.

]]>
By: kumar http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-31906 Tue, 12 Jun 2018 17:10:11 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-31906 Hi Ankur,

As I’m new to AEM. Could please help me when should i use sling servlet instead of OSGI service.
Please help me.

]]>
By: Asutosh http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#comment-18786 Sat, 17 Mar 2018 17:09:38 +0000 http://www.aemcq5tutorials.com/?p=2687#comment-18786 In reply to Shivani.

Shivani, you are correct.
It should be page/jcr:content as it has the resourceType property.

]]>