Reply To: Rewrite Call to a CDI Bean

Splash Forums Rewrite Users Rewrite Call to a CDI Bean Reply To: Rewrite Call to a CDI Bean

#27308

andersonjunqueira
Participant

Sorry about it. I figured out what was happening.
The cookie was being created with a path = “/restrito” and I was trying to read from “/”.
The code wasn’t finding it.

BTW the Rewrite rule final definition was:

        cb.addRule()
            .when(Direction.isInbound().and(Path.matches("/restrito/logout")))
            .perform(
                new HttpOperation() {
                    @Override
                    public void performHttp(HttpServletRewrite event, EvaluationContext context) {
                        Cookie[] cookies = event.getRequest().getCookies();
                        for (int i = 0; i < cookies.length; i++) {
                            cookies[i].setMaxAge(0);
                            event.getResponse().addCookie(cookies[i]);
                        }
                        event.getRequest().getSession().invalidate();
                    }
                }
            .and(Forward.to("/logout.jsf")));

Thank you