sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David G." <davidjgonza...@gmail.com>
Subject SlingServlets - Query Params making listener break
Date Thu, 09 Jun 2011 23:30:35 GMT
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;

	}

Mime
View raw message