I have a Sling Servlet that Im creating .. It seems to be working just
fine until i pass a query parameter to it.

Ex.

http://example.com/libs/logout.html > logs the user out

http://example.com/libs/logout.html?resource=/bar/foo.html > does not
even call the servlet



It appears the Sling Servlet is ignoring any requests to its base path
if there are query params involved. Any ideas how to get around this?
Is this expected behavior?

Thanks

-------------------------
Pretty Pastie of code snippet: http://www.pastie.org/2045227


--------------------------------
Ugly email snippet:


/**
 *
 * @scr.component immediate="true" description="Logout Servlet"
 * @scr.service interface="javax.servlet.Servlet"
 * @scr.property name="sling.servlet.extensions" values.0 = "html"
 * @scr.property name="sling.servlet.methods" values.0 = "GET"
 * @scr.property name="sling.servlet.paths" value="/libs/logout"
 */
@SuppressWarnings("serial")
public class LogoutSlingServlet extends SlingAllMethodsServlet {

        /**
         * @scr.reference
         */
        Authenticator auth;

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

                String redirectUri = request.getParameter("resource");

                if(redirectUri == null) {
                        redirectUri = "/foo.html";
                }

                System.out.println(redirectUri);

                if (auth != null) {
                        try {
                                auth.logout(request, response);
                        } catch (Exception ex) {
                                response.sendError("Could not log user out");
                        }
                }

                response.sendRedirect(redirectUri);
                return;

        }

Reply via email to