You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by vickatvuuch <vl...@gmail.com> on 2009/11/12 04:02:01 UTC

CXF REST Map as argument can it handle it?

Must be a simple one for anyone already done it.
I have tried it today and couldn't figure out why it would not 
initialize my bean with a Map in it, anyone knows the trick?
There seem to be a bug open on this, but I'm not sure if there
is still an issue and if so is there a way to do this?
Tried to post app xml in the POST body and on the Url all ends up
with null set instead of the map with key value pairs.

Thanks,
-Vitaly
-- 
View this message in context: http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF REST Map as argument can it handle it?

Posted by vickatvuuch <vl...@gmail.com>.
Sergey,

I appreciate your help.
There is no rush, I even think that in my case POST is 
better as I don't want to make it too easy to hit a groovy script on the
server
side from internet explorer anyway. So for now POST does it for me.
It would of course be nice to have this support in the future CXF releases.

-Vitaly


Sergey Beryozkin-2 wrote:
> 
> You can still do it even now, but it will require you to do some manual
> coding.
> You can register a ParameterHandler<ExecuteRequest> and then parse a query
> string from within that handler and populate an 
> ExecuteRequest instance accordingly... But I'll see if I can enhance the
> implementation a bit till tomorrow evening
> 
> Sergey
> 
>>
>> Yes, I guess I will use POST in this case and this body does fill in my
>> map.
>> It would be nice to allow it on the Url as well.
>> ie: params.k1=v1&params.k2=v2 etc.
>>
>> <ns1:ExecuteRequest ns2:type="ns1:ExecuteRequest"
>> xmlns:ns1="http://scripto.ports.v1.webservices.foo.com"
>> xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance">
>> <ns1:params>
>>
>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>
>>         <ns3:key>k1</ns3:key>
>>
>>         <ns3:value>v1</ns3:value>
>>
>>      </ns3:entry>
>>
>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>
>>         <ns3:key>k2</ns3:key>
>>
>>         <ns3:value>v2</ns3:value>
>>
>>      </ns3:entry>
>>
>>   </ns1:params>
>> </ns1:ExecuteRequest>
>>
>>
>> Sergey Beryozkin-2 wrote:
>>>
>>> If you pass the information as a POST body then it should work (Aegis
>>> should handle it or JAXB + XmlJavaTypeAdapter on the field of
>>> type Map). If you pass it as a query, something like
>>>
>>> ?name=scriptName&params=a%3DaValue%26b%3DbValue
>>>
>>> then no, params won't be injected into a Map...Dan is plaaning to do a
>>> build tomorrow evening or so... I'll try to do a quick
>>> update...
>>>
>>>
>>>
>>> cheers, Sergey
>>>
>>>
>>>>
>>>> Thanks, I understand your suggestion, however the destination of these
>>>> params
>>>> is a groovy script which is why I wanted to piece together params as
>>>> name
>>>> value pairs
>>>> and map is what fits best. My understanding that passing a map is an
>>>> open
>>>> issue under CXF
>>>> is it?
>>>>
>>>>
>>>> Sergey Beryozkin-2 wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>>
>>>>>> Here is spring config:
>>>>>>
>>>>>> <jaxrs:server address="/v1/rest">
>>>>>> <jaxrs:serviceBeans>
>>>>>> <ref bean="scriptoServiceBean"/>
>>>>>> </jaxrs:serviceBeans>
>>>>>>
>>>>>> <jaxrs:providers>
>>>>>> <ref bean="aegisProvider"/>
>>>>>> </jaxrs:providers>
>>>>>>
>>>>>> Here is the impl method:
>>>>>>
>>>>>>  @POST
>>>>>>  @Path("/execute")
>>>>>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>>>>>
>>>>>> and ExecuteRequest bean class:
>>>>>>
>>>>>> @XmlRootElement
>>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>>> {
>>>>>>  private String scriptName;
>>>>>>  private Map<String, String> params;
>>>>>>
>>>>>>  getters..
>>>>>>  setters..
>>>>>> }
>>>>>
>>>>> It won't work, not at the moment. List<String> will be ok, provided
>>>>> you
>>>>> have a query like scriptName=bar&name=a&name=b.
>>>>> But it's not possible to 'connect' a sequence of name/value pairs with
>>>>> a
>>>>> Map instance at the moment. Can you please post a sample
>>>>> query so that I can see why you expect a Map being injected ? Also
>>>>> note
>>>>> that no JAXB is involved when parameter beans are populated.
>>>>>
>>>>> What should work well is introducing a ParameterBean and have
>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>> {
>>>>>   private String scriptName;
>>>>>   private ParametersBean params;
>>>>>>
>>>>>>  getters..
>>>>>>  setters..
>>>>> }
>>>>>
>>>>> and then do scriptName=bar&params.param1=a&params.param2=b
>>>>>
>>>>> where ParametersBean has setters/getters for param1 & param2
>>>>>
>>>>> cheers, Sergey
>>>>>
>>>>>>
>>>>>>
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> I really need more information please. Which bean, a JAXB one, with
>>>>>>> one
>>>>>>> of
>>>>>>> its fields being of Map type ?
>>>>>>> Is it a form submission ? what is the resource method signature ?
>>>>>>>
>>>>>>> thanks, Sergey
>>>>>>>
>>>>>>>>
>>>>>>>> Must be a simple one for anyone already done it.
>>>>>>>> I have tried it today and couldn't figure out why it would not
>>>>>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>>>>>> There seem to be a bug open on this, but I'm not sure if there
>>>>>>>> is still an issue and if so is there a way to do this?
>>>>>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>>>>>> with null set instead of the map with key value pairs.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> -Vitaly
>>>>>>>> -- 
>>>>>>>> View this message in context:
>>>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26322286.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26323375.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF REST Map as argument can it handle it?

Posted by vickatvuuch <vl...@gmail.com>.
Yup, I did say that.. Thanks!
I may actually switch to use a list of beans instead as to simplify things,
anyway.


Sergey Beryozkin-2 wrote:
> 
> Hi,
> 
>>
>> Sergey,
>> I just wonder if you had a chance to implement this in 2.2.5?
> 
> No, you said there was no rush :-). I actually did look at it briefly just
> before the release but could not figure out, fast enough, 
> how to do it cleanly...Still planning to do it for 2.2.6/2.3
> 
> cheers, Sergey
> 
>>
>> Thanks,
>> -Vitaly
>>
>>
>> Sergey Beryozkin-2 wrote:
>>>
>>> You can still do it even now, but it will require you to do some manual
>>> coding.
>>> You can register a ParameterHandler<ExecuteRequest> and then parse a
>>> query
>>> string from within that handler and populate an
>>> ExecuteRequest instance accordingly... But I'll see if I can enhance the
>>> implementation a bit till tomorrow evening
>>>
>>> Sergey
>>>
>>>>
>>>> Yes, I guess I will use POST in this case and this body does fill in my
>>>> map.
>>>> It would be nice to allow it on the Url as well.
>>>> ie: params.k1=v1&params.k2=v2 etc.
>>>>
>>>> <ns1:ExecuteRequest ns2:type="ns1:ExecuteRequest"
>>>> xmlns:ns1="http://scripto.ports.v1.webservices.foo.com"
>>>> xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance">
>>>> <ns1:params>
>>>>
>>>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>>>
>>>>         <ns3:key>k1</ns3:key>
>>>>
>>>>         <ns3:value>v1</ns3:value>
>>>>
>>>>      </ns3:entry>
>>>>
>>>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>>>
>>>>         <ns3:key>k2</ns3:key>
>>>>
>>>>         <ns3:value>v2</ns3:value>
>>>>
>>>>      </ns3:entry>
>>>>
>>>>   </ns1:params>
>>>> </ns1:ExecuteRequest>
>>>>
>>>>
>>>> Sergey Beryozkin-2 wrote:
>>>>>
>>>>> If you pass the information as a POST body then it should work (Aegis
>>>>> should handle it or JAXB + XmlJavaTypeAdapter on the field of
>>>>> type Map). If you pass it as a query, something like
>>>>>
>>>>> ?name=scriptName&params=a%3DaValue%26b%3DbValue
>>>>>
>>>>> then no, params won't be injected into a Map...Dan is plaaning to do a
>>>>> build tomorrow evening or so... I'll try to do a quick
>>>>> update...
>>>>>
>>>>>
>>>>>
>>>>> cheers, Sergey
>>>>>
>>>>>
>>>>>>
>>>>>> Thanks, I understand your suggestion, however the destination of
>>>>>> these
>>>>>> params
>>>>>> is a groovy script which is why I wanted to piece together params as
>>>>>> name
>>>>>> value pairs
>>>>>> and map is what fits best. My understanding that passing a map is an
>>>>>> open
>>>>>> issue under CXF
>>>>>> is it?
>>>>>>
>>>>>>
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>>
>>>>>>>> Here is spring config:
>>>>>>>>
>>>>>>>> <jaxrs:server address="/v1/rest">
>>>>>>>> <jaxrs:serviceBeans>
>>>>>>>> <ref bean="scriptoServiceBean"/>
>>>>>>>> </jaxrs:serviceBeans>
>>>>>>>>
>>>>>>>> <jaxrs:providers>
>>>>>>>> <ref bean="aegisProvider"/>
>>>>>>>> </jaxrs:providers>
>>>>>>>>
>>>>>>>> Here is the impl method:
>>>>>>>>
>>>>>>>>  @POST
>>>>>>>>  @Path("/execute")
>>>>>>>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>>>>>>>
>>>>>>>> and ExecuteRequest bean class:
>>>>>>>>
>>>>>>>> @XmlRootElement
>>>>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>>>>> {
>>>>>>>>  private String scriptName;
>>>>>>>>  private Map<String, String> params;
>>>>>>>>
>>>>>>>>  getters..
>>>>>>>>  setters..
>>>>>>>> }
>>>>>>>
>>>>>>> It won't work, not at the moment. List<String> will be ok, provided
>>>>>>> you
>>>>>>> have a query like scriptName=bar&name=a&name=b.
>>>>>>> But it's not possible to 'connect' a sequence of name/value pairs
>>>>>>> with
>>>>>>> a
>>>>>>> Map instance at the moment. Can you please post a sample
>>>>>>> query so that I can see why you expect a Map being injected ? Also
>>>>>>> note
>>>>>>> that no JAXB is involved when parameter beans are populated.
>>>>>>>
>>>>>>> What should work well is introducing a ParameterBean and have
>>>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>>>> {
>>>>>>>   private String scriptName;
>>>>>>>   private ParametersBean params;
>>>>>>>>
>>>>>>>>  getters..
>>>>>>>>  setters..
>>>>>>> }
>>>>>>>
>>>>>>> and then do scriptName=bar&params.param1=a&params.param2=b
>>>>>>>
>>>>>>> where ParametersBean has setters/getters for param1 & param2
>>>>>>>
>>>>>>> cheers, Sergey
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>>
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> I really need more information please. Which bean, a JAXB one,
>>>>>>>>> with
>>>>>>>>> one
>>>>>>>>> of
>>>>>>>>> its fields being of Map type ?
>>>>>>>>> Is it a form submission ? what is the resource method signature ?
>>>>>>>>>
>>>>>>>>> thanks, Sergey
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Must be a simple one for anyone already done it.
>>>>>>>>>> I have tried it today and couldn't figure out why it would not
>>>>>>>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>>>>>>>> There seem to be a bug open on this, but I'm not sure if there
>>>>>>>>>> is still an issue and if so is there a way to do this?
>>>>>>>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>>>>>>>> with null set instead of the map with key value pairs.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> -Vitaly
>>>>>>>>>> -- 
>>>>>>>>>> View this message in context:
>>>>>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> View this message in context:
>>>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26322286.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26586725.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26633927.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF REST Map as argument can it handle it?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi,

>
> Sergey,
> I just wonder if you had a chance to implement this in 2.2.5?

No, you said there was no rush :-). I actually did look at it briefly just before the release but could not figure out, fast enough, 
how to do it cleanly...Still planning to do it for 2.2.6/2.3

cheers, Sergey

>
> Thanks,
> -Vitaly
>
>
> Sergey Beryozkin-2 wrote:
>>
>> You can still do it even now, but it will require you to do some manual
>> coding.
>> You can register a ParameterHandler<ExecuteRequest> and then parse a query
>> string from within that handler and populate an
>> ExecuteRequest instance accordingly... But I'll see if I can enhance the
>> implementation a bit till tomorrow evening
>>
>> Sergey
>>
>>>
>>> Yes, I guess I will use POST in this case and this body does fill in my
>>> map.
>>> It would be nice to allow it on the Url as well.
>>> ie: params.k1=v1&params.k2=v2 etc.
>>>
>>> <ns1:ExecuteRequest ns2:type="ns1:ExecuteRequest"
>>> xmlns:ns1="http://scripto.ports.v1.webservices.foo.com"
>>> xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance">
>>> <ns1:params>
>>>
>>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>>
>>>         <ns3:key>k1</ns3:key>
>>>
>>>         <ns3:value>v1</ns3:value>
>>>
>>>      </ns3:entry>
>>>
>>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>>
>>>         <ns3:key>k2</ns3:key>
>>>
>>>         <ns3:value>v2</ns3:value>
>>>
>>>      </ns3:entry>
>>>
>>>   </ns1:params>
>>> </ns1:ExecuteRequest>
>>>
>>>
>>> Sergey Beryozkin-2 wrote:
>>>>
>>>> If you pass the information as a POST body then it should work (Aegis
>>>> should handle it or JAXB + XmlJavaTypeAdapter on the field of
>>>> type Map). If you pass it as a query, something like
>>>>
>>>> ?name=scriptName&params=a%3DaValue%26b%3DbValue
>>>>
>>>> then no, params won't be injected into a Map...Dan is plaaning to do a
>>>> build tomorrow evening or so... I'll try to do a quick
>>>> update...
>>>>
>>>>
>>>>
>>>> cheers, Sergey
>>>>
>>>>
>>>>>
>>>>> Thanks, I understand your suggestion, however the destination of these
>>>>> params
>>>>> is a groovy script which is why I wanted to piece together params as
>>>>> name
>>>>> value pairs
>>>>> and map is what fits best. My understanding that passing a map is an
>>>>> open
>>>>> issue under CXF
>>>>> is it?
>>>>>
>>>>>
>>>>> Sergey Beryozkin-2 wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>>
>>>>>>> Here is spring config:
>>>>>>>
>>>>>>> <jaxrs:server address="/v1/rest">
>>>>>>> <jaxrs:serviceBeans>
>>>>>>> <ref bean="scriptoServiceBean"/>
>>>>>>> </jaxrs:serviceBeans>
>>>>>>>
>>>>>>> <jaxrs:providers>
>>>>>>> <ref bean="aegisProvider"/>
>>>>>>> </jaxrs:providers>
>>>>>>>
>>>>>>> Here is the impl method:
>>>>>>>
>>>>>>>  @POST
>>>>>>>  @Path("/execute")
>>>>>>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>>>>>>
>>>>>>> and ExecuteRequest bean class:
>>>>>>>
>>>>>>> @XmlRootElement
>>>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>>>> {
>>>>>>>  private String scriptName;
>>>>>>>  private Map<String, String> params;
>>>>>>>
>>>>>>>  getters..
>>>>>>>  setters..
>>>>>>> }
>>>>>>
>>>>>> It won't work, not at the moment. List<String> will be ok, provided
>>>>>> you
>>>>>> have a query like scriptName=bar&name=a&name=b.
>>>>>> But it's not possible to 'connect' a sequence of name/value pairs with
>>>>>> a
>>>>>> Map instance at the moment. Can you please post a sample
>>>>>> query so that I can see why you expect a Map being injected ? Also
>>>>>> note
>>>>>> that no JAXB is involved when parameter beans are populated.
>>>>>>
>>>>>> What should work well is introducing a ParameterBean and have
>>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>>> {
>>>>>>   private String scriptName;
>>>>>>   private ParametersBean params;
>>>>>>>
>>>>>>>  getters..
>>>>>>>  setters..
>>>>>> }
>>>>>>
>>>>>> and then do scriptName=bar&params.param1=a&params.param2=b
>>>>>>
>>>>>> where ParametersBean has setters/getters for param1 & param2
>>>>>>
>>>>>> cheers, Sergey
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> I really need more information please. Which bean, a JAXB one, with
>>>>>>>> one
>>>>>>>> of
>>>>>>>> its fields being of Map type ?
>>>>>>>> Is it a form submission ? what is the resource method signature ?
>>>>>>>>
>>>>>>>> thanks, Sergey
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Must be a simple one for anyone already done it.
>>>>>>>>> I have tried it today and couldn't figure out why it would not
>>>>>>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>>>>>>> There seem to be a bug open on this, but I'm not sure if there
>>>>>>>>> is still an issue and if so is there a way to do this?
>>>>>>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>>>>>>> with null set instead of the map with key value pairs.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> -Vitaly
>>>>>>>>> -- 
>>>>>>>>> View this message in context:
>>>>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>>> View this message in context:
>>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> -- 
>>>>> View this message in context:
>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26322286.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: 
> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26586725.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: CXF REST Map as argument can it handle it?

Posted by vickatvuuch <vl...@gmail.com>.
Sergey,
I just wonder if you had a chance to implement this in 2.2.5?

Thanks,
-Vitaly 


Sergey Beryozkin-2 wrote:
> 
> You can still do it even now, but it will require you to do some manual
> coding.
> You can register a ParameterHandler<ExecuteRequest> and then parse a query
> string from within that handler and populate an 
> ExecuteRequest instance accordingly... But I'll see if I can enhance the
> implementation a bit till tomorrow evening
> 
> Sergey
> 
>>
>> Yes, I guess I will use POST in this case and this body does fill in my
>> map.
>> It would be nice to allow it on the Url as well.
>> ie: params.k1=v1&params.k2=v2 etc.
>>
>> <ns1:ExecuteRequest ns2:type="ns1:ExecuteRequest"
>> xmlns:ns1="http://scripto.ports.v1.webservices.foo.com"
>> xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance">
>> <ns1:params>
>>
>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>
>>         <ns3:key>k1</ns3:key>
>>
>>         <ns3:value>v1</ns3:value>
>>
>>      </ns3:entry>
>>
>>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>>
>>         <ns3:key>k2</ns3:key>
>>
>>         <ns3:value>v2</ns3:value>
>>
>>      </ns3:entry>
>>
>>   </ns1:params>
>> </ns1:ExecuteRequest>
>>
>>
>> Sergey Beryozkin-2 wrote:
>>>
>>> If you pass the information as a POST body then it should work (Aegis
>>> should handle it or JAXB + XmlJavaTypeAdapter on the field of
>>> type Map). If you pass it as a query, something like
>>>
>>> ?name=scriptName&params=a%3DaValue%26b%3DbValue
>>>
>>> then no, params won't be injected into a Map...Dan is plaaning to do a
>>> build tomorrow evening or so... I'll try to do a quick
>>> update...
>>>
>>>
>>>
>>> cheers, Sergey
>>>
>>>
>>>>
>>>> Thanks, I understand your suggestion, however the destination of these
>>>> params
>>>> is a groovy script which is why I wanted to piece together params as
>>>> name
>>>> value pairs
>>>> and map is what fits best. My understanding that passing a map is an
>>>> open
>>>> issue under CXF
>>>> is it?
>>>>
>>>>
>>>> Sergey Beryozkin-2 wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>>
>>>>>> Here is spring config:
>>>>>>
>>>>>> <jaxrs:server address="/v1/rest">
>>>>>> <jaxrs:serviceBeans>
>>>>>> <ref bean="scriptoServiceBean"/>
>>>>>> </jaxrs:serviceBeans>
>>>>>>
>>>>>> <jaxrs:providers>
>>>>>> <ref bean="aegisProvider"/>
>>>>>> </jaxrs:providers>
>>>>>>
>>>>>> Here is the impl method:
>>>>>>
>>>>>>  @POST
>>>>>>  @Path("/execute")
>>>>>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>>>>>
>>>>>> and ExecuteRequest bean class:
>>>>>>
>>>>>> @XmlRootElement
>>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>>> {
>>>>>>  private String scriptName;
>>>>>>  private Map<String, String> params;
>>>>>>
>>>>>>  getters..
>>>>>>  setters..
>>>>>> }
>>>>>
>>>>> It won't work, not at the moment. List<String> will be ok, provided
>>>>> you
>>>>> have a query like scriptName=bar&name=a&name=b.
>>>>> But it's not possible to 'connect' a sequence of name/value pairs with
>>>>> a
>>>>> Map instance at the moment. Can you please post a sample
>>>>> query so that I can see why you expect a Map being injected ? Also
>>>>> note
>>>>> that no JAXB is involved when parameter beans are populated.
>>>>>
>>>>> What should work well is introducing a ParameterBean and have
>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>> {
>>>>>   private String scriptName;
>>>>>   private ParametersBean params;
>>>>>>
>>>>>>  getters..
>>>>>>  setters..
>>>>> }
>>>>>
>>>>> and then do scriptName=bar&params.param1=a&params.param2=b
>>>>>
>>>>> where ParametersBean has setters/getters for param1 & param2
>>>>>
>>>>> cheers, Sergey
>>>>>
>>>>>>
>>>>>>
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> I really need more information please. Which bean, a JAXB one, with
>>>>>>> one
>>>>>>> of
>>>>>>> its fields being of Map type ?
>>>>>>> Is it a form submission ? what is the resource method signature ?
>>>>>>>
>>>>>>> thanks, Sergey
>>>>>>>
>>>>>>>>
>>>>>>>> Must be a simple one for anyone already done it.
>>>>>>>> I have tried it today and couldn't figure out why it would not
>>>>>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>>>>>> There seem to be a bug open on this, but I'm not sure if there
>>>>>>>> is still an issue and if so is there a way to do this?
>>>>>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>>>>>> with null set instead of the map with key value pairs.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> -Vitaly
>>>>>>>> -- 
>>>>>>>> View this message in context:
>>>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26322286.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26586725.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: @XmlValue complaining about non existent @XmlElement

Posted by "Kessel, Christopher" <ck...@transunion.com>.
The wsdl2java produces a class with the same problem. I did just
discover though if I put the following tag on the class, I can get it to
work. 

	@XmlAccessorType(XmlAccessType.NONE)

Any value for the XmlAccessType other than NONE has the problem, but
with NONE it works. It means I have to annotate everything rather than
letting public field/accessors determine things, but it does work :)

As for the bug location, sorry about that. CXF is a black box to me
still and I'm not sure yet where it stops and underlying 3rd party
functionality begins.

Thanks,
Chris


-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Friday, November 13, 2009 11:54 AM
To: users@cxf.apache.org
Cc: Kessel, Christopher
Subject: Re: @XmlValue complaining about non existent @XmlElement


Well, it's probably not a CXF bug as we pretty much just delegate all
that 
stuff down to the JAXB runtime.

My suggestion is to write a schema for what you WANT it to look like and
run 
the JAXB schema compiler on it and see what it produces.

Dan


On Fri November 13 2009 1:39:15 pm Kessel, Christopher wrote:
> That works, but doesn't solve my problem. My input is:
> 
> 	<contact>Jim</contact> // actually, it would have some
> attributes, but I'm just trying the simplest case right now
> 
> The annotations you mentioned produce XML like so.
> 	<contact><name>Jim</name></contact>
> 
> The problem is there appears to be a bug in CXF when I publish the
> endpoint where a mapped object has the @XmlValue annotation.
Everything
> I can find says that's the correct way to indicate the XML should be
> read/written in the format I'm looking for, but CXF gives the error
when
> I actually try to use Endpoint.publish() to start the server listening
> for requests.
> 
> I've tried with and without XmlRootElement definitions, XmlType with
> propOrder, all sorts of things that various examples seem to indicate
> might help, but nothing works. Maybe I'm missing something, but it
sure
> looks like a bug.
> 
> 	If a class has @XmlElement property, it cannot have @XmlValue
> property.
> 		this problem is related to the following location:
> 			at private java.lang.String
> 	com.transunion.cis.iq411.soap.C360Contact._name
> 			at com.transunion.cis.iq411.soap.C360Contact
> 			at public
> com.transunion.cis.iq411.soap.C360Contact
> 
> Chris
> 
> -----Original Message-----
> From: Tomas Majak [mailto:tomas.majak@nasdaqomx.com]
> Sent: Friday, November 13, 2009 12:11 AM
> To: users@cxf.apache.org
> Cc: Kessel, Christopher
> Subject: RE: @XmlValue complaining about non existent @XmlElement
> 
> What about using:
> @XmlElement(name = "name")
> private String _name;
> 
> And class annotation:
> @XmlRootElement(name = "contact")
> @XmlAccessorType(value = XmlAccessType.NONE)
> public class C360Contact {
> 
> -----Original Message-----
> From: Kessel, Christopher [mailto:ckessel@transunion.com]
> Sent: den 12 november 2009 19:29
> To: users@cxf.apache.org
> Subject: @XmlValue complaining about non existent @XmlElement
> 
> I've got a really simple data class.
> 	public class C360Contact
> 	{
>     	    @XmlValue
> 	    private String _name;
> 	    public String getName()
> 	    {
> 	        return _name;
> 	    }
> 
> 	    public void setName( String name )
> 	    {
> 	        _name = name;
> 	    }
> 	}
> 
> I'm trying to indicate the value for the "name" attribute is in the
> content of the tag rather than a tag on its own. E.g.
> 
> 	<contact>Jim</contact>
> 
> 	vs.
> 	<contact>
> 		<name>Jim</name>
> 	</contact>
> 
> However, I get the following error when publishing the endpoint. Any
> idea why?
> 
> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1
> counts of IllegalAnnotationExceptions
> If a class has @XmlElement property, it cannot have @XmlValue
property.
> 	this problem is related to the following location:
> 		at private java.lang.String
> com.transunion.cis.iq411.soap.C360Contact._name
> 		at com.transunion.cis.iq411.soap.C360Contact
> 		at public com.transunion.cis.iq411.soap.C360Contact
> com.transunion.cis.iq411.soap.C360Request.getContact()
> 		at com.transunion.cis.iq411.soap.C360Request
> 	this problem is related to the following location:
> 		at public java.lang.String
> com.transunion.cis.iq411.soap.C360Contact.getName()
> 		at com.transunion.cis.iq411.soap.C360Contact
> 		at public com.transunion.cis.iq411.soap.C360Contact
> com.transunion.cis.iq411.soap.C360Request.getContact()
> 		at com.transunion.cis.iq411.soap.C360Request
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: @XmlValue complaining about non existent @XmlElement

Posted by Daniel Kulp <dk...@apache.org>.
Well, it's probably not a CXF bug as we pretty much just delegate all that 
stuff down to the JAXB runtime.

My suggestion is to write a schema for what you WANT it to look like and run 
the JAXB schema compiler on it and see what it produces.

Dan


On Fri November 13 2009 1:39:15 pm Kessel, Christopher wrote:
> That works, but doesn't solve my problem. My input is:
> 
> 	<contact>Jim</contact> // actually, it would have some
> attributes, but I'm just trying the simplest case right now
> 
> The annotations you mentioned produce XML like so.
> 	<contact><name>Jim</name></contact>
> 
> The problem is there appears to be a bug in CXF when I publish the
> endpoint where a mapped object has the @XmlValue annotation. Everything
> I can find says that's the correct way to indicate the XML should be
> read/written in the format I'm looking for, but CXF gives the error when
> I actually try to use Endpoint.publish() to start the server listening
> for requests.
> 
> I've tried with and without XmlRootElement definitions, XmlType with
> propOrder, all sorts of things that various examples seem to indicate
> might help, but nothing works. Maybe I'm missing something, but it sure
> looks like a bug.
> 
> 	If a class has @XmlElement property, it cannot have @XmlValue
> property.
> 		this problem is related to the following location:
> 			at private java.lang.String
> 	com.transunion.cis.iq411.soap.C360Contact._name
> 			at com.transunion.cis.iq411.soap.C360Contact
> 			at public
> com.transunion.cis.iq411.soap.C360Contact
> 
> Chris
> 
> -----Original Message-----
> From: Tomas Majak [mailto:tomas.majak@nasdaqomx.com]
> Sent: Friday, November 13, 2009 12:11 AM
> To: users@cxf.apache.org
> Cc: Kessel, Christopher
> Subject: RE: @XmlValue complaining about non existent @XmlElement
> 
> What about using:
> @XmlElement(name = "name")
> private String _name;
> 
> And class annotation:
> @XmlRootElement(name = "contact")
> @XmlAccessorType(value = XmlAccessType.NONE)
> public class C360Contact {
> 
> -----Original Message-----
> From: Kessel, Christopher [mailto:ckessel@transunion.com]
> Sent: den 12 november 2009 19:29
> To: users@cxf.apache.org
> Subject: @XmlValue complaining about non existent @XmlElement
> 
> I've got a really simple data class.
> 	public class C360Contact
> 	{
>     	    @XmlValue
> 	    private String _name;
> 	    public String getName()
> 	    {
> 	        return _name;
> 	    }
> 
> 	    public void setName( String name )
> 	    {
> 	        _name = name;
> 	    }
> 	}
> 
> I'm trying to indicate the value for the "name" attribute is in the
> content of the tag rather than a tag on its own. E.g.
> 
> 	<contact>Jim</contact>
> 
> 	vs.
> 	<contact>
> 		<name>Jim</name>
> 	</contact>
> 
> However, I get the following error when publishing the endpoint. Any
> idea why?
> 
> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1
> counts of IllegalAnnotationExceptions
> If a class has @XmlElement property, it cannot have @XmlValue property.
> 	this problem is related to the following location:
> 		at private java.lang.String
> com.transunion.cis.iq411.soap.C360Contact._name
> 		at com.transunion.cis.iq411.soap.C360Contact
> 		at public com.transunion.cis.iq411.soap.C360Contact
> com.transunion.cis.iq411.soap.C360Request.getContact()
> 		at com.transunion.cis.iq411.soap.C360Request
> 	this problem is related to the following location:
> 		at public java.lang.String
> com.transunion.cis.iq411.soap.C360Contact.getName()
> 		at com.transunion.cis.iq411.soap.C360Contact
> 		at public com.transunion.cis.iq411.soap.C360Contact
> com.transunion.cis.iq411.soap.C360Request.getContact()
> 		at com.transunion.cis.iq411.soap.C360Request
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

RE: @XmlValue complaining about non existent @XmlElement

Posted by "Kessel, Christopher" <ck...@transunion.com>.
That works, but doesn't solve my problem. My input is:

	<contact>Jim</contact> // actually, it would have some
attributes, but I'm just trying the simplest case right now

The annotations you mentioned produce XML like so.
	<contact><name>Jim</name></contact>

The problem is there appears to be a bug in CXF when I publish the
endpoint where a mapped object has the @XmlValue annotation. Everything
I can find says that's the correct way to indicate the XML should be
read/written in the format I'm looking for, but CXF gives the error when
I actually try to use Endpoint.publish() to start the server listening
for requests. 

I've tried with and without XmlRootElement definitions, XmlType with
propOrder, all sorts of things that various examples seem to indicate
might help, but nothing works. Maybe I'm missing something, but it sure
looks like a bug.

	If a class has @XmlElement property, it cannot have @XmlValue
property.
		this problem is related to the following location:
			at private java.lang.String
	com.transunion.cis.iq411.soap.C360Contact._name
			at com.transunion.cis.iq411.soap.C360Contact
			at public
com.transunion.cis.iq411.soap.C360Contact

Chris

-----Original Message-----
From: Tomas Majak [mailto:tomas.majak@nasdaqomx.com] 
Sent: Friday, November 13, 2009 12:11 AM
To: users@cxf.apache.org
Cc: Kessel, Christopher
Subject: RE: @XmlValue complaining about non existent @XmlElement

What about using:
@XmlElement(name = "name")
private String _name;

And class annotation:
@XmlRootElement(name = "contact")
@XmlAccessorType(value = XmlAccessType.NONE)
public class C360Contact {

-----Original Message-----
From: Kessel, Christopher [mailto:ckessel@transunion.com] 
Sent: den 12 november 2009 19:29
To: users@cxf.apache.org
Subject: @XmlValue complaining about non existent @XmlElement

I've got a really simple data class. 
	public class C360Contact
	{
    	    @XmlValue
	    private String _name;
	    public String getName()
	    {
	        return _name;
	    }

	    public void setName( String name )
	    {
	        _name = name;
	    }
	}

I'm trying to indicate the value for the "name" attribute is in the
content of the tag rather than a tag on its own. E.g. 

	<contact>Jim</contact>

	vs.
	<contact>
		<name>Jim</name>
	</contact>

However, I get the following error when publishing the endpoint. Any
idea why?

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1
counts of IllegalAnnotationExceptions
If a class has @XmlElement property, it cannot have @XmlValue property.
	this problem is related to the following location:
		at private java.lang.String
com.transunion.cis.iq411.soap.C360Contact._name
		at com.transunion.cis.iq411.soap.C360Contact
		at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
		at com.transunion.cis.iq411.soap.C360Request
	this problem is related to the following location:
		at public java.lang.String
com.transunion.cis.iq411.soap.C360Contact.getName()
		at com.transunion.cis.iq411.soap.C360Contact
		at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
		at com.transunion.cis.iq411.soap.C360Request

RE: @XmlValue complaining about non existent @XmlElement

Posted by Tomas Majak <to...@nasdaqomx.com>.
What about using:
@XmlElement(name = "name")
private String _name;

And class annotation:
@XmlRootElement(name = "contact")
@XmlAccessorType(value = XmlAccessType.NONE)
public class C360Contact {

-----Original Message-----
From: Kessel, Christopher [mailto:ckessel@transunion.com] 
Sent: den 12 november 2009 19:29
To: users@cxf.apache.org
Subject: @XmlValue complaining about non existent @XmlElement

I've got a really simple data class. 
	public class C360Contact
	{
    	    @XmlValue
	    private String _name;
	    public String getName()
	    {
	        return _name;
	    }

	    public void setName( String name )
	    {
	        _name = name;
	    }
	}

I'm trying to indicate the value for the "name" attribute is in the
content of the tag rather than a tag on its own. E.g. 

	<contact>Jim</contact>

	vs.
	<contact>
		<name>Jim</name>
	</contact>

However, I get the following error when publishing the endpoint. Any
idea why?

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1
counts of IllegalAnnotationExceptions
If a class has @XmlElement property, it cannot have @XmlValue property.
	this problem is related to the following location:
		at private java.lang.String
com.transunion.cis.iq411.soap.C360Contact._name
		at com.transunion.cis.iq411.soap.C360Contact
		at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
		at com.transunion.cis.iq411.soap.C360Request
	this problem is related to the following location:
		at public java.lang.String
com.transunion.cis.iq411.soap.C360Contact.getName()
		at com.transunion.cis.iq411.soap.C360Contact
		at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
		at com.transunion.cis.iq411.soap.C360Request

@XmlValue complaining about non existent @XmlElement

Posted by "Kessel, Christopher" <ck...@transunion.com>.
I've got a really simple data class. 
	public class C360Contact
	{
    	    @XmlValue
	    private String _name;
	    public String getName()
	    {
	        return _name;
	    }

	    public void setName( String name )
	    {
	        _name = name;
	    }
	}

I'm trying to indicate the value for the "name" attribute is in the
content of the tag rather than a tag on its own. E.g. 

	<contact>Jim</contact>

	vs.
	<contact>
		<name>Jim</name>
	</contact>

However, I get the following error when publishing the endpoint. Any
idea why?

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1
counts of IllegalAnnotationExceptions
If a class has @XmlElement property, it cannot have @XmlValue property.
	this problem is related to the following location:
		at private java.lang.String
com.transunion.cis.iq411.soap.C360Contact._name
		at com.transunion.cis.iq411.soap.C360Contact
		at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
		at com.transunion.cis.iq411.soap.C360Request
	this problem is related to the following location:
		at public java.lang.String
com.transunion.cis.iq411.soap.C360Contact.getName()
		at com.transunion.cis.iq411.soap.C360Contact
		at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
		at com.transunion.cis.iq411.soap.C360Request

Re: CXF REST Map as argument can it handle it?

Posted by Sergey Beryozkin <sb...@progress.com>.
You can still do it even now, but it will require you to do some manual coding.
You can register a ParameterHandler<ExecuteRequest> and then parse a query string from within that handler and populate an 
ExecuteRequest instance accordingly... But I'll see if I can enhance the implementation a bit till tomorrow evening

Sergey

>
> Yes, I guess I will use POST in this case and this body does fill in my map.
> It would be nice to allow it on the Url as well.
> ie: params.k1=v1&params.k2=v2 etc.
>
> <ns1:ExecuteRequest ns2:type="ns1:ExecuteRequest"
> xmlns:ns1="http://scripto.ports.v1.webservices.foo.com"
> xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance">
> <ns1:params>
>
>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>
>         <ns3:key>k1</ns3:key>
>
>         <ns3:value>v1</ns3:value>
>
>      </ns3:entry>
>
>      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">
>
>         <ns3:key>k2</ns3:key>
>
>         <ns3:value>v2</ns3:value>
>
>      </ns3:entry>
>
>   </ns1:params>
> </ns1:ExecuteRequest>
>
>
> Sergey Beryozkin-2 wrote:
>>
>> If you pass the information as a POST body then it should work (Aegis
>> should handle it or JAXB + XmlJavaTypeAdapter on the field of
>> type Map). If you pass it as a query, something like
>>
>> ?name=scriptName&params=a%3DaValue%26b%3DbValue
>>
>> then no, params won't be injected into a Map...Dan is plaaning to do a
>> build tomorrow evening or so... I'll try to do a quick
>> update...
>>
>>
>>
>> cheers, Sergey
>>
>>
>>>
>>> Thanks, I understand your suggestion, however the destination of these
>>> params
>>> is a groovy script which is why I wanted to piece together params as name
>>> value pairs
>>> and map is what fits best. My understanding that passing a map is an open
>>> issue under CXF
>>> is it?
>>>
>>>
>>> Sergey Beryozkin-2 wrote:
>>>>
>>>> Hi,
>>>>
>>>>>
>>>>> Here is spring config:
>>>>>
>>>>> <jaxrs:server address="/v1/rest">
>>>>> <jaxrs:serviceBeans>
>>>>> <ref bean="scriptoServiceBean"/>
>>>>> </jaxrs:serviceBeans>
>>>>>
>>>>> <jaxrs:providers>
>>>>> <ref bean="aegisProvider"/>
>>>>> </jaxrs:providers>
>>>>>
>>>>> Here is the impl method:
>>>>>
>>>>>  @POST
>>>>>  @Path("/execute")
>>>>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>>>>
>>>>> and ExecuteRequest bean class:
>>>>>
>>>>> @XmlRootElement
>>>>> public class ExecuteRequest extends WSBaseRequest
>>>>> {
>>>>>  private String scriptName;
>>>>>  private Map<String, String> params;
>>>>>
>>>>>  getters..
>>>>>  setters..
>>>>> }
>>>>
>>>> It won't work, not at the moment. List<String> will be ok, provided you
>>>> have a query like scriptName=bar&name=a&name=b.
>>>> But it's not possible to 'connect' a sequence of name/value pairs with a
>>>> Map instance at the moment. Can you please post a sample
>>>> query so that I can see why you expect a Map being injected ? Also note
>>>> that no JAXB is involved when parameter beans are populated.
>>>>
>>>> What should work well is introducing a ParameterBean and have
>>>> public class ExecuteRequest extends WSBaseRequest
>>>> {
>>>>   private String scriptName;
>>>>   private ParametersBean params;
>>>>>
>>>>>  getters..
>>>>>  setters..
>>>> }
>>>>
>>>> and then do scriptName=bar&params.param1=a&params.param2=b
>>>>
>>>> where ParametersBean has setters/getters for param1 & param2
>>>>
>>>> cheers, Sergey
>>>>
>>>>>
>>>>>
>>>>> Sergey Beryozkin-2 wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I really need more information please. Which bean, a JAXB one, with
>>>>>> one
>>>>>> of
>>>>>> its fields being of Map type ?
>>>>>> Is it a form submission ? what is the resource method signature ?
>>>>>>
>>>>>> thanks, Sergey
>>>>>>
>>>>>>>
>>>>>>> Must be a simple one for anyone already done it.
>>>>>>> I have tried it today and couldn't figure out why it would not
>>>>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>>>>> There seem to be a bug open on this, but I'm not sure if there
>>>>>>> is still an issue and if so is there a way to do this?
>>>>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>>>>> with null set instead of the map with key value pairs.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> -Vitaly
>>>>>>> -- 
>>>>>>> View this message in context:
>>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> -- 
>>>>> View this message in context:
>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: 
> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26322286.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: CXF REST Map as argument can it handle it?

Posted by vickatvuuch <vl...@gmail.com>.
Yes, I guess I will use POST in this case and this body does fill in my map.
It would be nice to allow it on the Url as well. 
ie: params.k1=v1&params.k2=v2 etc.

<ns1:ExecuteRequest ns2:type="ns1:ExecuteRequest"
xmlns:ns1="http://scripto.ports.v1.webservices.foo.com"
xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance">
<ns1:params>

      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">

         <ns3:key>k1</ns3:key>

         <ns3:value>v1</ns3:value>

      </ns3:entry>

      <ns3:entry xmlns:ns3="urn:org.apache.cxf.aegis.types">

         <ns3:key>k2</ns3:key>

         <ns3:value>v2</ns3:value>

      </ns3:entry>

   </ns1:params>
</ns1:ExecuteRequest>


Sergey Beryozkin-2 wrote:
> 
> If you pass the information as a POST body then it should work (Aegis
> should handle it or JAXB + XmlJavaTypeAdapter on the field of 
> type Map). If you pass it as a query, something like
> 
> ?name=scriptName&params=a%3DaValue%26b%3DbValue
> 
> then no, params won't be injected into a Map...Dan is plaaning to do a
> build tomorrow evening or so... I'll try to do a quick 
> update...
> 
> 
> 
> cheers, Sergey
> 
> 
>>
>> Thanks, I understand your suggestion, however the destination of these
>> params
>> is a groovy script which is why I wanted to piece together params as name
>> value pairs
>> and map is what fits best. My understanding that passing a map is an open
>> issue under CXF
>> is it?
>>
>>
>> Sergey Beryozkin-2 wrote:
>>>
>>> Hi,
>>>
>>>>
>>>> Here is spring config:
>>>>
>>>> <jaxrs:server address="/v1/rest">
>>>> <jaxrs:serviceBeans>
>>>> <ref bean="scriptoServiceBean"/>
>>>> </jaxrs:serviceBeans>
>>>>
>>>> <jaxrs:providers>
>>>> <ref bean="aegisProvider"/>
>>>> </jaxrs:providers>
>>>>
>>>> Here is the impl method:
>>>>
>>>>  @POST
>>>>  @Path("/execute")
>>>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>>>
>>>> and ExecuteRequest bean class:
>>>>
>>>> @XmlRootElement
>>>> public class ExecuteRequest extends WSBaseRequest
>>>> {
>>>>  private String scriptName;
>>>>  private Map<String, String> params;
>>>>
>>>>  getters..
>>>>  setters..
>>>> }
>>>
>>> It won't work, not at the moment. List<String> will be ok, provided you
>>> have a query like scriptName=bar&name=a&name=b.
>>> But it's not possible to 'connect' a sequence of name/value pairs with a
>>> Map instance at the moment. Can you please post a sample
>>> query so that I can see why you expect a Map being injected ? Also note
>>> that no JAXB is involved when parameter beans are populated.
>>>
>>> What should work well is introducing a ParameterBean and have
>>> public class ExecuteRequest extends WSBaseRequest
>>> {
>>>   private String scriptName;
>>>   private ParametersBean params;
>>>>
>>>>  getters..
>>>>  setters..
>>> }
>>>
>>> and then do scriptName=bar&params.param1=a&params.param2=b
>>>
>>> where ParametersBean has setters/getters for param1 & param2
>>>
>>> cheers, Sergey
>>>
>>>>
>>>>
>>>> Sergey Beryozkin-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I really need more information please. Which bean, a JAXB one, with
>>>>> one
>>>>> of
>>>>> its fields being of Map type ?
>>>>> Is it a form submission ? what is the resource method signature ?
>>>>>
>>>>> thanks, Sergey
>>>>>
>>>>>>
>>>>>> Must be a simple one for anyone already done it.
>>>>>> I have tried it today and couldn't figure out why it would not
>>>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>>>> There seem to be a bug open on this, but I'm not sure if there
>>>>>> is still an issue and if so is there a way to do this?
>>>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>>>> with null set instead of the map with key value pairs.
>>>>>>
>>>>>> Thanks,
>>>>>> -Vitaly
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26322286.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF REST Map as argument can it handle it?

Posted by Sergey Beryozkin <sb...@progress.com>.
If you pass the information as a POST body then it should work (Aegis should handle it or JAXB + XmlJavaTypeAdapter on the field of 
type Map). If you pass it as a query, something like

?name=scriptName&params=a%3DaValue%26b%3DbValue

then no, params won't be injected into a Map...Dan is plaaning to do a build tomorrow evening or so... I'll try to do a quick 
update...



cheers, Sergey


>
> Thanks, I understand your suggestion, however the destination of these params
> is a groovy script which is why I wanted to piece together params as name
> value pairs
> and map is what fits best. My understanding that passing a map is an open
> issue under CXF
> is it?
>
>
> Sergey Beryozkin-2 wrote:
>>
>> Hi,
>>
>>>
>>> Here is spring config:
>>>
>>> <jaxrs:server address="/v1/rest">
>>> <jaxrs:serviceBeans>
>>> <ref bean="scriptoServiceBean"/>
>>> </jaxrs:serviceBeans>
>>>
>>> <jaxrs:providers>
>>> <ref bean="aegisProvider"/>
>>> </jaxrs:providers>
>>>
>>> Here is the impl method:
>>>
>>>  @POST
>>>  @Path("/execute")
>>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>>
>>> and ExecuteRequest bean class:
>>>
>>> @XmlRootElement
>>> public class ExecuteRequest extends WSBaseRequest
>>> {
>>>  private String scriptName;
>>>  private Map<String, String> params;
>>>
>>>  getters..
>>>  setters..
>>> }
>>
>> It won't work, not at the moment. List<String> will be ok, provided you
>> have a query like scriptName=bar&name=a&name=b.
>> But it's not possible to 'connect' a sequence of name/value pairs with a
>> Map instance at the moment. Can you please post a sample
>> query so that I can see why you expect a Map being injected ? Also note
>> that no JAXB is involved when parameter beans are populated.
>>
>> What should work well is introducing a ParameterBean and have
>> public class ExecuteRequest extends WSBaseRequest
>> {
>>   private String scriptName;
>>   private ParametersBean params;
>>>
>>>  getters..
>>>  setters..
>> }
>>
>> and then do scriptName=bar&params.param1=a&params.param2=b
>>
>> where ParametersBean has setters/getters for param1 & param2
>>
>> cheers, Sergey
>>
>>>
>>>
>>> Sergey Beryozkin-2 wrote:
>>>>
>>>> Hi
>>>>
>>>> I really need more information please. Which bean, a JAXB one, with one
>>>> of
>>>> its fields being of Map type ?
>>>> Is it a form submission ? what is the resource method signature ?
>>>>
>>>> thanks, Sergey
>>>>
>>>>>
>>>>> Must be a simple one for anyone already done it.
>>>>> I have tried it today and couldn't figure out why it would not
>>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>>> There seem to be a bug open on this, but I'm not sure if there
>>>>> is still an issue and if so is there a way to do this?
>>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>>> with null set instead of the map with key value pairs.
>>>>>
>>>>> Thanks,
>>>>> -Vitaly
>>>>> -- 
>>>>> View this message in context:
>>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: 
> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: CXF REST Map as argument can it handle it?

Posted by vickatvuuch <vl...@gmail.com>.
Thanks, I understand your suggestion, however the destination of these params
is a groovy script which is why I wanted to piece together params as name
value pairs 
and map is what fits best. My understanding that passing a map is an open
issue under CXF
is it?


Sergey Beryozkin-2 wrote:
> 
> Hi,
> 
>>
>> Here is spring config:
>>
>> <jaxrs:server address="/v1/rest">
>> <jaxrs:serviceBeans>
>> <ref bean="scriptoServiceBean"/>
>> </jaxrs:serviceBeans>
>>
>> <jaxrs:providers>
>> <ref bean="aegisProvider"/>
>> </jaxrs:providers>
>>
>> Here is the impl method:
>>
>>  @POST
>>  @Path("/execute")
>>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>>
>> and ExecuteRequest bean class:
>>
>> @XmlRootElement
>> public class ExecuteRequest extends WSBaseRequest
>> {
>>  private String scriptName;
>>  private Map<String, String> params;
>>
>>  getters..
>>  setters..
>> }
> 
> It won't work, not at the moment. List<String> will be ok, provided you
> have a query like scriptName=bar&name=a&name=b.
> But it's not possible to 'connect' a sequence of name/value pairs with a
> Map instance at the moment. Can you please post a sample 
> query so that I can see why you expect a Map being injected ? Also note
> that no JAXB is involved when parameter beans are populated.
> 
> What should work well is introducing a ParameterBean and have
> public class ExecuteRequest extends WSBaseRequest
> {
>   private String scriptName;
>   private ParametersBean params;
>>
>>  getters..
>>  setters..
> }
> 
> and then do scriptName=bar&params.param1=a&params.param2=b
> 
> where ParametersBean has setters/getters for param1 & param2
> 
> cheers, Sergey
> 
>>
>>
>> Sergey Beryozkin-2 wrote:
>>>
>>> Hi
>>>
>>> I really need more information please. Which bean, a JAXB one, with one
>>> of
>>> its fields being of Map type ?
>>> Is it a form submission ? what is the resource method signature ?
>>>
>>> thanks, Sergey
>>>
>>>>
>>>> Must be a simple one for anyone already done it.
>>>> I have tried it today and couldn't figure out why it would not
>>>> initialize my bean with a Map in it, anyone knows the trick?
>>>> There seem to be a bug open on this, but I'm not sure if there
>>>> is still an issue and if so is there a way to do this?
>>>> Tried to post app xml in the POST body and on the Url all ends up
>>>> with null set instead of the map with key value pairs.
>>>>
>>>> Thanks,
>>>> -Vitaly
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26320714.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF REST Map as argument can it handle it?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi,

>
> Here is spring config:
>
> <jaxrs:server address="/v1/rest">
> <jaxrs:serviceBeans>
> <ref bean="scriptoServiceBean"/>
> </jaxrs:serviceBeans>
>
> <jaxrs:providers>
> <ref bean="aegisProvider"/>
> </jaxrs:providers>
>
> Here is the impl method:
>
>  @POST
>  @Path("/execute")
>  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)
>
> and ExecuteRequest bean class:
>
> @XmlRootElement
> public class ExecuteRequest extends WSBaseRequest
> {
>  private String scriptName;
>  private Map<String, String> params;
>
>  getters..
>  setters..
> }

It won't work, not at the moment. List<String> will be ok, provided you have a query like scriptName=bar&name=a&name=b.
But it's not possible to 'connect' a sequence of name/value pairs with a Map instance at the moment. Can you please post a sample 
query so that I can see why you expect a Map being injected ? Also note that no JAXB is involved when parameter beans are populated.

What should work well is introducing a ParameterBean and have
public class ExecuteRequest extends WSBaseRequest
{
  private String scriptName;
  private ParametersBean params;
>
>  getters..
>  setters..
}

and then do scriptName=bar&params.param1=a&params.param2=b

where ParametersBean has setters/getters for param1 & param2

cheers, Sergey

>
>
> Sergey Beryozkin-2 wrote:
>>
>> Hi
>>
>> I really need more information please. Which bean, a JAXB one, with one of
>> its fields being of Map type ?
>> Is it a form submission ? what is the resource method signature ?
>>
>> thanks, Sergey
>>
>>>
>>> Must be a simple one for anyone already done it.
>>> I have tried it today and couldn't figure out why it would not
>>> initialize my bean with a Map in it, anyone knows the trick?
>>> There seem to be a bug open on this, but I'm not sure if there
>>> is still an issue and if so is there a way to do this?
>>> Tried to post app xml in the POST body and on the Url all ends up
>>> with null set instead of the map with key value pairs.
>>>
>>> Thanks,
>>> -Vitaly
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: 
> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: CXF REST Map as argument can it handle it?

Posted by vickatvuuch <vl...@gmail.com>.
Here is spring config:

	<jaxrs:server address="/v1/rest">
		<jaxrs:serviceBeans>
			<ref bean="scriptoServiceBean"/>
		</jaxrs:serviceBeans>
		
		<jaxrs:providers>
			<ref bean="aegisProvider"/>
		</jaxrs:providers>

Here is the impl method:

  @POST
  @Path("/execute")
  public ExecuteResult execute(@QueryParam("") ExecuteRequest req)

and ExecuteRequest bean class:

@XmlRootElement
public class ExecuteRequest extends WSBaseRequest
{
  private String scriptName;
  private Map<String, String> params;

  getters..
  setters..
}


Sergey Beryozkin-2 wrote:
> 
> Hi
> 
> I really need more information please. Which bean, a JAXB one, with one of
> its fields being of Map type ?
> Is it a form submission ? what is the resource method signature ?
> 
> thanks, Sergey
> 
>>
>> Must be a simple one for anyone already done it.
>> I have tried it today and couldn't figure out why it would not
>> initialize my bean with a Map in it, anyone knows the trick?
>> There seem to be a bug open on this, but I'm not sure if there
>> is still an issue and if so is there a way to do this?
>> Tried to post app xml in the POST body and on the Url all ends up
>> with null set instead of the map with key value pairs.
>>
>> Thanks,
>> -Vitaly
>> -- 
>> View this message in context: 
>> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26318928.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF REST Map as argument can it handle it?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

I really need more information please. Which bean, a JAXB one, with one of its fields being of Map type ?
Is it a form submission ? what is the resource method signature ?

thanks, Sergey

>
> Must be a simple one for anyone already done it.
> I have tried it today and couldn't figure out why it would not
> initialize my bean with a Map in it, anyone knows the trick?
> There seem to be a bug open on this, but I'm not sure if there
> is still an issue and if so is there a way to do this?
> Tried to post app xml in the POST body and on the Url all ends up
> with null set instead of the map with key value pairs.
>
> Thanks,
> -Vitaly
> -- 
> View this message in context: 
> http://old.nabble.com/CXF-REST-Map%3CString%2C-String%3E-as-argument-can-it-handle-it--tp26312629p26312629.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>