users@jersey.java.net

Re: [Jersey] validation???

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 12 May 2009 12:03:54 +0200

On May 12, 2009, at 11:58 AM, Bruno Vernay wrote:

> I was referring to the example in the thread you cited:
> http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users+validation#query
> :list%3Anet.java.dev.jersey.users%20validation%20order%3Adate-
> backward+page:1+mid:3qhjvhnozilsuzmn+state:results
>
> The annotations made me hope that JAXB could do what I dreamed.
> I guess that the annotations were simply not related to JAXB.
>

Ah! You guess correct, it is not related to JAXB. Basically the Range
class represents two path parameters that have a constraining
relationship.

BTW i reckon it should be possible to utilize JAXB with the bean
validation framework.

Paul.

> Bruno
>
>
> On Tue, May 12, 2009 at 11:27 AM, Paul Sandoz <Paul.Sandoz_at_sun.com>
> wrote:
>>
>> On May 12, 2009, at 11:23 AM, Bruno Vernay wrote:
>>
>>> Hi,
>>> As I am reading the JAXB doc, there is schema validation
>>> https://jaxb.dev.java.net/tutorial/section_3_3-
>>> Validation.html#Validation
>>> But it uses XSD, which isn't very friendly.
>>>
>>> Paul, in your example, you show a immutable object "Range" with an
>>> annotated constructor. Is it used by JAXB ???
>>
>> What example are you referring to?
>>
>>
>>>
>>> I thought that JAXB was using only an empty constructor and then
>>> accessed the fields with byte code enhancement. So this created a
>>> problem since it bypasses any validation.
>>>
>>
>> JAXB requires an empty constructor for unmarshalling so it can
>> create an
>> instance.
>>
>>
>>> Do you know a way to instruct JAXB to use a specific constructor ?
>>
>> I do not.
>>
>> Paul.
>>
>>>
>>> That would indeed allow validation.
>>>
>>> Thanks
>>> Bruno
>>>
>>>
>>> On Tue, May 12, 2009 at 10:43 AM, Paul Sandoz
>>> <Paul.Sandoz_at_sun.com> wrote:
>>>>
>>>> Hi Keith,
>>>> There is no validation framework provided by Jersey.
>>>> Some developers are using the Bean Validation Framework. See the
>>>> following
>>>> thread:
>>>>
>>>> http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users+validation#query
>>>> :list%3Anet.java.dev.jersey.users%20validation%20order%3Adate-
>>>> backward+page:1+mid:3qhjvhnozilsuzmn+state:results
>>>> IIRC other developers may be using some AOP-based solutions to
>>>> validate
>>>> resource method parameters.
>>>> Hope this helps,
>>>> Paul.
>>>> On May 12, 2009, at 12:38 AM, Treague, Keith wrote:
>>>>
>>>> Is there any support in jersey for validating incoming data? I’d
>>>> prefer
>>>> this
>>>> sort of thing to be handled by the framework like Spring MVC or
>>>> even
>>>> Struts
>>>> 2 however I’m not seeing any integrated validation framework in
>>>> Jersey.
>>>>
>>>> Keith Treague
>>>>
>>>
>>>
>>>
>>> --
>>> Bruno VERNAY
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
>
>
> --
> Bruno VERNAY
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>