On 12/12/2011 11:43 PM, Bill Burke wrote:
> On the client side, for a RequestFilter, what does FilterContext.getReqeustBuilder return? Does it make a copy of the
> existing request? It should, or at least should have a Request.Builder.builder(Request.Builder copy); method.
My understanding is that the builder is a copy of the request.
>
> BTW, this interface is really really bizarre. These are the steps to modify/add a header:
>
> Builder b = filterContext.getRequestBuilder();
> b.header("foo", "value");
> filterContext.setRequest(b.build());
Or simply (borrowing style and variable name from your nicer example bellow:
ctx.setRequest(ctx.getRequestBuilder().header("foo", "value"));
Or, even better with continuation passing style:
return ctx.continue(ctx.getRequestBuilder().header("foo", "value"));
>
> Would be much nicer to do:
>
> ctx.getRequest().header("foo", value");
>
> All these builder interfaces buy you very very little (except for confusion and complexity). Its really hurting the
> spec, IMO.
I disagree.
Marek