Re: Apache Ext-CDI aka CODI and Rewrite integration issue

Splash Forums Rewrite Users Apache Ext-CDI aka CODI and Rewrite integration issue Re: Apache Ext-CDI aka CODI and Rewrite integration issue

#22930

RedShadow
Participant

Here is an updated version of the codi fix. I had some issues regarding the redirect codi does to append the windowId. The following will fix that problem by skipping rewrite handling when no windowId is present.

public class CodiWindowIdFixConfigurationProvider extends

HttpConfigurationProvider {

@Override

public Configuration getConfiguration(ServletContext context) {

final Condition hasSession = new HttpCondition() {

@Override

public boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context) {

return event.getRequest().getSession(false) != null && !event.getRequest().getSession().isNew();

}

};

return ConfigurationBuilder

.begin()

.defineRule()

.when(Direction.isInbound().andNot(hasSession).and(QueryString.parameterExists("windowId")))

.perform(new HttpOperation() {

@Override

public void performHttp(HttpServletRewrite event, EvaluationContext context) {

Redirect.temporary(event.getContextPath() + event.getRequestPath()).and(Lifecycle.handled()).perform(event, context);

}

})

.defineRule()

.when(Direction.isInbound().andNot(QueryString.parameterExists("windowId")))

.perform(Lifecycle.handled());

}

@Override

public int priority() {

return Integer.MAX_VALUE;

}

}