Session attribute in a Condition – HttpConfigurationProvider

Splash Forums Rewrite Users Session attribute in a Condition – HttpConfigurationProvider

This topic contains 2 replies, has 3 voices, and was last updated by  Lincoln Baxter III 8 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #19762



    I’m using the rewrite-servlet and rewrite-integration-faces extension modules and I”m trying to create a login filter.

    Is there a way to get or set session attributes inside a Condition?

    I’ve seen the login example using CDI, but I don’t use CDI in my application. Therefore I would like to check if the user is in session. Is that possible?

    Thanks a lot.


    There is no existing condition in Rewrite that allows to check for an session attribute. But you can build one yourself very easily. If you implement your condition on top of of HttpCondition, you can get the request (and therefore also the session) from the HttpServletRewrite event. Something like this:

    .when(new HttpCondition() {
    public boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context) {
    HttpServletRequest request = event.getRequest();
    return request.getSession(true).getAttribute("something") != null;
    .perform(.... something ...)

    I hope this helps. :)


    Christian beat me to it, but yes, that’s exactly what you would do!

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Rewrite Users’ is closed to new topics and replies.

Comments are closed.