users@jersey.java.net

[Jersey] Re: Question about consuming TEXT_PLAN and JSON via POST

From: Martin Matula <martin.matula_at_oracle.com>
Date: Fri, 18 Mar 2011 19:37:28 +0100

Oh, I see what you mean. You are right.
Martin

On 18.3.2011 19:29, Tatu Saloranta wrote:
> On Fri, Mar 18, 2011 at 10:47 AM, Martin Matula
> <martin.matula_at_oracle.com> wrote:
>> Noah said: "I suppose I could break this into two resources, one consuming
>> JSON and one consuming FormData but I'd rather not - seems like it defeats
>> the purpose."
>> So, I was assuming he knows about breaking it up into two methods and was
>> wondering how to avoid it.
> Right right, agreed, he was trying to do it this way. I was just
> pointing out that plain text String was not meant to be bound to
> object; rather it would be (I thought) alternative representation. And
> then the question of how to support alternatives is an interesting
> one, given that they are structurally different (not just different
> formats).
> But maybe difference here is that just having 2 methods does not
> create 2 separate resources (iff paths are the same), but just 2
> physical end points.
>
> Of course it is possible to get by with just a single method, taking a
> String or byte[], and call binders manually based on incoming type.
> Just couple more lines of code.
>
> -+ Tatu +-