Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

AEM 6 - invoke Servlet (GET) - servlet as it is not in the list of allowed paths

Avatar

Level 2

Hello everyone,

maybe it is a dummy question but I couldn't found a solution until now.

I have this simple Servlet:

@SlingServlet(

        paths={"/schafbergbahn/ticker"},

        methods = "GET",

        metatype=true

        )

public class SimpleServlet extends org.apache.sling.api.servlets.SlingAllMethodsServlet {

    @Override

    protected void doGet(final SlingHttpServletRequest req,

            final SlingHttpServletResponse resp) throws ServletException, IOException {

        resp.getOutputStream().println(

                "This content is generated by the SimpleServlet - QUMA");

    }

}

deployed in my AEM 6.2 environment and if I invoke this servlet with

    http://localhost:4552/myPath/ticker/

I get a HTTP 403 Forbidden (at bottom).

Does anyone know how I can solve this issue?

Thanks a lot!

Forbidden

Cannot serve request to /myPath/ticker/ in org.apache.sling.servlets.get.DefaultGetServlet

Request Progress:

0 TIMER_START{Request Processing} 
0 COMMENT timer_end format is {<elapsed msec>,<timer name>} <optional message>
0 LOG Method=GET, PathInfo=/myPath/ticker/
0 TIMER_START{ResourceResolution}
0 TIMER_END{0,ResourceResolution} URI=/myPath/ticker/ resolves to Resource=ServletResource, servlet=at.my.package.name.core.servlets.SimpleServlet, path=/myPath/ticker
0 LOG Resource Path Info: SlingRequestPathInfo: path='/MyPath/ticker', selectorString='null', extension='null', suffix='/'
0 TIMER_START{ServletResolution}
0 TIMER_START{resolveServlet(/myPath/ticker)} 0 LOG Will not look for a servlet at /myPath/ticker.servlet as it is not in the list of allowed paths
0 TIMER_END{0,resolveServlet(/myPath/ticker)} Using servlet org.apache.sling.servlets.get.DefaultGetServlet
0 TIMER_END{0,ServletResolution} URI=/myPath/ticker/ handled by Servlet=org.apache.sling.servlets.get.DefaultGetServlet
0 LOG Applying Requestfilters
0 LOG Calling filter: com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl 0 LOG Calling filter: org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter
0 LOG Calling filter: com.adobe.granite.rest.impl.servlet.ApiResourceFilter
0 LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter 0 LOG Calling filter: com.adobe.granite.httpcache.impl.InnerCacheFilter
0 LOG Calling filter: org.apache.sling.rewriter.impl.RewriterFilter
0 LOG Calling filter: com.adobe.cq.mcm.campaign.servlets.CampaignCopyTracker 0 LOG Calling filter: com.day.cq.wcm.core.impl.WCMRequestFilter
0 LOG Calling filter: com.adobe.cq.history.impl.HistoryRequestFilter
0 LOG Calling filter: com.adobe.granite.optout.impl.OptOutFilter 0 LOG Calling filter: com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet
1 Accepted Solution

Avatar

Correct answer by
Level 7

Under Config manager, search for "Apache Sling Servlet/Script Resolver and error handler" and the property is "Execution Paths"

View solution in original post

6 Replies

Avatar

Employee

To me the path is set to /schafbergbahn/ticker

Avatar

Administrator

As mentioned by Feike, the path set is

     @SlingServlet( 

             paths={"/schafbergbahn/ticker"}, 

And you are trying to " http://localhost:4552/myPath/ticker/

If it is a typo in writing the question, then make sure user has read/write permission "/myPath/ticker/ " or "/schafbergbahn/ticker" which ever is correct in your case.

~kautuk



Kautuk Sahni

Avatar

Level 2

The right url is schafbergbahn/ticker -> I would generalize it to myPath/ticker

Avatar

Level 1

I do have the same problem.

How can I set the rights for general access to the servlet?

Best Regards,

Hannes

Avatar

Level 2

With "/bin/schafbergbahn/ticker" it works fine -> /bin is accessable!

I would be interested in where to configure other paths in order to make it accessable.

Thanks!

Avatar

Correct answer by
Level 7

Under Config manager, search for "Apache Sling Servlet/Script Resolver and error handler" and the property is "Execution Paths"