You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Jonathan Fisher <jo...@springventuregroup.com> on 2014/09/09 03:42:44 UTC

JSON Webservice... interpreting null as null

Consider this request:

{
"call" : {
"type" : "Call",
"subject" : null
 }
}

This object:

@XmlRootElement(name = "call")
@XmlAccessorType(XmlAccessType.NONE)
public class ApiCallActivity {
@NotNull
@XmlElement(name = "type")
public String type;

@Size(min = 1, max = 255)
@XmlElement(name = "subject")
public String subject;
}

And this webservice:

@ApplicationScoped
@Path("/")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public class CallActivityController {
@Inject
private Logger log;
@Inject
private BeanValidator validator;
@EJB
private CallActivityService callActivityService;

@Path("/")
@POST
public void postCall(ApiCallActivity apiCall) {
log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
apiCall.subject);
}
}

How come subject is a 0 length string "" not null... like a surprised
individual might discover? Is there a way to make null be null?


*Jonathan Fisher*
*VP - Information Technology*
*Spring Venture Group*

-- 
Email Confidentiality Notice: The information contained in this 
transmission is confidential, proprietary or privileged and may be subject 
to protection under the law, including the Health Insurance Portability and 
Accountability Act (HIPAA). The message is intended for the sole use of the 
individual or entity to whom it is addressed. If you are not the intended 
recipient, you are notified that any use, distribution or copying of the 
message is strictly prohibited and may subject you to criminal or civil 
penalties. If you received this transmission in error, please contact the 
sender immediately by replying to this email and delete the material from 
any computer.

Re: JSON Webservice... interpreting null as null

Posted by Romain Manni-Bucau <rm...@gmail.com>.
put moxy in the container and ensure it is first in common.loader
(before tomee/lib)

about jettison I guess the config should be done as well (there are
some new setters)


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-12 19:21 GMT+02:00 Jonathan Fisher <jo...@springventuregroup.com>:
> Also, is there a way to set Moxy as the provider server wide?
>
>
> *Jonathan Fisher*
> *VP - Information Technology*
> *Spring Venture Group*
> (o) 913-653-8820
>
> On Fri, Sep 12, 2014 at 12:12 PM, Jonathan Fisher <
> jonathan@springventuregroup.com> wrote:
>
>> FYI, I tried replacing Jettison with v1.3.5 with the same results.
>>
>> What jackson jars would I need to parse the json?
>>
>>
>> *Jonathan Fisher*
>> *VP - Information Technology*
>> *Spring Venture Group*
>> (o) 913-653-8820
>>
>> On Tue, Sep 9, 2014 at 9:18 AM, Romain Manni-Bucau <rm...@gmail.com>
>> wrote:
>>
>>> about jettison: you can drop and replace the jar
>>>
>>>
>>> Romain Manni-Bucau
>>> Twitter: @rmannibucau
>>> Blog: http://rmannibucau.wordpress.com/
>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> Github: https://github.com/rmannibucau
>>>
>>>
>>> 2014-09-09 15:38 GMT+02:00 Jean-Louis Monteiro <jlmonteiro@tomitribe.com
>>> >:
>>> > Jettison is the default provider behind Jaxb in CXF.
>>> > You can also use Jackson which is more efficient.
>>> >
>>> > --
>>> > Jean-Louis Monteiro
>>> > http://twitter.com/jlouismonteiro
>>> > http://www.tomitribe.com
>>> >
>>> > On Tue, Sep 9, 2014 at 3:21 PM, Jonathan Fisher <
>>> > jonathan@springventuregroup.com> wrote:
>>> >
>>> >> Thanks! (as always)
>>> >>
>>> >> Is there a way too swap Jetison versions? I think we're on 1.6.0.2 in
>>> >> prod...
>>> >>
>>> >> Jonathan S. Fisher
>>> >> Spring Venture Group
>>> >> Sent on the go; I blame the spelling and grammar mistakes on my phone.
>>> >> On Sep 9, 2014 12:00 AM, "Romain Manni-Bucau" <rm...@gmail.com>
>>> >> wrote:
>>> >>
>>> >> > Hi
>>> >> >
>>> >> > That was jettison behavior. This is fixed with cxf 3.
>>> >> >
>>> >> > Ps: here is the jira enhancing it
>>> >> > https://jira.codehaus.org/plugins/servlet/mobile#issue/JETTISON-126
>>> >> >  Le 9 sept. 2014 02:43, "Jonathan Fisher" <
>>> >> jonathan@springventuregroup.com
>>> >> > >
>>> >> > a écrit :
>>> >> >
>>> >> > > Consider this request:
>>> >> > >
>>> >> > > {
>>> >> > > "call" : {
>>> >> > > "type" : "Call",
>>> >> > > "subject" : null
>>> >> > >  }
>>> >> > > }
>>> >> > >
>>> >> > > This object:
>>> >> > >
>>> >> > > @XmlRootElement(name = "call")
>>> >> > > @XmlAccessorType(XmlAccessType.NONE)
>>> >> > > public class ApiCallActivity {
>>> >> > > @NotNull
>>> >> > > @XmlElement(name = "type")
>>> >> > > public String type;
>>> >> > >
>>> >> > > @Size(min = 1, max = 255)
>>> >> > > @XmlElement(name = "subject")
>>> >> > > public String subject;
>>> >> > > }
>>> >> > >
>>> >> > > And this webservice:
>>> >> > >
>>> >> > > @ApplicationScoped
>>> >> > > @Path("/")
>>> >> > > @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON
>>> })
>>> >> > > @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON
>>> })
>>> >> > > public class CallActivityController {
>>> >> > > @Inject
>>> >> > > private Logger log;
>>> >> > > @Inject
>>> >> > > private BeanValidator validator;
>>> >> > > @EJB
>>> >> > > private CallActivityService callActivityService;
>>> >> > >
>>> >> > > @Path("/")
>>> >> > > @POST
>>> >> > > public void postCall(ApiCallActivity apiCall) {
>>> >> > > log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
>>> >> > > apiCall.subject);
>>> >> > > }
>>> >> > > }
>>> >> > >
>>> >> > > How come subject is a 0 length string "" not null... like a
>>> surprised
>>> >> > > individual might discover? Is there a way to make null be null?
>>> >> > >
>>> >> > >
>>> >> > > *Jonathan Fisher*
>>> >> > > *VP - Information Technology*
>>> >> > > *Spring Venture Group*
>>> >> > >
>>> >> > > --
>>> >> > > Email Confidentiality Notice: The information contained in this
>>> >> > > transmission is confidential, proprietary or privileged and may be
>>> >> > subject
>>> >> > > to protection under the law, including the Health Insurance
>>> Portability
>>> >> > and
>>> >> > > Accountability Act (HIPAA). The message is intended for the sole
>>> use of
>>> >> > the
>>> >> > > individual or entity to whom it is addressed. If you are not the
>>> >> intended
>>> >> > > recipient, you are notified that any use, distribution or copying
>>> of
>>> >> the
>>> >> > > message is strictly prohibited and may subject you to criminal or
>>> civil
>>> >> > > penalties. If you received this transmission in error, please
>>> contact
>>> >> the
>>> >> > > sender immediately by replying to this email and delete the
>>> material
>>> >> from
>>> >> > > any computer.
>>> >> > >
>>> >> >
>>> >>
>>> >> --
>>> >> Email Confidentiality Notice: The information contained in this
>>> >> transmission is confidential, proprietary or privileged and may be
>>> subject
>>> >> to protection under the law, including the Health Insurance
>>> Portability and
>>> >> Accountability Act (HIPAA). The message is intended for the sole use
>>> of the
>>> >> individual or entity to whom it is addressed. If you are not the
>>> intended
>>> >> recipient, you are notified that any use, distribution or copying of
>>> the
>>> >> message is strictly prohibited and may subject you to criminal or civil
>>> >> penalties. If you received this transmission in error, please contact
>>> the
>>> >> sender immediately by replying to this email and delete the material
>>> from
>>> >> any computer.
>>> >>
>>>
>>
>>
>
> --
> Email Confidentiality Notice: The information contained in this
> transmission is confidential, proprietary or privileged and may be subject
> to protection under the law, including the Health Insurance Portability and
> Accountability Act (HIPAA). The message is intended for the sole use of the
> individual or entity to whom it is addressed. If you are not the intended
> recipient, you are notified that any use, distribution or copying of the
> message is strictly prohibited and may subject you to criminal or civil
> penalties. If you received this transmission in error, please contact the
> sender immediately by replying to this email and delete the material from
> any computer.

Re: JSON Webservice... interpreting null as null

Posted by Jonathan Fisher <jo...@springventuregroup.com>.
Also, is there a way to set Moxy as the provider server wide?


*Jonathan Fisher*
*VP - Information Technology*
*Spring Venture Group*
(o) 913-653-8820

On Fri, Sep 12, 2014 at 12:12 PM, Jonathan Fisher <
jonathan@springventuregroup.com> wrote:

> FYI, I tried replacing Jettison with v1.3.5 with the same results.
>
> What jackson jars would I need to parse the json?
>
>
> *Jonathan Fisher*
> *VP - Information Technology*
> *Spring Venture Group*
> (o) 913-653-8820
>
> On Tue, Sep 9, 2014 at 9:18 AM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
>> about jettison: you can drop and replace the jar
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-09-09 15:38 GMT+02:00 Jean-Louis Monteiro <jlmonteiro@tomitribe.com
>> >:
>> > Jettison is the default provider behind Jaxb in CXF.
>> > You can also use Jackson which is more efficient.
>> >
>> > --
>> > Jean-Louis Monteiro
>> > http://twitter.com/jlouismonteiro
>> > http://www.tomitribe.com
>> >
>> > On Tue, Sep 9, 2014 at 3:21 PM, Jonathan Fisher <
>> > jonathan@springventuregroup.com> wrote:
>> >
>> >> Thanks! (as always)
>> >>
>> >> Is there a way too swap Jetison versions? I think we're on 1.6.0.2 in
>> >> prod...
>> >>
>> >> Jonathan S. Fisher
>> >> Spring Venture Group
>> >> Sent on the go; I blame the spelling and grammar mistakes on my phone.
>> >> On Sep 9, 2014 12:00 AM, "Romain Manni-Bucau" <rm...@gmail.com>
>> >> wrote:
>> >>
>> >> > Hi
>> >> >
>> >> > That was jettison behavior. This is fixed with cxf 3.
>> >> >
>> >> > Ps: here is the jira enhancing it
>> >> > https://jira.codehaus.org/plugins/servlet/mobile#issue/JETTISON-126
>> >> >  Le 9 sept. 2014 02:43, "Jonathan Fisher" <
>> >> jonathan@springventuregroup.com
>> >> > >
>> >> > a écrit :
>> >> >
>> >> > > Consider this request:
>> >> > >
>> >> > > {
>> >> > > "call" : {
>> >> > > "type" : "Call",
>> >> > > "subject" : null
>> >> > >  }
>> >> > > }
>> >> > >
>> >> > > This object:
>> >> > >
>> >> > > @XmlRootElement(name = "call")
>> >> > > @XmlAccessorType(XmlAccessType.NONE)
>> >> > > public class ApiCallActivity {
>> >> > > @NotNull
>> >> > > @XmlElement(name = "type")
>> >> > > public String type;
>> >> > >
>> >> > > @Size(min = 1, max = 255)
>> >> > > @XmlElement(name = "subject")
>> >> > > public String subject;
>> >> > > }
>> >> > >
>> >> > > And this webservice:
>> >> > >
>> >> > > @ApplicationScoped
>> >> > > @Path("/")
>> >> > > @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON
>> })
>> >> > > @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON
>> })
>> >> > > public class CallActivityController {
>> >> > > @Inject
>> >> > > private Logger log;
>> >> > > @Inject
>> >> > > private BeanValidator validator;
>> >> > > @EJB
>> >> > > private CallActivityService callActivityService;
>> >> > >
>> >> > > @Path("/")
>> >> > > @POST
>> >> > > public void postCall(ApiCallActivity apiCall) {
>> >> > > log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
>> >> > > apiCall.subject);
>> >> > > }
>> >> > > }
>> >> > >
>> >> > > How come subject is a 0 length string "" not null... like a
>> surprised
>> >> > > individual might discover? Is there a way to make null be null?
>> >> > >
>> >> > >
>> >> > > *Jonathan Fisher*
>> >> > > *VP - Information Technology*
>> >> > > *Spring Venture Group*
>> >> > >
>> >> > > --
>> >> > > Email Confidentiality Notice: The information contained in this
>> >> > > transmission is confidential, proprietary or privileged and may be
>> >> > subject
>> >> > > to protection under the law, including the Health Insurance
>> Portability
>> >> > and
>> >> > > Accountability Act (HIPAA). The message is intended for the sole
>> use of
>> >> > the
>> >> > > individual or entity to whom it is addressed. If you are not the
>> >> intended
>> >> > > recipient, you are notified that any use, distribution or copying
>> of
>> >> the
>> >> > > message is strictly prohibited and may subject you to criminal or
>> civil
>> >> > > penalties. If you received this transmission in error, please
>> contact
>> >> the
>> >> > > sender immediately by replying to this email and delete the
>> material
>> >> from
>> >> > > any computer.
>> >> > >
>> >> >
>> >>
>> >> --
>> >> Email Confidentiality Notice: The information contained in this
>> >> transmission is confidential, proprietary or privileged and may be
>> subject
>> >> to protection under the law, including the Health Insurance
>> Portability and
>> >> Accountability Act (HIPAA). The message is intended for the sole use
>> of the
>> >> individual or entity to whom it is addressed. If you are not the
>> intended
>> >> recipient, you are notified that any use, distribution or copying of
>> the
>> >> message is strictly prohibited and may subject you to criminal or civil
>> >> penalties. If you received this transmission in error, please contact
>> the
>> >> sender immediately by replying to this email and delete the material
>> from
>> >> any computer.
>> >>
>>
>
>

-- 
Email Confidentiality Notice: The information contained in this 
transmission is confidential, proprietary or privileged and may be subject 
to protection under the law, including the Health Insurance Portability and 
Accountability Act (HIPAA). The message is intended for the sole use of the 
individual or entity to whom it is addressed. If you are not the intended 
recipient, you are notified that any use, distribution or copying of the 
message is strictly prohibited and may subject you to criminal or civil 
penalties. If you received this transmission in error, please contact the 
sender immediately by replying to this email and delete the material from 
any computer.

Re: JSON Webservice... interpreting null as null

Posted by Jonathan Fisher <jo...@springventuregroup.com>.
FYI, I tried replacing Jettison with v1.3.5 with the same results.

What jackson jars would I need to parse the json?


*Jonathan Fisher*
*VP - Information Technology*
*Spring Venture Group*
(o) 913-653-8820

On Tue, Sep 9, 2014 at 9:18 AM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> about jettison: you can drop and replace the jar
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-09-09 15:38 GMT+02:00 Jean-Louis Monteiro <jl...@tomitribe.com>:
> > Jettison is the default provider behind Jaxb in CXF.
> > You can also use Jackson which is more efficient.
> >
> > --
> > Jean-Louis Monteiro
> > http://twitter.com/jlouismonteiro
> > http://www.tomitribe.com
> >
> > On Tue, Sep 9, 2014 at 3:21 PM, Jonathan Fisher <
> > jonathan@springventuregroup.com> wrote:
> >
> >> Thanks! (as always)
> >>
> >> Is there a way too swap Jetison versions? I think we're on 1.6.0.2 in
> >> prod...
> >>
> >> Jonathan S. Fisher
> >> Spring Venture Group
> >> Sent on the go; I blame the spelling and grammar mistakes on my phone.
> >> On Sep 9, 2014 12:00 AM, "Romain Manni-Bucau" <rm...@gmail.com>
> >> wrote:
> >>
> >> > Hi
> >> >
> >> > That was jettison behavior. This is fixed with cxf 3.
> >> >
> >> > Ps: here is the jira enhancing it
> >> > https://jira.codehaus.org/plugins/servlet/mobile#issue/JETTISON-126
> >> >  Le 9 sept. 2014 02:43, "Jonathan Fisher" <
> >> jonathan@springventuregroup.com
> >> > >
> >> > a écrit :
> >> >
> >> > > Consider this request:
> >> > >
> >> > > {
> >> > > "call" : {
> >> > > "type" : "Call",
> >> > > "subject" : null
> >> > >  }
> >> > > }
> >> > >
> >> > > This object:
> >> > >
> >> > > @XmlRootElement(name = "call")
> >> > > @XmlAccessorType(XmlAccessType.NONE)
> >> > > public class ApiCallActivity {
> >> > > @NotNull
> >> > > @XmlElement(name = "type")
> >> > > public String type;
> >> > >
> >> > > @Size(min = 1, max = 255)
> >> > > @XmlElement(name = "subject")
> >> > > public String subject;
> >> > > }
> >> > >
> >> > > And this webservice:
> >> > >
> >> > > @ApplicationScoped
> >> > > @Path("/")
> >> > > @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> >> > > @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> >> > > public class CallActivityController {
> >> > > @Inject
> >> > > private Logger log;
> >> > > @Inject
> >> > > private BeanValidator validator;
> >> > > @EJB
> >> > > private CallActivityService callActivityService;
> >> > >
> >> > > @Path("/")
> >> > > @POST
> >> > > public void postCall(ApiCallActivity apiCall) {
> >> > > log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
> >> > > apiCall.subject);
> >> > > }
> >> > > }
> >> > >
> >> > > How come subject is a 0 length string "" not null... like a
> surprised
> >> > > individual might discover? Is there a way to make null be null?
> >> > >
> >> > >
> >> > > *Jonathan Fisher*
> >> > > *VP - Information Technology*
> >> > > *Spring Venture Group*
> >> > >
> >> > > --
> >> > > Email Confidentiality Notice: The information contained in this
> >> > > transmission is confidential, proprietary or privileged and may be
> >> > subject
> >> > > to protection under the law, including the Health Insurance
> Portability
> >> > and
> >> > > Accountability Act (HIPAA). The message is intended for the sole
> use of
> >> > the
> >> > > individual or entity to whom it is addressed. If you are not the
> >> intended
> >> > > recipient, you are notified that any use, distribution or copying of
> >> the
> >> > > message is strictly prohibited and may subject you to criminal or
> civil
> >> > > penalties. If you received this transmission in error, please
> contact
> >> the
> >> > > sender immediately by replying to this email and delete the material
> >> from
> >> > > any computer.
> >> > >
> >> >
> >>
> >> --
> >> Email Confidentiality Notice: The information contained in this
> >> transmission is confidential, proprietary or privileged and may be
> subject
> >> to protection under the law, including the Health Insurance Portability
> and
> >> Accountability Act (HIPAA). The message is intended for the sole use of
> the
> >> individual or entity to whom it is addressed. If you are not the
> intended
> >> recipient, you are notified that any use, distribution or copying of the
> >> message is strictly prohibited and may subject you to criminal or civil
> >> penalties. If you received this transmission in error, please contact
> the
> >> sender immediately by replying to this email and delete the material
> from
> >> any computer.
> >>
>

-- 
Email Confidentiality Notice: The information contained in this 
transmission is confidential, proprietary or privileged and may be subject 
to protection under the law, including the Health Insurance Portability and 
Accountability Act (HIPAA). The message is intended for the sole use of the 
individual or entity to whom it is addressed. If you are not the intended 
recipient, you are notified that any use, distribution or copying of the 
message is strictly prohibited and may subject you to criminal or civil 
penalties. If you received this transmission in error, please contact the 
sender immediately by replying to this email and delete the material from 
any computer.

Re: JSON Webservice... interpreting null as null

Posted by Romain Manni-Bucau <rm...@gmail.com>.
about jettison: you can drop and replace the jar


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-09 15:38 GMT+02:00 Jean-Louis Monteiro <jl...@tomitribe.com>:
> Jettison is the default provider behind Jaxb in CXF.
> You can also use Jackson which is more efficient.
>
> --
> Jean-Louis Monteiro
> http://twitter.com/jlouismonteiro
> http://www.tomitribe.com
>
> On Tue, Sep 9, 2014 at 3:21 PM, Jonathan Fisher <
> jonathan@springventuregroup.com> wrote:
>
>> Thanks! (as always)
>>
>> Is there a way too swap Jetison versions? I think we're on 1.6.0.2 in
>> prod...
>>
>> Jonathan S. Fisher
>> Spring Venture Group
>> Sent on the go; I blame the spelling and grammar mistakes on my phone.
>> On Sep 9, 2014 12:00 AM, "Romain Manni-Bucau" <rm...@gmail.com>
>> wrote:
>>
>> > Hi
>> >
>> > That was jettison behavior. This is fixed with cxf 3.
>> >
>> > Ps: here is the jira enhancing it
>> > https://jira.codehaus.org/plugins/servlet/mobile#issue/JETTISON-126
>> >  Le 9 sept. 2014 02:43, "Jonathan Fisher" <
>> jonathan@springventuregroup.com
>> > >
>> > a écrit :
>> >
>> > > Consider this request:
>> > >
>> > > {
>> > > "call" : {
>> > > "type" : "Call",
>> > > "subject" : null
>> > >  }
>> > > }
>> > >
>> > > This object:
>> > >
>> > > @XmlRootElement(name = "call")
>> > > @XmlAccessorType(XmlAccessType.NONE)
>> > > public class ApiCallActivity {
>> > > @NotNull
>> > > @XmlElement(name = "type")
>> > > public String type;
>> > >
>> > > @Size(min = 1, max = 255)
>> > > @XmlElement(name = "subject")
>> > > public String subject;
>> > > }
>> > >
>> > > And this webservice:
>> > >
>> > > @ApplicationScoped
>> > > @Path("/")
>> > > @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
>> > > @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
>> > > public class CallActivityController {
>> > > @Inject
>> > > private Logger log;
>> > > @Inject
>> > > private BeanValidator validator;
>> > > @EJB
>> > > private CallActivityService callActivityService;
>> > >
>> > > @Path("/")
>> > > @POST
>> > > public void postCall(ApiCallActivity apiCall) {
>> > > log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
>> > > apiCall.subject);
>> > > }
>> > > }
>> > >
>> > > How come subject is a 0 length string "" not null... like a surprised
>> > > individual might discover? Is there a way to make null be null?
>> > >
>> > >
>> > > *Jonathan Fisher*
>> > > *VP - Information Technology*
>> > > *Spring Venture Group*
>> > >
>> > > --
>> > > Email Confidentiality Notice: The information contained in this
>> > > transmission is confidential, proprietary or privileged and may be
>> > subject
>> > > to protection under the law, including the Health Insurance Portability
>> > and
>> > > Accountability Act (HIPAA). The message is intended for the sole use of
>> > the
>> > > individual or entity to whom it is addressed. If you are not the
>> intended
>> > > recipient, you are notified that any use, distribution or copying of
>> the
>> > > message is strictly prohibited and may subject you to criminal or civil
>> > > penalties. If you received this transmission in error, please contact
>> the
>> > > sender immediately by replying to this email and delete the material
>> from
>> > > any computer.
>> > >
>> >
>>
>> --
>> Email Confidentiality Notice: The information contained in this
>> transmission is confidential, proprietary or privileged and may be subject
>> to protection under the law, including the Health Insurance Portability and
>> Accountability Act (HIPAA). The message is intended for the sole use of the
>> individual or entity to whom it is addressed. If you are not the intended
>> recipient, you are notified that any use, distribution or copying of the
>> message is strictly prohibited and may subject you to criminal or civil
>> penalties. If you received this transmission in error, please contact the
>> sender immediately by replying to this email and delete the material from
>> any computer.
>>

Re: JSON Webservice... interpreting null as null

Posted by Jean-Louis Monteiro <jl...@tomitribe.com>.
Jettison is the default provider behind Jaxb in CXF.
You can also use Jackson which is more efficient.

--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com

On Tue, Sep 9, 2014 at 3:21 PM, Jonathan Fisher <
jonathan@springventuregroup.com> wrote:

> Thanks! (as always)
>
> Is there a way too swap Jetison versions? I think we're on 1.6.0.2 in
> prod...
>
> Jonathan S. Fisher
> Spring Venture Group
> Sent on the go; I blame the spelling and grammar mistakes on my phone.
> On Sep 9, 2014 12:00 AM, "Romain Manni-Bucau" <rm...@gmail.com>
> wrote:
>
> > Hi
> >
> > That was jettison behavior. This is fixed with cxf 3.
> >
> > Ps: here is the jira enhancing it
> > https://jira.codehaus.org/plugins/servlet/mobile#issue/JETTISON-126
> >  Le 9 sept. 2014 02:43, "Jonathan Fisher" <
> jonathan@springventuregroup.com
> > >
> > a écrit :
> >
> > > Consider this request:
> > >
> > > {
> > > "call" : {
> > > "type" : "Call",
> > > "subject" : null
> > >  }
> > > }
> > >
> > > This object:
> > >
> > > @XmlRootElement(name = "call")
> > > @XmlAccessorType(XmlAccessType.NONE)
> > > public class ApiCallActivity {
> > > @NotNull
> > > @XmlElement(name = "type")
> > > public String type;
> > >
> > > @Size(min = 1, max = 255)
> > > @XmlElement(name = "subject")
> > > public String subject;
> > > }
> > >
> > > And this webservice:
> > >
> > > @ApplicationScoped
> > > @Path("/")
> > > @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> > > @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> > > public class CallActivityController {
> > > @Inject
> > > private Logger log;
> > > @Inject
> > > private BeanValidator validator;
> > > @EJB
> > > private CallActivityService callActivityService;
> > >
> > > @Path("/")
> > > @POST
> > > public void postCall(ApiCallActivity apiCall) {
> > > log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
> > > apiCall.subject);
> > > }
> > > }
> > >
> > > How come subject is a 0 length string "" not null... like a surprised
> > > individual might discover? Is there a way to make null be null?
> > >
> > >
> > > *Jonathan Fisher*
> > > *VP - Information Technology*
> > > *Spring Venture Group*
> > >
> > > --
> > > Email Confidentiality Notice: The information contained in this
> > > transmission is confidential, proprietary or privileged and may be
> > subject
> > > to protection under the law, including the Health Insurance Portability
> > and
> > > Accountability Act (HIPAA). The message is intended for the sole use of
> > the
> > > individual or entity to whom it is addressed. If you are not the
> intended
> > > recipient, you are notified that any use, distribution or copying of
> the
> > > message is strictly prohibited and may subject you to criminal or civil
> > > penalties. If you received this transmission in error, please contact
> the
> > > sender immediately by replying to this email and delete the material
> from
> > > any computer.
> > >
> >
>
> --
> Email Confidentiality Notice: The information contained in this
> transmission is confidential, proprietary or privileged and may be subject
> to protection under the law, including the Health Insurance Portability and
> Accountability Act (HIPAA). The message is intended for the sole use of the
> individual or entity to whom it is addressed. If you are not the intended
> recipient, you are notified that any use, distribution or copying of the
> message is strictly prohibited and may subject you to criminal or civil
> penalties. If you received this transmission in error, please contact the
> sender immediately by replying to this email and delete the material from
> any computer.
>

Re: JSON Webservice... interpreting null as null

Posted by Jonathan Fisher <jo...@springventuregroup.com>.
Thanks! (as always)

Is there a way too swap Jetison versions? I think we're on 1.6.0.2 in
prod...

Jonathan S. Fisher
Spring Venture Group
Sent on the go; I blame the spelling and grammar mistakes on my phone.
On Sep 9, 2014 12:00 AM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> Hi
>
> That was jettison behavior. This is fixed with cxf 3.
>
> Ps: here is the jira enhancing it
> https://jira.codehaus.org/plugins/servlet/mobile#issue/JETTISON-126
>  Le 9 sept. 2014 02:43, "Jonathan Fisher" <jonathan@springventuregroup.com
> >
> a écrit :
>
> > Consider this request:
> >
> > {
> > "call" : {
> > "type" : "Call",
> > "subject" : null
> >  }
> > }
> >
> > This object:
> >
> > @XmlRootElement(name = "call")
> > @XmlAccessorType(XmlAccessType.NONE)
> > public class ApiCallActivity {
> > @NotNull
> > @XmlElement(name = "type")
> > public String type;
> >
> > @Size(min = 1, max = 255)
> > @XmlElement(name = "subject")
> > public String subject;
> > }
> >
> > And this webservice:
> >
> > @ApplicationScoped
> > @Path("/")
> > @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> > @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> > public class CallActivityController {
> > @Inject
> > private Logger log;
> > @Inject
> > private BeanValidator validator;
> > @EJB
> > private CallActivityService callActivityService;
> >
> > @Path("/")
> > @POST
> > public void postCall(ApiCallActivity apiCall) {
> > log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
> > apiCall.subject);
> > }
> > }
> >
> > How come subject is a 0 length string "" not null... like a surprised
> > individual might discover? Is there a way to make null be null?
> >
> >
> > *Jonathan Fisher*
> > *VP - Information Technology*
> > *Spring Venture Group*
> >
> > --
> > Email Confidentiality Notice: The information contained in this
> > transmission is confidential, proprietary or privileged and may be
> subject
> > to protection under the law, including the Health Insurance Portability
> and
> > Accountability Act (HIPAA). The message is intended for the sole use of
> the
> > individual or entity to whom it is addressed. If you are not the intended
> > recipient, you are notified that any use, distribution or copying of the
> > message is strictly prohibited and may subject you to criminal or civil
> > penalties. If you received this transmission in error, please contact the
> > sender immediately by replying to this email and delete the material from
> > any computer.
> >
>

-- 
Email Confidentiality Notice: The information contained in this 
transmission is confidential, proprietary or privileged and may be subject 
to protection under the law, including the Health Insurance Portability and 
Accountability Act (HIPAA). The message is intended for the sole use of the 
individual or entity to whom it is addressed. If you are not the intended 
recipient, you are notified that any use, distribution or copying of the 
message is strictly prohibited and may subject you to criminal or civil 
penalties. If you received this transmission in error, please contact the 
sender immediately by replying to this email and delete the material from 
any computer.

Re: JSON Webservice... interpreting null as null

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

That was jettison behavior. This is fixed with cxf 3.

Ps: here is the jira enhancing it
https://jira.codehaus.org/plugins/servlet/mobile#issue/JETTISON-126
 Le 9 sept. 2014 02:43, "Jonathan Fisher" <jo...@springventuregroup.com>
a écrit :

> Consider this request:
>
> {
> "call" : {
> "type" : "Call",
> "subject" : null
>  }
> }
>
> This object:
>
> @XmlRootElement(name = "call")
> @XmlAccessorType(XmlAccessType.NONE)
> public class ApiCallActivity {
> @NotNull
> @XmlElement(name = "type")
> public String type;
>
> @Size(min = 1, max = 255)
> @XmlElement(name = "subject")
> public String subject;
> }
>
> And this webservice:
>
> @ApplicationScoped
> @Path("/")
> @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> public class CallActivityController {
> @Inject
> private Logger log;
> @Inject
> private BeanValidator validator;
> @EJB
> private CallActivityService callActivityService;
>
> @Path("/")
> @POST
> public void postCall(ApiCallActivity apiCall) {
> log.info("postCall() apiCall.subject:{}", apiCall == null ? null :
> apiCall.subject);
> }
> }
>
> How come subject is a 0 length string "" not null... like a surprised
> individual might discover? Is there a way to make null be null?
>
>
> *Jonathan Fisher*
> *VP - Information Technology*
> *Spring Venture Group*
>
> --
> Email Confidentiality Notice: The information contained in this
> transmission is confidential, proprietary or privileged and may be subject
> to protection under the law, including the Health Insurance Portability and
> Accountability Act (HIPAA). The message is intended for the sole use of the
> individual or entity to whom it is addressed. If you are not the intended
> recipient, you are notified that any use, distribution or copying of the
> message is strictly prohibited and may subject you to criminal or civil
> penalties. If you received this transmission in error, please contact the
> sender immediately by replying to this email and delete the material from
> any computer.
>