dev@jsr311.java.net

Re: JSR311: POSTed form data

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 15 Feb 2008 16:28:51 -0500

On Feb 15, 2008, at 9:02 AM, Bill Burke wrote:

> FYI: The servlet spec makes no distinction from uri query and form
> parameters, although you can get the query string. IMO, we should
> have similar mapping.
>
> Maybe @Param for unified either/or
> @QueryParam for URI query
> @FormParam
>
> Flags are ugly and I don't want:
>
> @QueryParam(value="param", uri=true)
> @QueryParam(value="param", form=true)
>

I don't see much use for the unified case. If you are designing a web
api you should be pretty clear about where you expect form data in a
request to go.

Marc.

>
>
> Stefan Tilkov wrote:
>> I'm not sure this merits being supported by an annotation - why do
>> this for HTML form data and not for other formats?
>> If it's added, I'd like a new annotation because calling something
>> sent via POST "_query_ param" just feels wrong.
>> Stefan
>> --
>> Stefan Tilkov, http://www.innoq.com/blog/st/
>> On Feb 14, 2008, at 10:26 PM, Marc Hadley wrote:
>>> Issue 30[1] requests that we improve support for POSTed form data,
>>> either by supporting it with the existing @QueryParam annotation
>>> or by adding a new annotation, e.g. @PostParam or @FormParam.
>>>
>>> Note that we already require support for
>>>
>>> @POST @ConsumeMime("application/x-www-form-urlencoded")
>>> public Foo update(MultivaluedMap<String,String> formData) {
>>> String name = formData.get("name");
>>> ...
>>> }
>>>
>>> where formData can be used to get at the individial form fields.
>>>
>>> The suggested addition would add support for doing something like:
>>>
>>> @POST @ConsumeMime("application/x-www-form-urlencoded")
>>> public Foo update(@QueryParam("name") String name) {...}
>>>
>>> Opinions ?
>>>
>>> If you are in favor, do you think this warrants a new annotations
>>> or a change to the existing @QueryParam.
>>>
>>> If you favor a change to @QueryParam then which should take
>>> precedence if the same name is used for a field in the request
>>> entity and a URI query param ?
>>>
>>> Thanks,
>>> Marc.
>>>
>>> [1] https://jsr311.dev.java.net/issues/show_bug.cgi?id=30
>>>
>>> ---
>>> Marc Hadley <marc.hadley at sun.com>
>>> CTO Office, Sun Microsystems.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.