Hello, AEM Community
I have the following issue:
I want to create a servlet which works with the following properties:
@Component(
immediate = true,
service = Servlet.class,
property = {
"sling.servlet.extensions=json",
"sling.servlet.extensions=js",
"sling.servlet.resourceTypes=sling/servlet/default",
"sling.servlet.methods=GET",
"sling.servlet.methods=HEAD",
"sling.servlet.paths=/content/unified"
}
)
public class UnifiedSettingsJSONServlet extends SlingSafeMethodsServlet {
...
}
But it activates on all paths, not only specified. If I delete "sling.servlet.resourceTypes=sling/servlet/default", it doesn't work at all. So, I think "sling.servlet.paths" is ignored and I don't know why. Do you have any ideas?
Use:
org.osgi.service.component.annotations.Component
AEM 6.3.
Thanks.
Solved! Go to Solution.
Hi,
You should not use extension if you are registering servlet by path.
The servlet is working with "sling.servlet.resourceTypes=sling/servlet/default", because you registered as default servlet.
There is a issue with path as well, you need to specify Execution path at http://localhost:4502/system/console/configMgr/org.apache.sling.servlets.resolver.SlingServletResolv... if you are registering servlet by path
"sling.servlet.paths=/content/unified"
Please check sample servlet aem63app-repo/SimpleGetGroup.java at master · arunpatidar02/aem63app-repo · GitHub
Thanks
Views
Replies
Total Likes
Hi,
You should not use extension if you are registering servlet by path.
The servlet is working with "sling.servlet.resourceTypes=sling/servlet/default", because you registered as default servlet.
There is a issue with path as well, you need to specify Execution path at http://localhost:4502/system/console/configMgr/org.apache.sling.servlets.resolver.SlingServletResolv... if you are registering servlet by path
"sling.servlet.paths=/content/unified"
Please check sample servlet aem63app-repo/SimpleGetGroup.java at master · arunpatidar02/aem63app-repo · GitHub
Hi, Arun Patidar
Thanks for your help.
Hi, arturl43391132 and Arun Patidar,
below is my servelt but when i am using http://localhost:4502/content/dam/html-content/test.html this url it is not calling servelt i have added the path "/content/dam/html-content" in Apache Sling Servlet Configuration
FYI , We have a business requirement to host static webpages from AEM. Our AEM version is the latest AEM as a Cloud Service - 6.5.
I did try
1. Unchecked "Enable For All Resource Paths" option in the Apache Sling Content
Disposition Filter;
2. Removed the blacklisted "text/html" configuration and unchecked Allow unknown mime types from SafeBinaryGetServlet(DamContentDispositionFilter)
but nothing worked.
let me know if you have better solution
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies