Reply To: .addRule – java.lang.IllegalStateException:

Splash Forums Rewrite Users .addRule – java.lang.IllegalStateException: Reply To: .addRule – java.lang.IllegalStateException:

#26795

Well, to avoid this exception, you should use the following:

@Override
public Configuration getConfiguration(ServletContext context) {	
	return ConfigurationBuilder.begin() 
			.addRule()
			 .when(Direction.isInbound().and(new HttpCondition() {
                             public boolean evaluate(HttpServletRewrite event, EvaluationContext context)
                             {
                                 return event.getResponse().isCommitted();
                             }
                         }))
			 .perform(Lifecycle.handled())
			
	         .addRule()
	         .perform(Log.message(Level.INFO, "Rewrite is active."))//  message(Log.message(Level.INFO, "Rewrite is active."))) 
     
	         .addRule(Join.path("/home").to("/pages/index.jsp").withInboundCorrection());
};

But why is the response committed? It probably shouldn’t be. You should try to find what is committing the response prematurely.