Reply To: Cannot forward after response has been committed

Splash Forums Rewrite Users Cannot forward after response has been committed Reply To: Cannot forward after response has been committed

#27003

I was trying to figure out what might cause this problem last night, but I have to admit that I don’t really understand what happened. Could you perhaps upload a sample application that reproduces this so that I can see what is going on?

Is this a problem with Rewrite that is incompatible with GlassFish? Or was there an error encountered during servlet processing (after rewrite forwarded, then rewrite triggered again on the error dispatch.)

I think this configuration might solve your problem (and allow you to keep your web.xml error config.)

ConfigurationBuilder config = ConfigurationBuilder.begin();

config.addRule()
         .when(Direction.isInbound().and(Path.matches("{excluded}{url}"))
            .andNot(DispatchType.isError())
         )
         .perform(Forward.to("/123/123/test?url={url}" ) )
         .where("excluded").matches("(?!/wres|/123/123/test)")
         .where("url").matches(".*");

Note the exclusion of the ERROR dispatch type:

.andNot(DispatchType.isError())

Let me know if this works. Thanks!