users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: client form parameters still bug me

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Sun, 17 Jun 2012 17:44:27 +0100

Hi
On 15/06/12 20:27, Bill Burke wrote:
> I'm in the middle of porting form resteasy client tests, to the new
> JAX-RS 2.0 api. Let's compare:
>
> Resteasy:
>
> request.formParameter("name", value).post();
>
I believe the problem with this variant is that it allows for using post
methods with non empty bodies, ex, request.formParameter("name",
value).post(Entity.xml(new Book()));

> Spec:
>
> Form form = new Form().param("name", value);
> request.post(Entity.form(form));
>
> or
>
> request.post(Entity.form(new Form().param("name", value)));
>
> Still bothers me that the "flow" for form parameters can't be as simple
> in the specification for something that will be used a lot by users.
Entity.form() does introduce some complexity into this flow, I agree.
I wonder if it can be be avoided, for example, post(Form) can be
introduced, etc.

In general I like the idea that a form can be built and submitted in one
call without having to repeat formParameter or similar calls on the
target/invocationbuilder which allows for much more than building the form

Thanks, Sergey