You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Maxim Solodovnik <so...@gmail.com> on 2017/01/26 16:45:22 UTC
Jaxrs provider to serialize outgoing payload
Hello All,
I have implemented custom ParamProvider [1] and set it in jaxrs:server [2]
It works as expected to convert Incoming parameters for example here [3]
But it is not used while writing output JSON :(
adding additional provider as follows
<jaxrs:providers>
<bean id="omParamProvider"
class="org.apache.openmeetings.webservice.util.OmParamConverterProvider"/>
<bean id="jsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="serializeAsArray" value="true"/>
</bean>
</jaxrs:providers>
Also has no effect "serializeAsArray" not working :(
CXF 3.1.9
Thanks in advance
[1]
https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
[2]
https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml#L285
[3]
https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java#L97
--
WBR
Maxim aka solomax
Re: Jaxrs provider to serialize outgoing payload
Posted by Maxim Solodovnik <so...@gmail.com>.
Adding 2 providers (for CustomObject and LIst<CustomObject>) to
<jaxrs:providers>
Works as expected :))
Thanks a lot for the help!
On Fri, Jan 27, 2017 at 12:45 AM, Sergey Beryozkin <sb...@gmail.com>
wrote:
> Hi Max, sorry, I was just about to suggest why it may not work, but yes,
> it should in the providers...
>
> If that does not work, check
>
> https://github.com/apache/cxf/blob/master/rt/frontend/jaxrs/
> src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java#L388
>
> and please create a test project aftfer all :-) if you get stuck, I'll
> have a look though most likely early next week
>
> Thanks, Sergey
>
> On 26/01/17 17:42, Maxim Solodovnik wrote:
>
>> Should I add this bean to <jaxrs:providers> section?
>>
>> WBR, Maxim
>> (from mobile, sorry for the typos)
>>
>> On Jan 27, 2017 00:35, "Maxim Solodovnik" <so...@gmail.com> wrote:
>>
>> MessageBodyWriter<List<AppointmentDTO>> doesn't work :((
>> Can I set breakpoint somewhere to debug this?
>>
>> On Fri, Jan 27, 2017 at 12:30 AM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>>
>> Hi, I won;t have time to investigate it now, but I;d say you'll have to
>>> type it as
>>>
>>> MessageBodyWriter<List<AppointmentDTO>>
>>>
>>> give it a try please
>>>
>>> Cheers, Sergey
>>>
>>> On 26/01/17 17:28, Maxim Solodovnik wrote:
>>>
>>> Sure,
>>>>
>>>> Here is the service/method: [1]
>>>> It is annotated with
>>>> @Produces({MediaType.APPLICATION_JSON})
>>>>
>>>> Method returns List<AppointmentDTO>
>>>>
>>>> Body writer is declared as follows:
>>>>
>>>> @Provider
>>>> @Produces({MediaType.APPLICATION_JSON})
>>>> public class AppointmentMessageBodyWriter implements
>>>> MessageBodyWriter<AppointmentDTO> {
>>>>
>>>> I can commit it and send the link to the github if it helps ....
>>>>
>>>> [1]
>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>> gs-webservice/src/main/java/org/apache/openmeetings/webservi
>>>> ce/CalendarWebService.java#L97
>>>>
>>>> On Fri, Jan 27, 2017 at 12:24 AM, Sergey Beryozkin <
>>>> sberyozkin@gmail.com>
>>>> wrote:
>>>>
>>>> It may not be selected, depends on what type is returned, what media
>>>> type
>>>>
>>>>> is set as a response content type, can you provide more info ?
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> On 26/01/17 17:19, Maxim Solodovnik wrote:
>>>>>
>>>>> I have added following bean to my Spring config:
>>>>>
>>>>>> <bean id="appointmentAppointmentMessageBodyWriter"
>>>>>> class="org.apache.openmeetings.webservice.util.AppointmentMe
>>>>>> ssageBodyWriter"
>>>>>> />
>>>>>>
>>>>>> And non of it's methods were called :(
>>>>>> Am I missing any specific configuration?
>>>>>>
>>>>>> On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <
>>>>>> sberyozkin@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> Yes, ParamConverter works out only on the client side and in only on
>>>>>> the
>>>>>>
>>>>>> server side, it is dedicated to a simple conversion of request URI or
>>>>>>> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
>>>>>>> HeaderParam) only
>>>>>>>
>>>>>>>
>>>>>>> Cheers, Sergey
>>>>>>>
>>>>>>> On 26/01/17 17:05, Maxim Solodovnik wrote:
>>>>>>>
>>>>>>> So I need to create the class like this:
>>>>>>>
>>>>>>> http://memorynotfound.com/jax-rs-messagebodywriter/
>>>>>>>> And add it as spring bean and it will handle output?
>>>>>>>>
>>>>>>>> Why I was thought ParamConverter should convert to both sides: it
>>>>>>>> has
>>>>>>>> 2
>>>>>>>> methods: fromString and toString ....
>>>>>>>>
>>>>>>>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <
>>>>>>>> sberyozkin@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi Max
>>>>>>>>
>>>>>>>>
>>>>>>>> This provider only affect the input parameters, what is returned
>>>>>>>>> from a
>>>>>>>>> method is technically a message hence MessageBodyWriter is
>>>>>>>>> responsible
>>>>>>>>> for
>>>>>>>>> writing it and MessageBodyReader - for reading it.
>>>>>>>>>
>>>>>>>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>>>>>>>> parameter which represents the body, again, it will be MBR which
>>>>>>>>> will
>>>>>>>>> read
>>>>>>>>> it.
>>>>>>>>>
>>>>>>>>> ParamConverterProvider can be used on the client side to convert
>>>>>>>>> the
>>>>>>>>> parameters in the out flow
>>>>>>>>>
>>>>>>>>> HTH, Sergey
>>>>>>>>>
>>>>>>>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>>>>>>>
>>>>>>>>> Hello All,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I have implemented custom ParamProvider [1] and set it in
>>>>>>>>>> jaxrs:server
>>>>>>>>>> [2]
>>>>>>>>>> It works as expected to convert Incoming parameters for example
>>>>>>>>>> here
>>>>>>>>>> [3]
>>>>>>>>>> But it is not used while writing output JSON :(
>>>>>>>>>>
>>>>>>>>>> adding additional provider as follows
>>>>>>>>>> <jaxrs:providers>
>>>>>>>>>> <bean id="omParamProvider"
>>>>>>>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>>>>>>>> terProvider"/>
>>>>>>>>>> <bean id="jsonProvider"
>>>>>>>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>>>>>> <property name="serializeAsArray" value="true"/>
>>>>>>>>>> </bean>
>>>>>>>>>> </jaxrs:providers>
>>>>>>>>>>
>>>>>>>>>> Also has no effect "serializeAsArray" not working :(
>>>>>>>>>> CXF 3.1.9
>>>>>>>>>>
>>>>>>>>>> Thanks in advance
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>>>> webservice/util/OmParamConverterProvider.java
>>>>>>>>>> [2]
>>>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>>>>>>>> cationContext.xml#L285
>>>>>>>>>> [3]
>>>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>>>> webservice/CalendarWebService.java#L97
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Sergey Beryozkin
>>>>>>>>>
>>>>>>>>> Talend Community Coders
>>>>>>>>> http://coders.talend.com/
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>> Sergey Beryozkin
>>>>>>>
>>>>>>> Talend Community Coders
>>>>>>> http://coders.talend.com/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>>
>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
--
WBR
Maxim aka solomax
Re: Jaxrs provider to serialize outgoing payload
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Max, sorry, I was just about to suggest why it may not work, but yes,
it should in the providers...
If that does not work, check
https://github.com/apache/cxf/blob/master/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java#L388
and please create a test project aftfer all :-) if you get stuck, I'll
have a look though most likely early next week
Thanks, Sergey
On 26/01/17 17:42, Maxim Solodovnik wrote:
> Should I add this bean to <jaxrs:providers> section?
>
> WBR, Maxim
> (from mobile, sorry for the typos)
>
> On Jan 27, 2017 00:35, "Maxim Solodovnik" <so...@gmail.com> wrote:
>
> MessageBodyWriter<List<AppointmentDTO>> doesn't work :((
> Can I set breakpoint somewhere to debug this?
>
> On Fri, Jan 27, 2017 at 12:30 AM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
>
>> Hi, I won;t have time to investigate it now, but I;d say you'll have to
>> type it as
>>
>> MessageBodyWriter<List<AppointmentDTO>>
>>
>> give it a try please
>>
>> Cheers, Sergey
>>
>> On 26/01/17 17:28, Maxim Solodovnik wrote:
>>
>>> Sure,
>>>
>>> Here is the service/method: [1]
>>> It is annotated with
>>> @Produces({MediaType.APPLICATION_JSON})
>>>
>>> Method returns List<AppointmentDTO>
>>>
>>> Body writer is declared as follows:
>>>
>>> @Provider
>>> @Produces({MediaType.APPLICATION_JSON})
>>> public class AppointmentMessageBodyWriter implements
>>> MessageBodyWriter<AppointmentDTO> {
>>>
>>> I can commit it and send the link to the github if it helps ....
>>>
>>> [1]
>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>> gs-webservice/src/main/java/org/apache/openmeetings/webservi
>>> ce/CalendarWebService.java#L97
>>>
>>> On Fri, Jan 27, 2017 at 12:24 AM, Sergey Beryozkin <sb...@gmail.com>
>>> wrote:
>>>
>>> It may not be selected, depends on what type is returned, what media type
>>>> is set as a response content type, can you provide more info ?
>>>>
>>>> Cheers, Sergey
>>>>
>>>> On 26/01/17 17:19, Maxim Solodovnik wrote:
>>>>
>>>> I have added following bean to my Spring config:
>>>>> <bean id="appointmentAppointmentMessageBodyWriter"
>>>>> class="org.apache.openmeetings.webservice.util.AppointmentMe
>>>>> ssageBodyWriter"
>>>>> />
>>>>>
>>>>> And non of it's methods were called :(
>>>>> Am I missing any specific configuration?
>>>>>
>>>>> On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <
>>>>> sberyozkin@gmail.com>
>>>>> wrote:
>>>>>
>>>>> Yes, ParamConverter works out only on the client side and in only on the
>>>>>
>>>>>> server side, it is dedicated to a simple conversion of request URI or
>>>>>> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
>>>>>> HeaderParam) only
>>>>>>
>>>>>>
>>>>>> Cheers, Sergey
>>>>>>
>>>>>> On 26/01/17 17:05, Maxim Solodovnik wrote:
>>>>>>
>>>>>> So I need to create the class like this:
>>>>>>
>>>>>>> http://memorynotfound.com/jax-rs-messagebodywriter/
>>>>>>> And add it as spring bean and it will handle output?
>>>>>>>
>>>>>>> Why I was thought ParamConverter should convert to both sides: it has
>>>>>>> 2
>>>>>>> methods: fromString and toString ....
>>>>>>>
>>>>>>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <
>>>>>>> sberyozkin@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> Hi Max
>>>>>>>
>>>>>>>
>>>>>>>> This provider only affect the input parameters, what is returned
>>>>>>>> from a
>>>>>>>> method is technically a message hence MessageBodyWriter is
>>>>>>>> responsible
>>>>>>>> for
>>>>>>>> writing it and MessageBodyReader - for reading it.
>>>>>>>>
>>>>>>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>>>>>>> parameter which represents the body, again, it will be MBR which will
>>>>>>>> read
>>>>>>>> it.
>>>>>>>>
>>>>>>>> ParamConverterProvider can be used on the client side to convert the
>>>>>>>> parameters in the out flow
>>>>>>>>
>>>>>>>> HTH, Sergey
>>>>>>>>
>>>>>>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>>>>>>
>>>>>>>> Hello All,
>>>>>>>>
>>>>>>>>
>>>>>>>>> I have implemented custom ParamProvider [1] and set it in
>>>>>>>>> jaxrs:server
>>>>>>>>> [2]
>>>>>>>>> It works as expected to convert Incoming parameters for example here
>>>>>>>>> [3]
>>>>>>>>> But it is not used while writing output JSON :(
>>>>>>>>>
>>>>>>>>> adding additional provider as follows
>>>>>>>>> <jaxrs:providers>
>>>>>>>>> <bean id="omParamProvider"
>>>>>>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>>>>>>> terProvider"/>
>>>>>>>>> <bean id="jsonProvider"
>>>>>>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>>>>> <property name="serializeAsArray" value="true"/>
>>>>>>>>> </bean>
>>>>>>>>> </jaxrs:providers>
>>>>>>>>>
>>>>>>>>> Also has no effect "serializeAsArray" not working :(
>>>>>>>>> CXF 3.1.9
>>>>>>>>>
>>>>>>>>> Thanks in advance
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [1]
>>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>>> webservice/util/OmParamConverterProvider.java
>>>>>>>>> [2]
>>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>>>>>>> cationContext.xml#L285
>>>>>>>>> [3]
>>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>>> webservice/CalendarWebService.java#L97
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>> Sergey Beryozkin
>>>>>>>>
>>>>>>>> Talend Community Coders
>>>>>>>> http://coders.talend.com/
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>> Sergey Beryozkin
>>>>>>
>>>>>> Talend Community Coders
>>>>>> http://coders.talend.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Jaxrs provider to serialize outgoing payload
Posted by Maxim Solodovnik <so...@gmail.com>.
Should I add this bean to <jaxrs:providers> section?
WBR, Maxim
(from mobile, sorry for the typos)
On Jan 27, 2017 00:35, "Maxim Solodovnik" <so...@gmail.com> wrote:
MessageBodyWriter<List<AppointmentDTO>> doesn't work :((
Can I set breakpoint somewhere to debug this?
On Fri, Jan 27, 2017 at 12:30 AM, Sergey Beryozkin <sb...@gmail.com>
wrote:
> Hi, I won;t have time to investigate it now, but I;d say you'll have to
> type it as
>
> MessageBodyWriter<List<AppointmentDTO>>
>
> give it a try please
>
> Cheers, Sergey
>
> On 26/01/17 17:28, Maxim Solodovnik wrote:
>
>> Sure,
>>
>> Here is the service/method: [1]
>> It is annotated with
>> @Produces({MediaType.APPLICATION_JSON})
>>
>> Method returns List<AppointmentDTO>
>>
>> Body writer is declared as follows:
>>
>> @Provider
>> @Produces({MediaType.APPLICATION_JSON})
>> public class AppointmentMessageBodyWriter implements
>> MessageBodyWriter<AppointmentDTO> {
>>
>> I can commit it and send the link to the github if it helps ....
>>
>> [1]
>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>> gs-webservice/src/main/java/org/apache/openmeetings/webservi
>> ce/CalendarWebService.java#L97
>>
>> On Fri, Jan 27, 2017 at 12:24 AM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>>
>> It may not be selected, depends on what type is returned, what media type
>>> is set as a response content type, can you provide more info ?
>>>
>>> Cheers, Sergey
>>>
>>> On 26/01/17 17:19, Maxim Solodovnik wrote:
>>>
>>> I have added following bean to my Spring config:
>>>> <bean id="appointmentAppointmentMessageBodyWriter"
>>>> class="org.apache.openmeetings.webservice.util.AppointmentMe
>>>> ssageBodyWriter"
>>>> />
>>>>
>>>> And non of it's methods were called :(
>>>> Am I missing any specific configuration?
>>>>
>>>> On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <
>>>> sberyozkin@gmail.com>
>>>> wrote:
>>>>
>>>> Yes, ParamConverter works out only on the client side and in only on the
>>>>
>>>>> server side, it is dedicated to a simple conversion of request URI or
>>>>> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
>>>>> HeaderParam) only
>>>>>
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> On 26/01/17 17:05, Maxim Solodovnik wrote:
>>>>>
>>>>> So I need to create the class like this:
>>>>>
>>>>>> http://memorynotfound.com/jax-rs-messagebodywriter/
>>>>>> And add it as spring bean and it will handle output?
>>>>>>
>>>>>> Why I was thought ParamConverter should convert to both sides: it has
>>>>>> 2
>>>>>> methods: fromString and toString ....
>>>>>>
>>>>>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <
>>>>>> sberyozkin@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> Hi Max
>>>>>>
>>>>>>
>>>>>>> This provider only affect the input parameters, what is returned
>>>>>>> from a
>>>>>>> method is technically a message hence MessageBodyWriter is
>>>>>>> responsible
>>>>>>> for
>>>>>>> writing it and MessageBodyReader - for reading it.
>>>>>>>
>>>>>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>>>>>> parameter which represents the body, again, it will be MBR which will
>>>>>>> read
>>>>>>> it.
>>>>>>>
>>>>>>> ParamConverterProvider can be used on the client side to convert the
>>>>>>> parameters in the out flow
>>>>>>>
>>>>>>> HTH, Sergey
>>>>>>>
>>>>>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>>>>>
>>>>>>> Hello All,
>>>>>>>
>>>>>>>
>>>>>>>> I have implemented custom ParamProvider [1] and set it in
>>>>>>>> jaxrs:server
>>>>>>>> [2]
>>>>>>>> It works as expected to convert Incoming parameters for example here
>>>>>>>> [3]
>>>>>>>> But it is not used while writing output JSON :(
>>>>>>>>
>>>>>>>> adding additional provider as follows
>>>>>>>> <jaxrs:providers>
>>>>>>>> <bean id="omParamProvider"
>>>>>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>>>>>> terProvider"/>
>>>>>>>> <bean id="jsonProvider"
>>>>>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>>>> <property name="serializeAsArray" value="true"/>
>>>>>>>> </bean>
>>>>>>>> </jaxrs:providers>
>>>>>>>>
>>>>>>>> Also has no effect "serializeAsArray" not working :(
>>>>>>>> CXF 3.1.9
>>>>>>>>
>>>>>>>> Thanks in advance
>>>>>>>>
>>>>>>>>
>>>>>>>> [1]
>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>> webservice/util/OmParamConverterProvider.java
>>>>>>>> [2]
>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>>>>>> cationContext.xml#L285
>>>>>>>> [3]
>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>> webservice/CalendarWebService.java#L97
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>> Sergey Beryozkin
>>>>>>>
>>>>>>> Talend Community Coders
>>>>>>> http://coders.talend.com/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>> Sergey Beryozkin
>>>>>
>>>>> Talend Community Coders
>>>>> http://coders.talend.com/
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
--
WBR
Maxim aka solomax
Re: Jaxrs provider to serialize outgoing payload
Posted by Maxim Solodovnik <so...@gmail.com>.
MessageBodyWriter<List<AppointmentDTO>> doesn't work :((
Can I set breakpoint somewhere to debug this?
On Fri, Jan 27, 2017 at 12:30 AM, Sergey Beryozkin <sb...@gmail.com>
wrote:
> Hi, I won;t have time to investigate it now, but I;d say you'll have to
> type it as
>
> MessageBodyWriter<List<AppointmentDTO>>
>
> give it a try please
>
> Cheers, Sergey
>
> On 26/01/17 17:28, Maxim Solodovnik wrote:
>
>> Sure,
>>
>> Here is the service/method: [1]
>> It is annotated with
>> @Produces({MediaType.APPLICATION_JSON})
>>
>> Method returns List<AppointmentDTO>
>>
>> Body writer is declared as follows:
>>
>> @Provider
>> @Produces({MediaType.APPLICATION_JSON})
>> public class AppointmentMessageBodyWriter implements
>> MessageBodyWriter<AppointmentDTO> {
>>
>> I can commit it and send the link to the github if it helps ....
>>
>> [1]
>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>> gs-webservice/src/main/java/org/apache/openmeetings/
>> webservice/CalendarWebService.java#L97
>>
>> On Fri, Jan 27, 2017 at 12:24 AM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>>
>> It may not be selected, depends on what type is returned, what media type
>>> is set as a response content type, can you provide more info ?
>>>
>>> Cheers, Sergey
>>>
>>> On 26/01/17 17:19, Maxim Solodovnik wrote:
>>>
>>> I have added following bean to my Spring config:
>>>> <bean id="appointmentAppointmentMessageBodyWriter"
>>>> class="org.apache.openmeetings.webservice.util.AppointmentMe
>>>> ssageBodyWriter"
>>>> />
>>>>
>>>> And non of it's methods were called :(
>>>> Am I missing any specific configuration?
>>>>
>>>> On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <
>>>> sberyozkin@gmail.com>
>>>> wrote:
>>>>
>>>> Yes, ParamConverter works out only on the client side and in only on the
>>>>
>>>>> server side, it is dedicated to a simple conversion of request URI or
>>>>> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
>>>>> HeaderParam) only
>>>>>
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> On 26/01/17 17:05, Maxim Solodovnik wrote:
>>>>>
>>>>> So I need to create the class like this:
>>>>>
>>>>>> http://memorynotfound.com/jax-rs-messagebodywriter/
>>>>>> And add it as spring bean and it will handle output?
>>>>>>
>>>>>> Why I was thought ParamConverter should convert to both sides: it has
>>>>>> 2
>>>>>> methods: fromString and toString ....
>>>>>>
>>>>>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <
>>>>>> sberyozkin@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> Hi Max
>>>>>>
>>>>>>
>>>>>>> This provider only affect the input parameters, what is returned
>>>>>>> from a
>>>>>>> method is technically a message hence MessageBodyWriter is
>>>>>>> responsible
>>>>>>> for
>>>>>>> writing it and MessageBodyReader - for reading it.
>>>>>>>
>>>>>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>>>>>> parameter which represents the body, again, it will be MBR which will
>>>>>>> read
>>>>>>> it.
>>>>>>>
>>>>>>> ParamConverterProvider can be used on the client side to convert the
>>>>>>> parameters in the out flow
>>>>>>>
>>>>>>> HTH, Sergey
>>>>>>>
>>>>>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>>>>>
>>>>>>> Hello All,
>>>>>>>
>>>>>>>
>>>>>>>> I have implemented custom ParamProvider [1] and set it in
>>>>>>>> jaxrs:server
>>>>>>>> [2]
>>>>>>>> It works as expected to convert Incoming parameters for example here
>>>>>>>> [3]
>>>>>>>> But it is not used while writing output JSON :(
>>>>>>>>
>>>>>>>> adding additional provider as follows
>>>>>>>> <jaxrs:providers>
>>>>>>>> <bean id="omParamProvider"
>>>>>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>>>>>> terProvider"/>
>>>>>>>> <bean id="jsonProvider"
>>>>>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>>>> <property name="serializeAsArray" value="true"/>
>>>>>>>> </bean>
>>>>>>>> </jaxrs:providers>
>>>>>>>>
>>>>>>>> Also has no effect "serializeAsArray" not working :(
>>>>>>>> CXF 3.1.9
>>>>>>>>
>>>>>>>> Thanks in advance
>>>>>>>>
>>>>>>>>
>>>>>>>> [1]
>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>> webservice/util/OmParamConverterProvider.java
>>>>>>>> [2]
>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>>>>>> cationContext.xml#L285
>>>>>>>> [3]
>>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>>> webservice/CalendarWebService.java#L97
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>> Sergey Beryozkin
>>>>>>>
>>>>>>> Talend Community Coders
>>>>>>> http://coders.talend.com/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>> Sergey Beryozkin
>>>>>
>>>>> Talend Community Coders
>>>>> http://coders.talend.com/
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
--
WBR
Maxim aka solomax
Re: Jaxrs provider to serialize outgoing payload
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi, I won;t have time to investigate it now, but I;d say you'll have to
type it as
MessageBodyWriter<List<AppointmentDTO>>
give it a try please
Cheers, Sergey
On 26/01/17 17:28, Maxim Solodovnik wrote:
> Sure,
>
> Here is the service/method: [1]
> It is annotated with
> @Produces({MediaType.APPLICATION_JSON})
>
> Method returns List<AppointmentDTO>
>
> Body writer is declared as follows:
>
> @Provider
> @Produces({MediaType.APPLICATION_JSON})
> public class AppointmentMessageBodyWriter implements
> MessageBodyWriter<AppointmentDTO> {
>
> I can commit it and send the link to the github if it helps ....
>
> [1]
> https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java#L97
>
> On Fri, Jan 27, 2017 at 12:24 AM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
>
>> It may not be selected, depends on what type is returned, what media type
>> is set as a response content type, can you provide more info ?
>>
>> Cheers, Sergey
>>
>> On 26/01/17 17:19, Maxim Solodovnik wrote:
>>
>>> I have added following bean to my Spring config:
>>> <bean id="appointmentAppointmentMessageBodyWriter"
>>> class="org.apache.openmeetings.webservice.util.AppointmentMe
>>> ssageBodyWriter"
>>> />
>>>
>>> And non of it's methods were called :(
>>> Am I missing any specific configuration?
>>>
>>> On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <sb...@gmail.com>
>>> wrote:
>>>
>>> Yes, ParamConverter works out only on the client side and in only on the
>>>> server side, it is dedicated to a simple conversion of request URI or
>>>> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
>>>> HeaderParam) only
>>>>
>>>>
>>>> Cheers, Sergey
>>>>
>>>> On 26/01/17 17:05, Maxim Solodovnik wrote:
>>>>
>>>> So I need to create the class like this:
>>>>> http://memorynotfound.com/jax-rs-messagebodywriter/
>>>>> And add it as spring bean and it will handle output?
>>>>>
>>>>> Why I was thought ParamConverter should convert to both sides: it has 2
>>>>> methods: fromString and toString ....
>>>>>
>>>>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <
>>>>> sberyozkin@gmail.com>
>>>>> wrote:
>>>>>
>>>>> Hi Max
>>>>>
>>>>>>
>>>>>> This provider only affect the input parameters, what is returned from a
>>>>>> method is technically a message hence MessageBodyWriter is responsible
>>>>>> for
>>>>>> writing it and MessageBodyReader - for reading it.
>>>>>>
>>>>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>>>>> parameter which represents the body, again, it will be MBR which will
>>>>>> read
>>>>>> it.
>>>>>>
>>>>>> ParamConverterProvider can be used on the client side to convert the
>>>>>> parameters in the out flow
>>>>>>
>>>>>> HTH, Sergey
>>>>>>
>>>>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>>>>
>>>>>> Hello All,
>>>>>>
>>>>>>>
>>>>>>> I have implemented custom ParamProvider [1] and set it in jaxrs:server
>>>>>>> [2]
>>>>>>> It works as expected to convert Incoming parameters for example here
>>>>>>> [3]
>>>>>>> But it is not used while writing output JSON :(
>>>>>>>
>>>>>>> adding additional provider as follows
>>>>>>> <jaxrs:providers>
>>>>>>> <bean id="omParamProvider"
>>>>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>>>>> terProvider"/>
>>>>>>> <bean id="jsonProvider"
>>>>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>>> <property name="serializeAsArray" value="true"/>
>>>>>>> </bean>
>>>>>>> </jaxrs:providers>
>>>>>>>
>>>>>>> Also has no effect "serializeAsArray" not working :(
>>>>>>> CXF 3.1.9
>>>>>>>
>>>>>>> Thanks in advance
>>>>>>>
>>>>>>>
>>>>>>> [1]
>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>> webservice/util/OmParamConverterProvider.java
>>>>>>> [2]
>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>>>>> cationContext.xml#L285
>>>>>>> [3]
>>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>>> webservice/CalendarWebService.java#L97
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>> Sergey Beryozkin
>>>>>>
>>>>>> Talend Community Coders
>>>>>> http://coders.talend.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Sergey Beryozkin
>>>>
>>>> Talend Community Coders
>>>> http://coders.talend.com/
>>>>
>>>>
>>>
>>>
>>>
>>
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Jaxrs provider to serialize outgoing payload
Posted by Maxim Solodovnik <so...@gmail.com>.
Sure,
Here is the service/method: [1]
It is annotated with
@Produces({MediaType.APPLICATION_JSON})
Method returns List<AppointmentDTO>
Body writer is declared as follows:
@Provider
@Produces({MediaType.APPLICATION_JSON})
public class AppointmentMessageBodyWriter implements
MessageBodyWriter<AppointmentDTO> {
I can commit it and send the link to the github if it helps ....
[1]
https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java#L97
On Fri, Jan 27, 2017 at 12:24 AM, Sergey Beryozkin <sb...@gmail.com>
wrote:
> It may not be selected, depends on what type is returned, what media type
> is set as a response content type, can you provide more info ?
>
> Cheers, Sergey
>
> On 26/01/17 17:19, Maxim Solodovnik wrote:
>
>> I have added following bean to my Spring config:
>> <bean id="appointmentAppointmentMessageBodyWriter"
>> class="org.apache.openmeetings.webservice.util.AppointmentMe
>> ssageBodyWriter"
>> />
>>
>> And non of it's methods were called :(
>> Am I missing any specific configuration?
>>
>> On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>>
>> Yes, ParamConverter works out only on the client side and in only on the
>>> server side, it is dedicated to a simple conversion of request URI or
>>> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
>>> HeaderParam) only
>>>
>>>
>>> Cheers, Sergey
>>>
>>> On 26/01/17 17:05, Maxim Solodovnik wrote:
>>>
>>> So I need to create the class like this:
>>>> http://memorynotfound.com/jax-rs-messagebodywriter/
>>>> And add it as spring bean and it will handle output?
>>>>
>>>> Why I was thought ParamConverter should convert to both sides: it has 2
>>>> methods: fromString and toString ....
>>>>
>>>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <
>>>> sberyozkin@gmail.com>
>>>> wrote:
>>>>
>>>> Hi Max
>>>>
>>>>>
>>>>> This provider only affect the input parameters, what is returned from a
>>>>> method is technically a message hence MessageBodyWriter is responsible
>>>>> for
>>>>> writing it and MessageBodyReader - for reading it.
>>>>>
>>>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>>>> parameter which represents the body, again, it will be MBR which will
>>>>> read
>>>>> it.
>>>>>
>>>>> ParamConverterProvider can be used on the client side to convert the
>>>>> parameters in the out flow
>>>>>
>>>>> HTH, Sergey
>>>>>
>>>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>>>
>>>>> Hello All,
>>>>>
>>>>>>
>>>>>> I have implemented custom ParamProvider [1] and set it in jaxrs:server
>>>>>> [2]
>>>>>> It works as expected to convert Incoming parameters for example here
>>>>>> [3]
>>>>>> But it is not used while writing output JSON :(
>>>>>>
>>>>>> adding additional provider as follows
>>>>>> <jaxrs:providers>
>>>>>> <bean id="omParamProvider"
>>>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>>>> terProvider"/>
>>>>>> <bean id="jsonProvider"
>>>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>> <property name="serializeAsArray" value="true"/>
>>>>>> </bean>
>>>>>> </jaxrs:providers>
>>>>>>
>>>>>> Also has no effect "serializeAsArray" not working :(
>>>>>> CXF 3.1.9
>>>>>>
>>>>>> Thanks in advance
>>>>>>
>>>>>>
>>>>>> [1]
>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>> webservice/util/OmParamConverterProvider.java
>>>>>> [2]
>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>>>> cationContext.xml#L285
>>>>>> [3]
>>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>>> webservice/CalendarWebService.java#L97
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>> Sergey Beryozkin
>>>>>
>>>>> Talend Community Coders
>>>>> http://coders.talend.com/
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>>
>>
>>
>>
>
--
WBR
Maxim aka solomax
Re: Jaxrs provider to serialize outgoing payload
Posted by Sergey Beryozkin <sb...@gmail.com>.
It may not be selected, depends on what type is returned, what media
type is set as a response content type, can you provide more info ?
Cheers, Sergey
On 26/01/17 17:19, Maxim Solodovnik wrote:
> I have added following bean to my Spring config:
> <bean id="appointmentAppointmentMessageBodyWriter"
> class="org.apache.openmeetings.webservice.util.AppointmentMessageBodyWriter"
> />
>
> And non of it's methods were called :(
> Am I missing any specific configuration?
>
> On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
>
>> Yes, ParamConverter works out only on the client side and in only on the
>> server side, it is dedicated to a simple conversion of request URI or
>> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
>> HeaderParam) only
>>
>>
>> Cheers, Sergey
>>
>> On 26/01/17 17:05, Maxim Solodovnik wrote:
>>
>>> So I need to create the class like this:
>>> http://memorynotfound.com/jax-rs-messagebodywriter/
>>> And add it as spring bean and it will handle output?
>>>
>>> Why I was thought ParamConverter should convert to both sides: it has 2
>>> methods: fromString and toString ....
>>>
>>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <sb...@gmail.com>
>>> wrote:
>>>
>>> Hi Max
>>>>
>>>> This provider only affect the input parameters, what is returned from a
>>>> method is technically a message hence MessageBodyWriter is responsible
>>>> for
>>>> writing it and MessageBodyReader - for reading it.
>>>>
>>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>>> parameter which represents the body, again, it will be MBR which will
>>>> read
>>>> it.
>>>>
>>>> ParamConverterProvider can be used on the client side to convert the
>>>> parameters in the out flow
>>>>
>>>> HTH, Sergey
>>>>
>>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>>
>>>> Hello All,
>>>>>
>>>>> I have implemented custom ParamProvider [1] and set it in jaxrs:server
>>>>> [2]
>>>>> It works as expected to convert Incoming parameters for example here [3]
>>>>> But it is not used while writing output JSON :(
>>>>>
>>>>> adding additional provider as follows
>>>>> <jaxrs:providers>
>>>>> <bean id="omParamProvider"
>>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>>> terProvider"/>
>>>>> <bean id="jsonProvider"
>>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>> <property name="serializeAsArray" value="true"/>
>>>>> </bean>
>>>>> </jaxrs:providers>
>>>>>
>>>>> Also has no effect "serializeAsArray" not working :(
>>>>> CXF 3.1.9
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>>
>>>>> [1]
>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>> webservice/util/OmParamConverterProvider.java
>>>>> [2]
>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>>> cationContext.xml#L285
>>>>> [3]
>>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>>> webservice/CalendarWebService.java#L97
>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Sergey Beryozkin
>>>>
>>>> Talend Community Coders
>>>> http://coders.talend.com/
>>>>
>>>>
>>>
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>
>
>
Re: Jaxrs provider to serialize outgoing payload
Posted by Maxim Solodovnik <so...@gmail.com>.
I have added following bean to my Spring config:
<bean id="appointmentAppointmentMessageBodyWriter"
class="org.apache.openmeetings.webservice.util.AppointmentMessageBodyWriter"
/>
And non of it's methods were called :(
Am I missing any specific configuration?
On Fri, Jan 27, 2017 at 12:12 AM, Sergey Beryozkin <sb...@gmail.com>
wrote:
> Yes, ParamConverter works out only on the client side and in only on the
> server side, it is dedicated to a simple conversion of request URI or
> header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
> HeaderParam) only
>
>
> Cheers, Sergey
>
> On 26/01/17 17:05, Maxim Solodovnik wrote:
>
>> So I need to create the class like this:
>> http://memorynotfound.com/jax-rs-messagebodywriter/
>> And add it as spring bean and it will handle output?
>>
>> Why I was thought ParamConverter should convert to both sides: it has 2
>> methods: fromString and toString ....
>>
>> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>>
>> Hi Max
>>>
>>> This provider only affect the input parameters, what is returned from a
>>> method is technically a message hence MessageBodyWriter is responsible
>>> for
>>> writing it and MessageBodyReader - for reading it.
>>>
>>> ParamConverterProvider only supports PathParam, etc, but not the in
>>> parameter which represents the body, again, it will be MBR which will
>>> read
>>> it.
>>>
>>> ParamConverterProvider can be used on the client side to convert the
>>> parameters in the out flow
>>>
>>> HTH, Sergey
>>>
>>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>>
>>> Hello All,
>>>>
>>>> I have implemented custom ParamProvider [1] and set it in jaxrs:server
>>>> [2]
>>>> It works as expected to convert Incoming parameters for example here [3]
>>>> But it is not used while writing output JSON :(
>>>>
>>>> adding additional provider as follows
>>>> <jaxrs:providers>
>>>> <bean id="omParamProvider"
>>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>>> terProvider"/>
>>>> <bean id="jsonProvider"
>>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>> <property name="serializeAsArray" value="true"/>
>>>> </bean>
>>>> </jaxrs:providers>
>>>>
>>>> Also has no effect "serializeAsArray" not working :(
>>>> CXF 3.1.9
>>>>
>>>> Thanks in advance
>>>>
>>>>
>>>> [1]
>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>> webservice/util/OmParamConverterProvider.java
>>>> [2]
>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>>> cationContext.xml#L285
>>>> [3]
>>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>>> webservice/CalendarWebService.java#L97
>>>>
>>>>
>>>>
>>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>>
>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
--
WBR
Maxim aka solomax
Re: Jaxrs provider to serialize outgoing payload
Posted by Sergey Beryozkin <sb...@gmail.com>.
Yes, ParamConverter works out only on the client side and in only on the
server side, it is dedicated to a simple conversion of request URI or
header parameters (@PathParam, QueryParam, MatrixParam, Cookie,
HeaderParam) only
Cheers, Sergey
On 26/01/17 17:05, Maxim Solodovnik wrote:
> So I need to create the class like this:
> http://memorynotfound.com/jax-rs-messagebodywriter/
> And add it as spring bean and it will handle output?
>
> Why I was thought ParamConverter should convert to both sides: it has 2
> methods: fromString and toString ....
>
> On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
>
>> Hi Max
>>
>> This provider only affect the input parameters, what is returned from a
>> method is technically a message hence MessageBodyWriter is responsible for
>> writing it and MessageBodyReader - for reading it.
>>
>> ParamConverterProvider only supports PathParam, etc, but not the in
>> parameter which represents the body, again, it will be MBR which will read
>> it.
>>
>> ParamConverterProvider can be used on the client side to convert the
>> parameters in the out flow
>>
>> HTH, Sergey
>>
>> On 26/01/17 16:45, Maxim Solodovnik wrote:
>>
>>> Hello All,
>>>
>>> I have implemented custom ParamProvider [1] and set it in jaxrs:server [2]
>>> It works as expected to convert Incoming parameters for example here [3]
>>> But it is not used while writing output JSON :(
>>>
>>> adding additional provider as follows
>>> <jaxrs:providers>
>>> <bean id="omParamProvider"
>>> class="org.apache.openmeetings.webservice.util.OmParamConver
>>> terProvider"/>
>>> <bean id="jsonProvider"
>>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>> <property name="serializeAsArray" value="true"/>
>>> </bean>
>>> </jaxrs:providers>
>>>
>>> Also has no effect "serializeAsArray" not working :(
>>> CXF 3.1.9
>>>
>>> Thanks in advance
>>>
>>>
>>> [1]
>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>> webservice/util/OmParamConverterProvider.java
>>> [2]
>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>>> cationContext.xml#L285
>>> [3]
>>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>>> gs-webservice/src/main/java/org/apache/openmeetings/
>>> webservice/CalendarWebService.java#L97
>>>
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Jaxrs provider to serialize outgoing payload
Posted by Maxim Solodovnik <so...@gmail.com>.
So I need to create the class like this:
http://memorynotfound.com/jax-rs-messagebodywriter/
And add it as spring bean and it will handle output?
Why I was thought ParamConverter should convert to both sides: it has 2
methods: fromString and toString ....
On Thu, Jan 26, 2017 at 11:59 PM, Sergey Beryozkin <sb...@gmail.com>
wrote:
> Hi Max
>
> This provider only affect the input parameters, what is returned from a
> method is technically a message hence MessageBodyWriter is responsible for
> writing it and MessageBodyReader - for reading it.
>
> ParamConverterProvider only supports PathParam, etc, but not the in
> parameter which represents the body, again, it will be MBR which will read
> it.
>
> ParamConverterProvider can be used on the client side to convert the
> parameters in the out flow
>
> HTH, Sergey
>
> On 26/01/17 16:45, Maxim Solodovnik wrote:
>
>> Hello All,
>>
>> I have implemented custom ParamProvider [1] and set it in jaxrs:server [2]
>> It works as expected to convert Incoming parameters for example here [3]
>> But it is not used while writing output JSON :(
>>
>> adding additional provider as follows
>> <jaxrs:providers>
>> <bean id="omParamProvider"
>> class="org.apache.openmeetings.webservice.util.OmParamConver
>> terProvider"/>
>> <bean id="jsonProvider"
>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>> <property name="serializeAsArray" value="true"/>
>> </bean>
>> </jaxrs:providers>
>>
>> Also has no effect "serializeAsArray" not working :(
>> CXF 3.1.9
>>
>> Thanks in advance
>>
>>
>> [1]
>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>> gs-webservice/src/main/java/org/apache/openmeetings/
>> webservice/util/OmParamConverterProvider.java
>> [2]
>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>> gs-web/src/main/webapp/WEB-INF/classes/openmeetings-appli
>> cationContext.xml#L285
>> [3]
>> https://github.com/apache/openmeetings/blob/3.2.x/openmeetin
>> gs-webservice/src/main/java/org/apache/openmeetings/
>> webservice/CalendarWebService.java#L97
>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
--
WBR
Maxim aka solomax
Re: Jaxrs provider to serialize outgoing payload
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Max
This provider only affect the input parameters, what is returned from a
method is technically a message hence MessageBodyWriter is responsible
for writing it and MessageBodyReader - for reading it.
ParamConverterProvider only supports PathParam, etc, but not the in
parameter which represents the body, again, it will be MBR which will
read it.
ParamConverterProvider can be used on the client side to convert the
parameters in the out flow
HTH, Sergey
On 26/01/17 16:45, Maxim Solodovnik wrote:
> Hello All,
>
> I have implemented custom ParamProvider [1] and set it in jaxrs:server [2]
> It works as expected to convert Incoming parameters for example here [3]
> But it is not used while writing output JSON :(
>
> adding additional provider as follows
> <jaxrs:providers>
> <bean id="omParamProvider"
> class="org.apache.openmeetings.webservice.util.OmParamConverterProvider"/>
> <bean id="jsonProvider"
> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
> <property name="serializeAsArray" value="true"/>
> </bean>
> </jaxrs:providers>
>
> Also has no effect "serializeAsArray" not working :(
> CXF 3.1.9
>
> Thanks in advance
>
>
> [1]
> https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
> [2]
> https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml#L285
> [3]
> https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java#L97
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/