[jax-rs-spec users] [jsr339-experts] the weird states of Request on server side

From: Bill Burke <>
Date: Thu, 23 Feb 2012 13:21:26 -0500

Consider this RequestFilter that modifies the request on the server side:

    RequestBuilder builder = ctx.getRequest().copy();
    Request request =;


As it stands now, this code is perfectly legal. The weird part is that
readEntity() can be invoked before the "real" request is changed.
Headers aren't updated for the "real" request until ctx.setRequest() is

Does anybody find this strange? This is just one of the many reasons I
can't stand the builder pattern. If you could just modify the request
directly via setter methods, it would all be much simpler instead of
having all these weird in-between states, complex interfaces and
interaction patterns.


Wouldn't it look much nicer to do:


Instead of:

   Request request = ctx.getRequest().copy()

I know I'm complaining to deaf ears on this, but it just bothers the
hell out of me.

Bill Burke
JBoss, a division of Red Hat