package nl.opengeogroep.safetymaps.server.stripes;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.StreamingResolution;
import net.sourceforge.stripes.action.UrlBinding;

/**
 *
 * @author matthijsln
 */
@UrlBinding("/viewer/api/login")
public class LoginActionBean implements ActionBean {
    private ActionBeanContext context;

    @Override
    public ActionBeanContext getContext() {
        return context;
    }

    @Override
    public void setContext(ActionBeanContext context) {
        this.context = context;
    }

    public Resolution redirect() {
        return new StreamingResolution("text/html",
            "<html><head>" +
                "<meta http-equiv=\"refresh\" content=\"0;url=" + context.getRequest().getContextPath() + "/viewer/\">" +
            "</head></html>"
        );
    }
}

@@ -700,24 +700,189 @@
 edirect() %7B%0A
+        String returnTo = request.getParameter(%22returnTo%22);%0A%0A        if (returnTo == null %7C%7C returnTo.length() == 0) %7B%0A            returnTo = %22/viewer/%22;%0A        %7D%0A%0A
         retu
@@ -1056,25 +1056,28 @@
 ath() + 
-%22/viewer/
+returnTo + %22
 %5C%22%3E%22 +%0A 

Add returnTo param to normal login request