You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Biju Nair <bi...@gmail.com> on 2011/05/10 21:29:27 UTC

Custom Reuqest Param Name for Bean Request Object

Hi Team,

Currently I was helping a team in building rest based services using CXF. I
noticed that for bean based service arguments (*Ex. String
getData(@FormParam("") TestObj tObj)*)
you have to include @FormParam with empty qualifer name and the request
parameter should follow bean property naming conventions. Say example
if TestObj has a property 'userName' (which is java style) then the request
parameter should be userName=Joe.
But in our requirement (mostly everywhere) the request parameters need not
use the Java Style. Here we were asked to use 'user.name'.

I know for non-bean based parameters CXF supports this as @FormParam("
user.name") String userName, Is this possible for Bean Based also?

As part of providing solution to team, I wrote a CXF Request Handler,
which transforms all the request based parmeters to bean based.
Now the TestObj will looks like,
class TestObject {
       @RequestParam("user.name")
       String userName;
...
}
Using the @ReuestParam I will be identifying the actual request param.
The component I wrote supports primitives, nested beans and collections
also.

*My Suggestion is can you include this feature in next version of CXF? and
Can I contribute my code?*

Biju B

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
I will look into the fillInValues... and will accomodate the Map.


On Wed, Jun 8, 2011 at 1:24 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Your patch has been applied with few minor modificatios.
> Many thanks for your help, apologies for a delay in dealing with it
>
> Have a look please at the client side, the proxies can 'unwrap'
> parameter beans, so InjectionUtils.fillInValuesFromBean
> maya need to be updated a bit for Map properties handled as well. Both
> client proxies and WADLGenerator will use this function and properly
> represent parameter bean values as query or form or path params
>
> thanks, Sergey
>
> On Wed, Jun 8, 2011 at 5:52 PM, Biju Nair <bi...@gmail.com> wrote:
> > Did you get chance to look into the new code? Does it satisfy your
> > requirement?
> >
> > Biju B
> >
> > On Sun, Jun 5, 2011 at 12:28 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >
> >> Updated JIRA with path and modified files for the new implementation...
> >>
> >>
> >> On Fri, Jun 3, 2011 at 1:52 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >>
> >>> Your patch contains empty (if) branches so that can not be committed;
> >>> Allowing for Map<String,Primitive> will result in all but the last
> >>> name/value pairs with identical names being lost
> >>>
> >>> Does it make sense ?
> >>> Cheers, Sergey
> >>>
> >>> On Fri, Jun 3, 2011 at 1:22 AM, Biju Nair <bi...@gmail.com>
> wrote:
> >>> > I am confused on what you mean by "empty branches", can you just
> >>> elaborate?
> >>> >
> >>> > Do you mean we need to have only Map<String,List<Primitive>> and not
> >>> > Map<String,Primitive>?
> >>> >
> >>> > On Thu, Jun 2, 2011 at 1:46 PM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >>> >wrote:
> >>> >
> >>> >> Please check a previous message, we need a better Map check and no
> >>> >> empty branches
> >>> >>
> >>> >> thanks, Sergey
> >>> >>
> >>> >> On Thu, Jun 2, 2011 at 6:37 PM, Biju Nair <bi...@gmail.com>
> >>> wrote:
> >>> >> > Yes I can help you in improving. Let me know what needs to be
> done.
> >>> >> >
> >>> >> > On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <
> >>> sberyozkin@gmail.com
> >>> >> >wrote:
> >>> >> >
> >>> >> >> I did. It needs a bit more work and I'll need to allocate some
> time
> >>> to
> >>> >> >> add a test and see what needs to be improved, ex, having empty if
> >>> >> >> branches is not possible. Realistically, it has to be Map<String,
> >>> >> >> List<Primitive>> (where Primitive is String or Integer/etc, to
> >>> handle
> >>> >> >> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
> >>> >> >> return false if not (this can help with eliminating empty
> branches).
> >>> >> >> Would you like to improve this patch a bit ? I can do some test
> once
> >>> >> >> it's ready, but I can't afford at all to look into improving the
> >>> patch
> >>> >> >> right now...
> >>> >> >>
> >>> >> >> Thanks, Sergey
> >>> >> >>
> >>> >> >> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <
> biju74techie@gmail.com>
> >>> >> wrote:
> >>> >> >> > Did you get chance to look into this?
> >>> >> >> >
> >>> >> >> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <
> >>> >> sberyozkin@gmail.com
> >>> >> >> >wrote:
> >>> >> >> >
> >>> >> >> >> Sorry, not yet, hoping to do it shortly
> >>> >> >> >>
> >>> >> >> >> Sergey
> >>> >> >> >>
> >>> >> >> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <
> >>> biju74techie@gmail.com>
> >>> >> >> wrote:
> >>> >> >> >> > did you get chance to update the patch and test it?
> >>> >> >> >> >
> >>> >> >> >> > Biju
> >>> >> >> >> >
> >>> >> >> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <
> >>> biju74techie@gmail.com
> >>> >> >
> >>> >> >> >> wrote:
> >>> >> >> >> >
> >>> >> >> >> >> Attached the path in JIRA.
> >>> >> >> >> >>
> >>> >> >> >> >> Attaching with this mail also.
> >>> >> >> >> >>
> >>> >> >> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
> >>> >> >> >> sberyozkin@gmail.com>wrote:
> >>> >> >> >> >>
> >>> >> >> >> >>> Hi
> >>> >> >> >> >>>
> >>> >> >> >> >>> Can you attach the updated patch to JIRA please ? I'm not
> >>> seeing
> >>> >> a
> >>> >> >> >> >>> patch attached to your email message.
> >>> >> >> >> >>>
> >>> >> >> >> >>> Supporting explicit Lists for JAX-RS param annotations
> >>> >> (@PathParam,
> >>> >> >> >> >>> etc) is a JAX-RS spec requirement.
> >>> >> >> >> >>> Supporting explicit Lists which are mapped to request
> >>> payloads or
> >>> >> >> >> >>> responses is the extensions. All JAX-RS stacks are
> probably
> >>> >> >> supporting
> >>> >> >> >> >>> it, but that is an extension.
> >>> >> >> >> >>> Supporting MultivaluedMap in case of form submissions is a
> >>> spec
> >>> >> >> >> >>> requirement as well. It really only makes sense for form
> >>> >> payloads.
> >>> >> >> The
> >>> >> >> >> >>> only other exception is probably QueryParams and may be
> >>> >> >> HeaderParams,
> >>> >> >> >> >>> but it has to be a MultivaluedMap for a single
> key/multiple
> >>> >> values
> >>> >> >> >> >>> case to work.
> >>> >> >> >> >>>
> >>> >> >> >> >>> Cheers, Sergey
> >>> >> >> >> >>>
> >>> >> >> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <
> >>> >> biju74techie@gmail.com>
> >>> >> >> >> >>> wrote:
> >>> >> >> >> >>> > I gave the Explict Map Support, becuase CXF was
> supporting
> >>> >> Explict
> >>> >> >> >> List
> >>> >> >> >> >>> > support.
> >>> >> >> >> >>> >
> >>> >> >> >> >>> > The code which i send you have only support for beans
> with
> >>> >> nested
> >>> >> >> Map
> >>> >> >> >> >>> > interface.
> >>> >> >> >> >>> >
> >>> >> >> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
> >>> >> >> biju74techie@gmail.com>
> >>> >> >> >> >>> wrote:
> >>> >> >> >> >>> >
> >>> >> >> >> >>> >> That was my mistake. I was using Eclipse IDE and I
> >>> formatted
> >>> >> the
> >>> >> >> >> java
> >>> >> >> >> >>> file,
> >>> >> >> >> >>> >> so the whole file got messed up.
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >> I revereted the changes and made support only for bean
> >>> with
> >>> >> >> nested
> >>> >> >> >> Map
> >>> >> >> >> >>> >> interface (FormParam(""),QueryParam("")..)
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >> Attaching the changed file with this mail.
> >>> >> >> >> >>> >> ------------------------------
> >>> >> >> >> >>> >> Details,
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >> Modified the changes only for supporting map's
> interface
> >>> only
> >>> >> >> inside
> >>> >> >> >> >>> beans.
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >> Classes Changed,
> >>> >> >> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >> Methods Changed
> >>> >> >> >> >>> >> public static Object handleBean(...) - Added another if
> >>> clause
> >>> >> >> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >> Methods Added
> >>> >> >> >> >>> >> isSupportedMap
> >>> >> >> >> >>> >> mergeMap
> >>> >> >> >> >>> >> convertMultimapToMap
> >>> >> >> >> >>> >> injectIntoMap
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >> --------------------------
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
> >>> >> >> >> >>> sberyozkin@gmail.com>wrote:
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >>> Actually, I can see you modifying the code for
> explicit
> >>> Maps
> >>> >> be
> >>> >> >> >> >>> >>> supported as well.
> >>> >> >> >> >>> >>>
> >>> >> >> >> >>> >>> That is not a bad idea but I'd prefer for one issue
> (to
> >>> do
> >>> >> with
> >>> >> >> >> >>> >>> parameter beans containing Map fileds) addressed
> first.
> >>> >> >> >> >>> >>>
> >>> >> >> >> >>> >>> Explicit Maps can be supported right now (a bit of
> work
> >>> is
> >>> >> >> needed
> >>> >> >> >> to
> >>> >> >> >> >>> >>> register ParameterHandler to capture Form, query or
> path
> >>> >> values
> >>> >> >> or
> >>> >> >> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
> >>> >> >> >> >>> >>>
> >>> >> >> >> >>> >>> Please, simplify the patch a bit so that only a
> >>> >> 'FormParam(""),
> >>> >> >> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be
> >>> supported
> >>> >> >> >> >>> >>>
> >>> >> >> >> >>> >>> thanks, Sergey
> >>> >> >> >> >>> >>>
> >>> >> >> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
> >>> >> >> >> >>> sberyozkin@gmail.com>
> >>> >> >> >> >>> >>> wrote:
> >>> >> >> >> >>> >>> > Hi
> >>> >> >> >> >>> >>> >
> >>> >> >> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
> >>> >> >> >> biju74techie@gmail.com
> >>> >> >> >> >>> >
> >>> >> >> >> >>> >>> wrote:
> >>> >> >> >> >>> >>> >> Updated the JIRA with DIFF file.
> >>> >> >> >> >>> >>> >>
> >>> >> >> >> >>> >>> >> May I know whether that worked.
> >>> >> >> >> >>> >>> >>
> >>> >> >> >> >>> >>> > I have problems applying the patch, as it seems like
> >>> >> >> >> InjectionUtils
> >>> >> >> >> >>> >>> > has been completely changed, I can't spot, by
> looking
> >>> at
> >>> >> the
> >>> >> >> diff
> >>> >> >> >> >>> >>> > file, what the actual changes are.
> >>> >> >> >> >>> >>> > I'm going to attach svn properties file from my
> local
> >>> >> snapshot
> >>> >> >> to
> >>> >> >> >> >>> >>> > JIRA, can you please give me a favor and try again
> with
> >>> >> those
> >>> >> >> >> >>> >>> > properties applied ?
> >>> >> >> >> >>> >>> >
> >>> >> >> >> >>> >>> > thanks, Sergey
> >>> >> >> >> >>> >>> >
> >>> >> >> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
> >>> >> >> >> >>> >>> sberyozkin@gmail.com>wrote:
> >>> >> >> >> >>> >>> >>
> >>> >> >> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
> >>> >> >> >> >>> >>> >>> Please update your local snapshot and create a
> patch
> >>> >> >> >> >>> >>> >>>
> >>> >> >> >> >>> >>> >>> thanks, Sergey
> >>> >> >> >> >>> >>> >>>
> >>> >> >> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
> >>> >> >> >> >>> biju74techie@gmail.com>
> >>> >> >> >> >>> >>> wrote:
> >>> >> >> >> >>> >>> >>> > Created JIRA - CXF-3529
> >>> >> >> >> >>> >>> >>> >
> >>> >> >> >> >>> >>> >>> > Let me know what is the next step?
> >>> >> >> >> >>> >>> >>> >
> >>> >> >> >> >>> >>> >>> > Biju
> >>> >> >> >> >>> >>> >>> >
> >>> >> >> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey
> Beryozkin <
> >>> >> >> >> >>> >>> sberyozkin@gmail.com
> >>> >> >> >> >>> >>> >>> >wrote:
> >>> >> >> >> >>> >>> >>> >
> >>> >> >> >> >>> >>> >>> >> Hi
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
> >>> >> >> >> >>> biju74techie@gmail.com
> >>> >> >> >> >>> >>> >
> >>> >> >> >> >>> >>> >>> wrote:
> >>> >> >> >> >>> >>> >>> >> > Added the Map feature for service level and
> bean
> >>> >> level.
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >> > I was not able to check-in the files, so
> >>> attaching
> >>> >> the
> >>> >> >> >> same.
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >> I don't see an attachment, but what you need to
> do
> >>> is
> >>> >> to
> >>> >> >> >> create
> >>> >> >> >> >>> a
> >>> >> >> >> >>> >>> CXF
> >>> >> >> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >> > Following are the changes,
> >>> >> >> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
> >>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
> >>> >> >> >> >>> >>> >>> >> > -- Changed Signature of
> >>> >> >> >> InjectionUtils.createParameterObject
> >>> >> >> >> >>> >>> >>> >> > -- Modified handleBean
> >>> >> >> >> >>> >>> >>> >> > -- Modified createParameterObject
> >>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
> >>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
> >>> >> >> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
> >>> >> >> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >> > The code is tested with sample services like,
> >>> >> >> >> >>> >>> >>> >> > public String
> debug(@FormParam("")TestEmployeeTO
> >>> >> >> >> >>> >>> >>> >> > testObject1,@FormParam("map")
> >>> Map<String,Integer>
> >>> >> map)
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >> > public class TestEmployeeTO  {
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >> >  //getters/setters
> >>> >> >> >> >>> >>> >>> >> > }
> >>> >> >> >> >>> >>> >>> >> > Input Data
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >>> >> >> >> >>> >>> >>> >> > Output
> >>> >> >> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR,
> USA=DOLLAR}]
> >>> >> >> >> >>> >>> >>> >> > map={y=9, x=11}
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >> thanks, Sergey
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >> > Please verify and let me know is this is
> good.
> >>> >> >> >> >>> >>> >>> >> >
> >>> >> >> >> >>> >>> >>> >> > Biju B
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >> --
> >>> >> >> >> >>> >>> >>> >>  Sergey Beryozkin
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >> Application Integration Division of Talend
> >>> >> >> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
> >>> >> >> >> >>> >>> >>> >>
> >>> >> >> >> >>> >>> >>> >
> >>> >> >> >> >>> >>> >>>
> >>> >> >> >> >>> >>> >>
> >>> >> >> >> >>> >>> >
> >>> >> >> >> >>> >>>
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >>
> >>> >> >> >> >>> >
> >>> >> >> >> >>>
> >>> >> >> >> >>>
> >>> >> >> >> >>>
> >>> >> >> >> >>> --
> >>> >> >> >> >>>  Sergey Beryozkin
> >>> >> >> >> >>>
> >>> >> >> >> >>> Application Integration Division of Talend
> >>> >> >> >> >>> http://sberyozkin.blogspot.com
> >>> >> >> >> >>>
> >>> >> >> >> >>
> >>> >> >> >> >>
> >>> >> >> >> >
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> --
> >>> >> >> >>  Sergey Beryozkin
> >>> >> >> >>
> >>> >> >> >> Application Integration Division of Talend
> >>> >> >> >> http://sberyozkin.blogspot.com
> >>> >> >> >>
> >>> >> >> >
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >> --
> >>> >> >>  Sergey Beryozkin
> >>> >> >>
> >>> >> >> Application Integration Division of Talend
> >>> >> >> http://sberyozkin.blogspot.com
> >>> >> >>
> >>> >> >
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >>  Sergey Beryozkin
> >>> >>
> >>> >> Application Integration Division of Talend
> >>> >> http://sberyozkin.blogspot.com
> >>> >>
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>>  Sergey Beryozkin
> >>>
> >>> Application Integration Division of Talend
> >>> http://sberyozkin.blogspot.com
> >>>
> >>
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
Your patch has been applied with few minor modificatios.
Many thanks for your help, apologies for a delay in dealing with it

Have a look please at the client side, the proxies can 'unwrap'
parameter beans, so InjectionUtils.fillInValuesFromBean
maya need to be updated a bit for Map properties handled as well. Both
client proxies and WADLGenerator will use this function and properly
represent parameter bean values as query or form or path params

thanks, Sergey

On Wed, Jun 8, 2011 at 5:52 PM, Biju Nair <bi...@gmail.com> wrote:
> Did you get chance to look into the new code? Does it satisfy your
> requirement?
>
> Biju B
>
> On Sun, Jun 5, 2011 at 12:28 PM, Biju Nair <bi...@gmail.com> wrote:
>
>> Updated JIRA with path and modified files for the new implementation...
>>
>>
>> On Fri, Jun 3, 2011 at 1:52 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>>
>>> Your patch contains empty (if) branches so that can not be committed;
>>> Allowing for Map<String,Primitive> will result in all but the last
>>> name/value pairs with identical names being lost
>>>
>>> Does it make sense ?
>>> Cheers, Sergey
>>>
>>> On Fri, Jun 3, 2011 at 1:22 AM, Biju Nair <bi...@gmail.com> wrote:
>>> > I am confused on what you mean by "empty branches", can you just
>>> elaborate?
>>> >
>>> > Do you mean we need to have only Map<String,List<Primitive>> and not
>>> > Map<String,Primitive>?
>>> >
>>> > On Thu, Jun 2, 2011 at 1:46 PM, Sergey Beryozkin <sberyozkin@gmail.com
>>> >wrote:
>>> >
>>> >> Please check a previous message, we need a better Map check and no
>>> >> empty branches
>>> >>
>>> >> thanks, Sergey
>>> >>
>>> >> On Thu, Jun 2, 2011 at 6:37 PM, Biju Nair <bi...@gmail.com>
>>> wrote:
>>> >> > Yes I can help you in improving. Let me know what needs to be done.
>>> >> >
>>> >> > On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <
>>> sberyozkin@gmail.com
>>> >> >wrote:
>>> >> >
>>> >> >> I did. It needs a bit more work and I'll need to allocate some time
>>> to
>>> >> >> add a test and see what needs to be improved, ex, having empty if
>>> >> >> branches is not possible. Realistically, it has to be Map<String,
>>> >> >> List<Primitive>> (where Primitive is String or Integer/etc, to
>>> handle
>>> >> >> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
>>> >> >> return false if not (this can help with eliminating empty branches).
>>> >> >> Would you like to improve this patch a bit ? I can do some test once
>>> >> >> it's ready, but I can't afford at all to look into improving the
>>> patch
>>> >> >> right now...
>>> >> >>
>>> >> >> Thanks, Sergey
>>> >> >>
>>> >> >> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com>
>>> >> wrote:
>>> >> >> > Did you get chance to look into this?
>>> >> >> >
>>> >> >> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <
>>> >> sberyozkin@gmail.com
>>> >> >> >wrote:
>>> >> >> >
>>> >> >> >> Sorry, not yet, hoping to do it shortly
>>> >> >> >>
>>> >> >> >> Sergey
>>> >> >> >>
>>> >> >> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <
>>> biju74techie@gmail.com>
>>> >> >> wrote:
>>> >> >> >> > did you get chance to update the patch and test it?
>>> >> >> >> >
>>> >> >> >> > Biju
>>> >> >> >> >
>>> >> >> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <
>>> biju74techie@gmail.com
>>> >> >
>>> >> >> >> wrote:
>>> >> >> >> >
>>> >> >> >> >> Attached the path in JIRA.
>>> >> >> >> >>
>>> >> >> >> >> Attaching with this mail also.
>>> >> >> >> >>
>>> >> >> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
>>> >> >> >> sberyozkin@gmail.com>wrote:
>>> >> >> >> >>
>>> >> >> >> >>> Hi
>>> >> >> >> >>>
>>> >> >> >> >>> Can you attach the updated patch to JIRA please ? I'm not
>>> seeing
>>> >> a
>>> >> >> >> >>> patch attached to your email message.
>>> >> >> >> >>>
>>> >> >> >> >>> Supporting explicit Lists for JAX-RS param annotations
>>> >> (@PathParam,
>>> >> >> >> >>> etc) is a JAX-RS spec requirement.
>>> >> >> >> >>> Supporting explicit Lists which are mapped to request
>>> payloads or
>>> >> >> >> >>> responses is the extensions. All JAX-RS stacks are probably
>>> >> >> supporting
>>> >> >> >> >>> it, but that is an extension.
>>> >> >> >> >>> Supporting MultivaluedMap in case of form submissions is a
>>> spec
>>> >> >> >> >>> requirement as well. It really only makes sense for form
>>> >> payloads.
>>> >> >> The
>>> >> >> >> >>> only other exception is probably QueryParams and may be
>>> >> >> HeaderParams,
>>> >> >> >> >>> but it has to be a MultivaluedMap for a single key/multiple
>>> >> values
>>> >> >> >> >>> case to work.
>>> >> >> >> >>>
>>> >> >> >> >>> Cheers, Sergey
>>> >> >> >> >>>
>>> >> >> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <
>>> >> biju74techie@gmail.com>
>>> >> >> >> >>> wrote:
>>> >> >> >> >>> > I gave the Explict Map Support, becuase CXF was supporting
>>> >> Explict
>>> >> >> >> List
>>> >> >> >> >>> > support.
>>> >> >> >> >>> >
>>> >> >> >> >>> > The code which i send you have only support for beans with
>>> >> nested
>>> >> >> Map
>>> >> >> >> >>> > interface.
>>> >> >> >> >>> >
>>> >> >> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
>>> >> >> biju74techie@gmail.com>
>>> >> >> >> >>> wrote:
>>> >> >> >> >>> >
>>> >> >> >> >>> >> That was my mistake. I was using Eclipse IDE and I
>>> formatted
>>> >> the
>>> >> >> >> java
>>> >> >> >> >>> file,
>>> >> >> >> >>> >> so the whole file got messed up.
>>> >> >> >> >>> >>
>>> >> >> >> >>> >> I revereted the changes and made support only for bean
>>> with
>>> >> >> nested
>>> >> >> >> Map
>>> >> >> >> >>> >> interface (FormParam(""),QueryParam("")..)
>>> >> >> >> >>> >>
>>> >> >> >> >>> >> Attaching the changed file with this mail.
>>> >> >> >> >>> >> ------------------------------
>>> >> >> >> >>> >> Details,
>>> >> >> >> >>> >>
>>> >> >> >> >>> >> Modified the changes only for supporting map's interface
>>> only
>>> >> >> inside
>>> >> >> >> >>> beans.
>>> >> >> >> >>> >>
>>> >> >> >> >>> >> Classes Changed,
>>> >> >> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
>>> >> >> >> >>> >>
>>> >> >> >> >>> >> Methods Changed
>>> >> >> >> >>> >> public static Object handleBean(...) - Added another if
>>> clause
>>> >> >> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
>>> >> >> >> >>> >>
>>> >> >> >> >>> >> Methods Added
>>> >> >> >> >>> >> isSupportedMap
>>> >> >> >> >>> >> mergeMap
>>> >> >> >> >>> >> convertMultimapToMap
>>> >> >> >> >>> >> injectIntoMap
>>> >> >> >> >>> >>
>>> >> >> >> >>> >> --------------------------
>>> >> >> >> >>> >>
>>> >> >> >> >>> >>
>>> >> >> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
>>> >> >> >> >>> sberyozkin@gmail.com>wrote:
>>> >> >> >> >>> >>
>>> >> >> >> >>> >>> Actually, I can see you modifying the code for explicit
>>> Maps
>>> >> be
>>> >> >> >> >>> >>> supported as well.
>>> >> >> >> >>> >>>
>>> >> >> >> >>> >>> That is not a bad idea but I'd prefer for one issue (to
>>> do
>>> >> with
>>> >> >> >> >>> >>> parameter beans containing Map fileds) addressed first.
>>> >> >> >> >>> >>>
>>> >> >> >> >>> >>> Explicit Maps can be supported right now (a bit of work
>>> is
>>> >> >> needed
>>> >> >> >> to
>>> >> >> >> >>> >>> register ParameterHandler to capture Form, query or path
>>> >> values
>>> >> >> or
>>> >> >> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
>>> >> >> >> >>> >>>
>>> >> >> >> >>> >>> Please, simplify the patch a bit so that only a
>>> >> 'FormParam(""),
>>> >> >> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be
>>> supported
>>> >> >> >> >>> >>>
>>> >> >> >> >>> >>> thanks, Sergey
>>> >> >> >> >>> >>>
>>> >> >> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
>>> >> >> >> >>> sberyozkin@gmail.com>
>>> >> >> >> >>> >>> wrote:
>>> >> >> >> >>> >>> > Hi
>>> >> >> >> >>> >>> >
>>> >> >> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
>>> >> >> >> biju74techie@gmail.com
>>> >> >> >> >>> >
>>> >> >> >> >>> >>> wrote:
>>> >> >> >> >>> >>> >> Updated the JIRA with DIFF file.
>>> >> >> >> >>> >>> >>
>>> >> >> >> >>> >>> >> May I know whether that worked.
>>> >> >> >> >>> >>> >>
>>> >> >> >> >>> >>> > I have problems applying the patch, as it seems like
>>> >> >> >> InjectionUtils
>>> >> >> >> >>> >>> > has been completely changed, I can't spot, by looking
>>> at
>>> >> the
>>> >> >> diff
>>> >> >> >> >>> >>> > file, what the actual changes are.
>>> >> >> >> >>> >>> > I'm going to attach svn properties file from my local
>>> >> snapshot
>>> >> >> to
>>> >> >> >> >>> >>> > JIRA, can you please give me a favor and try again with
>>> >> those
>>> >> >> >> >>> >>> > properties applied ?
>>> >> >> >> >>> >>> >
>>> >> >> >> >>> >>> > thanks, Sergey
>>> >> >> >> >>> >>> >
>>> >> >> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>>> >> >> >> >>> >>> sberyozkin@gmail.com>wrote:
>>> >> >> >> >>> >>> >>
>>> >> >> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
>>> >> >> >> >>> >>> >>> Please update your local snapshot and create a patch
>>> >> >> >> >>> >>> >>>
>>> >> >> >> >>> >>> >>> thanks, Sergey
>>> >> >> >> >>> >>> >>>
>>> >> >> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
>>> >> >> >> >>> biju74techie@gmail.com>
>>> >> >> >> >>> >>> wrote:
>>> >> >> >> >>> >>> >>> > Created JIRA - CXF-3529
>>> >> >> >> >>> >>> >>> >
>>> >> >> >> >>> >>> >>> > Let me know what is the next step?
>>> >> >> >> >>> >>> >>> >
>>> >> >> >> >>> >>> >>> > Biju
>>> >> >> >> >>> >>> >>> >
>>> >> >> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>>> >> >> >> >>> >>> sberyozkin@gmail.com
>>> >> >> >> >>> >>> >>> >wrote:
>>> >> >> >> >>> >>> >>> >
>>> >> >> >> >>> >>> >>> >> Hi
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
>>> >> >> >> >>> biju74techie@gmail.com
>>> >> >> >> >>> >>> >
>>> >> >> >> >>> >>> >>> wrote:
>>> >> >> >> >>> >>> >>> >> > Added the Map feature for service level and bean
>>> >> level.
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >> > I was not able to check-in the files, so
>>> attaching
>>> >> the
>>> >> >> >> same.
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >> I don't see an attachment, but what you need to do
>>> is
>>> >> to
>>> >> >> >> create
>>> >> >> >> >>> a
>>> >> >> >> >>> >>> CXF
>>> >> >> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >> > Following are the changes,
>>> >> >> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
>>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>>> >> >> >> >>> >>> >>> >> > -- Changed Signature of
>>> >> >> >> InjectionUtils.createParameterObject
>>> >> >> >> >>> >>> >>> >> > -- Modified handleBean
>>> >> >> >> >>> >>> >>> >> > -- Modified createParameterObject
>>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
>>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
>>> >> >> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
>>> >> >> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >> > The code is tested with sample services like,
>>> >> >> >> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>>> >> >> >> >>> >>> >>> >> > testObject1,@FormParam("map")
>>> Map<String,Integer>
>>> >> map)
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >> > public class TestEmployeeTO  {
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >> >  //getters/setters
>>> >> >> >> >>> >>> >>> >> > }
>>> >> >> >> >>> >>> >>> >> > Input Data
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>>> >> >> >> >>> >>> >>> >> > Output
>>> >> >> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>>> >> >> >> >>> >>> >>> >> > map={y=9, x=11}
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >> thanks, Sergey
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >> > Please verify and let me know is this is good.
>>> >> >> >> >>> >>> >>> >> >
>>> >> >> >> >>> >>> >>> >> > Biju B
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >> --
>>> >> >> >> >>> >>> >>> >>  Sergey Beryozkin
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >> Application Integration Division of Talend
>>> >> >> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
>>> >> >> >> >>> >>> >>> >>
>>> >> >> >> >>> >>> >>> >
>>> >> >> >> >>> >>> >>>
>>> >> >> >> >>> >>> >>
>>> >> >> >> >>> >>> >
>>> >> >> >> >>> >>>
>>> >> >> >> >>> >>
>>> >> >> >> >>> >>
>>> >> >> >> >>> >
>>> >> >> >> >>>
>>> >> >> >> >>>
>>> >> >> >> >>>
>>> >> >> >> >>> --
>>> >> >> >> >>>  Sergey Beryozkin
>>> >> >> >> >>>
>>> >> >> >> >>> Application Integration Division of Talend
>>> >> >> >> >>> http://sberyozkin.blogspot.com
>>> >> >> >> >>>
>>> >> >> >> >>
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> --
>>> >> >> >>  Sergey Beryozkin
>>> >> >> >>
>>> >> >> >> Application Integration Division of Talend
>>> >> >> >> http://sberyozkin.blogspot.com
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >>  Sergey Beryozkin
>>> >> >>
>>> >> >> Application Integration Division of Talend
>>> >> >> http://sberyozkin.blogspot.com
>>> >> >>
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >>  Sergey Beryozkin
>>> >>
>>> >> Application Integration Division of Talend
>>> >> http://sberyozkin.blogspot.com
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>>  Sergey Beryozkin
>>>
>>> Application Integration Division of Talend
>>> http://sberyozkin.blogspot.com
>>>
>>
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Did you get chance to look into the new code? Does it satisfy your
requirement?

Biju B

On Sun, Jun 5, 2011 at 12:28 PM, Biju Nair <bi...@gmail.com> wrote:

> Updated JIRA with path and modified files for the new implementation...
>
>
> On Fri, Jun 3, 2011 at 1:52 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Your patch contains empty (if) branches so that can not be committed;
>> Allowing for Map<String,Primitive> will result in all but the last
>> name/value pairs with identical names being lost
>>
>> Does it make sense ?
>> Cheers, Sergey
>>
>> On Fri, Jun 3, 2011 at 1:22 AM, Biju Nair <bi...@gmail.com> wrote:
>> > I am confused on what you mean by "empty branches", can you just
>> elaborate?
>> >
>> > Do you mean we need to have only Map<String,List<Primitive>> and not
>> > Map<String,Primitive>?
>> >
>> > On Thu, Jun 2, 2011 at 1:46 PM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Please check a previous message, we need a better Map check and no
>> >> empty branches
>> >>
>> >> thanks, Sergey
>> >>
>> >> On Thu, Jun 2, 2011 at 6:37 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > Yes I can help you in improving. Let me know what needs to be done.
>> >> >
>> >> > On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com
>> >> >wrote:
>> >> >
>> >> >> I did. It needs a bit more work and I'll need to allocate some time
>> to
>> >> >> add a test and see what needs to be improved, ex, having empty if
>> >> >> branches is not possible. Realistically, it has to be Map<String,
>> >> >> List<Primitive>> (where Primitive is String or Integer/etc, to
>> handle
>> >> >> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
>> >> >> return false if not (this can help with eliminating empty branches).
>> >> >> Would you like to improve this patch a bit ? I can do some test once
>> >> >> it's ready, but I can't afford at all to look into improving the
>> patch
>> >> >> right now...
>> >> >>
>> >> >> Thanks, Sergey
>> >> >>
>> >> >> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com>
>> >> wrote:
>> >> >> > Did you get chance to look into this?
>> >> >> >
>> >> >> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <
>> >> sberyozkin@gmail.com
>> >> >> >wrote:
>> >> >> >
>> >> >> >> Sorry, not yet, hoping to do it shortly
>> >> >> >>
>> >> >> >> Sergey
>> >> >> >>
>> >> >> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <
>> biju74techie@gmail.com>
>> >> >> wrote:
>> >> >> >> > did you get chance to update the patch and test it?
>> >> >> >> >
>> >> >> >> > Biju
>> >> >> >> >
>> >> >> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <
>> biju74techie@gmail.com
>> >> >
>> >> >> >> wrote:
>> >> >> >> >
>> >> >> >> >> Attached the path in JIRA.
>> >> >> >> >>
>> >> >> >> >> Attaching with this mail also.
>> >> >> >> >>
>> >> >> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
>> >> >> >> sberyozkin@gmail.com>wrote:
>> >> >> >> >>
>> >> >> >> >>> Hi
>> >> >> >> >>>
>> >> >> >> >>> Can you attach the updated patch to JIRA please ? I'm not
>> seeing
>> >> a
>> >> >> >> >>> patch attached to your email message.
>> >> >> >> >>>
>> >> >> >> >>> Supporting explicit Lists for JAX-RS param annotations
>> >> (@PathParam,
>> >> >> >> >>> etc) is a JAX-RS spec requirement.
>> >> >> >> >>> Supporting explicit Lists which are mapped to request
>> payloads or
>> >> >> >> >>> responses is the extensions. All JAX-RS stacks are probably
>> >> >> supporting
>> >> >> >> >>> it, but that is an extension.
>> >> >> >> >>> Supporting MultivaluedMap in case of form submissions is a
>> spec
>> >> >> >> >>> requirement as well. It really only makes sense for form
>> >> payloads.
>> >> >> The
>> >> >> >> >>> only other exception is probably QueryParams and may be
>> >> >> HeaderParams,
>> >> >> >> >>> but it has to be a MultivaluedMap for a single key/multiple
>> >> values
>> >> >> >> >>> case to work.
>> >> >> >> >>>
>> >> >> >> >>> Cheers, Sergey
>> >> >> >> >>>
>> >> >> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <
>> >> biju74techie@gmail.com>
>> >> >> >> >>> wrote:
>> >> >> >> >>> > I gave the Explict Map Support, becuase CXF was supporting
>> >> Explict
>> >> >> >> List
>> >> >> >> >>> > support.
>> >> >> >> >>> >
>> >> >> >> >>> > The code which i send you have only support for beans with
>> >> nested
>> >> >> Map
>> >> >> >> >>> > interface.
>> >> >> >> >>> >
>> >> >> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
>> >> >> biju74techie@gmail.com>
>> >> >> >> >>> wrote:
>> >> >> >> >>> >
>> >> >> >> >>> >> That was my mistake. I was using Eclipse IDE and I
>> formatted
>> >> the
>> >> >> >> java
>> >> >> >> >>> file,
>> >> >> >> >>> >> so the whole file got messed up.
>> >> >> >> >>> >>
>> >> >> >> >>> >> I revereted the changes and made support only for bean
>> with
>> >> >> nested
>> >> >> >> Map
>> >> >> >> >>> >> interface (FormParam(""),QueryParam("")..)
>> >> >> >> >>> >>
>> >> >> >> >>> >> Attaching the changed file with this mail.
>> >> >> >> >>> >> ------------------------------
>> >> >> >> >>> >> Details,
>> >> >> >> >>> >>
>> >> >> >> >>> >> Modified the changes only for supporting map's interface
>> only
>> >> >> inside
>> >> >> >> >>> beans.
>> >> >> >> >>> >>
>> >> >> >> >>> >> Classes Changed,
>> >> >> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
>> >> >> >> >>> >>
>> >> >> >> >>> >> Methods Changed
>> >> >> >> >>> >> public static Object handleBean(...) - Added another if
>> clause
>> >> >> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
>> >> >> >> >>> >>
>> >> >> >> >>> >> Methods Added
>> >> >> >> >>> >> isSupportedMap
>> >> >> >> >>> >> mergeMap
>> >> >> >> >>> >> convertMultimapToMap
>> >> >> >> >>> >> injectIntoMap
>> >> >> >> >>> >>
>> >> >> >> >>> >> --------------------------
>> >> >> >> >>> >>
>> >> >> >> >>> >>
>> >> >> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
>> >> >> >> >>> sberyozkin@gmail.com>wrote:
>> >> >> >> >>> >>
>> >> >> >> >>> >>> Actually, I can see you modifying the code for explicit
>> Maps
>> >> be
>> >> >> >> >>> >>> supported as well.
>> >> >> >> >>> >>>
>> >> >> >> >>> >>> That is not a bad idea but I'd prefer for one issue (to
>> do
>> >> with
>> >> >> >> >>> >>> parameter beans containing Map fileds) addressed first.
>> >> >> >> >>> >>>
>> >> >> >> >>> >>> Explicit Maps can be supported right now (a bit of work
>> is
>> >> >> needed
>> >> >> >> to
>> >> >> >> >>> >>> register ParameterHandler to capture Form, query or path
>> >> values
>> >> >> or
>> >> >> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
>> >> >> >> >>> >>>
>> >> >> >> >>> >>> Please, simplify the patch a bit so that only a
>> >> 'FormParam(""),
>> >> >> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be
>> supported
>> >> >> >> >>> >>>
>> >> >> >> >>> >>> thanks, Sergey
>> >> >> >> >>> >>>
>> >> >> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
>> >> >> >> >>> sberyozkin@gmail.com>
>> >> >> >> >>> >>> wrote:
>> >> >> >> >>> >>> > Hi
>> >> >> >> >>> >>> >
>> >> >> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
>> >> >> >> biju74techie@gmail.com
>> >> >> >> >>> >
>> >> >> >> >>> >>> wrote:
>> >> >> >> >>> >>> >> Updated the JIRA with DIFF file.
>> >> >> >> >>> >>> >>
>> >> >> >> >>> >>> >> May I know whether that worked.
>> >> >> >> >>> >>> >>
>> >> >> >> >>> >>> > I have problems applying the patch, as it seems like
>> >> >> >> InjectionUtils
>> >> >> >> >>> >>> > has been completely changed, I can't spot, by looking
>> at
>> >> the
>> >> >> diff
>> >> >> >> >>> >>> > file, what the actual changes are.
>> >> >> >> >>> >>> > I'm going to attach svn properties file from my local
>> >> snapshot
>> >> >> to
>> >> >> >> >>> >>> > JIRA, can you please give me a favor and try again with
>> >> those
>> >> >> >> >>> >>> > properties applied ?
>> >> >> >> >>> >>> >
>> >> >> >> >>> >>> > thanks, Sergey
>> >> >> >> >>> >>> >
>> >> >> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>> >> >> >> >>> >>> sberyozkin@gmail.com>wrote:
>> >> >> >> >>> >>> >>
>> >> >> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
>> >> >> >> >>> >>> >>> Please update your local snapshot and create a patch
>> >> >> >> >>> >>> >>>
>> >> >> >> >>> >>> >>> thanks, Sergey
>> >> >> >> >>> >>> >>>
>> >> >> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
>> >> >> >> >>> biju74techie@gmail.com>
>> >> >> >> >>> >>> wrote:
>> >> >> >> >>> >>> >>> > Created JIRA - CXF-3529
>> >> >> >> >>> >>> >>> >
>> >> >> >> >>> >>> >>> > Let me know what is the next step?
>> >> >> >> >>> >>> >>> >
>> >> >> >> >>> >>> >>> > Biju
>> >> >> >> >>> >>> >>> >
>> >> >> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>> >> >> >> >>> >>> sberyozkin@gmail.com
>> >> >> >> >>> >>> >>> >wrote:
>> >> >> >> >>> >>> >>> >
>> >> >> >> >>> >>> >>> >> Hi
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
>> >> >> >> >>> biju74techie@gmail.com
>> >> >> >> >>> >>> >
>> >> >> >> >>> >>> >>> wrote:
>> >> >> >> >>> >>> >>> >> > Added the Map feature for service level and bean
>> >> level.
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >> > I was not able to check-in the files, so
>> attaching
>> >> the
>> >> >> >> same.
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >> I don't see an attachment, but what you need to do
>> is
>> >> to
>> >> >> >> create
>> >> >> >> >>> a
>> >> >> >> >>> >>> CXF
>> >> >> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >> > Following are the changes,
>> >> >> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>> >> >> >> >>> >>> >>> >> > -- Changed Signature of
>> >> >> >> InjectionUtils.createParameterObject
>> >> >> >> >>> >>> >>> >> > -- Modified handleBean
>> >> >> >> >>> >>> >>> >> > -- Modified createParameterObject
>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
>> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
>> >> >> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
>> >> >> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >> > The code is tested with sample services like,
>> >> >> >> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>> >> >> >> >>> >>> >>> >> > testObject1,@FormParam("map")
>> Map<String,Integer>
>> >> map)
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >> > public class TestEmployeeTO  {
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >> >  //getters/setters
>> >> >> >> >>> >>> >>> >> > }
>> >> >> >> >>> >>> >>> >> > Input Data
>> >> >> >> >>> >>> >>> >> >
>> >> >> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> >> >> >> >>> >>> >>> >> > Output
>> >> >> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> >> >> >> >>> >>> >>> >> > map={y=9, x=11}
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >> thanks, Sergey
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >> > Please verify and let me know is this is good.
>> >> >> >> >>> >>> >>> >> >
>> >> >> >> >>> >>> >>> >> > Biju B
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >> --
>> >> >> >> >>> >>> >>> >>  Sergey Beryozkin
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >> Application Integration Division of Talend
>> >> >> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
>> >> >> >> >>> >>> >>> >>
>> >> >> >> >>> >>> >>> >
>> >> >> >> >>> >>> >>>
>> >> >> >> >>> >>> >>
>> >> >> >> >>> >>> >
>> >> >> >> >>> >>>
>> >> >> >> >>> >>
>> >> >> >> >>> >>
>> >> >> >> >>> >
>> >> >> >> >>>
>> >> >> >> >>>
>> >> >> >> >>>
>> >> >> >> >>> --
>> >> >> >> >>>  Sergey Beryozkin
>> >> >> >> >>>
>> >> >> >> >>> Application Integration Division of Talend
>> >> >> >> >>> http://sberyozkin.blogspot.com
>> >> >> >> >>>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >>  Sergey Beryozkin
>> >> >> >>
>> >> >> >> Application Integration Division of Talend
>> >> >> >> http://sberyozkin.blogspot.com
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>  Sergey Beryozkin
>> >> >>
>> >> >> Application Integration Division of Talend
>> >> >> http://sberyozkin.blogspot.com
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Updated JIRA with path and modified files for the new implementation...

On Fri, Jun 3, 2011 at 1:52 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Your patch contains empty (if) branches so that can not be committed;
> Allowing for Map<String,Primitive> will result in all but the last
> name/value pairs with identical names being lost
>
> Does it make sense ?
> Cheers, Sergey
>
> On Fri, Jun 3, 2011 at 1:22 AM, Biju Nair <bi...@gmail.com> wrote:
> > I am confused on what you mean by "empty branches", can you just
> elaborate?
> >
> > Do you mean we need to have only Map<String,List<Primitive>> and not
> > Map<String,Primitive>?
> >
> > On Thu, Jun 2, 2011 at 1:46 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Please check a previous message, we need a better Map check and no
> >> empty branches
> >>
> >> thanks, Sergey
> >>
> >> On Thu, Jun 2, 2011 at 6:37 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > Yes I can help you in improving. Let me know what needs to be done.
> >> >
> >> > On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >> >wrote:
> >> >
> >> >> I did. It needs a bit more work and I'll need to allocate some time
> to
> >> >> add a test and see what needs to be improved, ex, having empty if
> >> >> branches is not possible. Realistically, it has to be Map<String,
> >> >> List<Primitive>> (where Primitive is String or Integer/etc, to handle
> >> >> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
> >> >> return false if not (this can help with eliminating empty branches).
> >> >> Would you like to improve this patch a bit ? I can do some test once
> >> >> it's ready, but I can't afford at all to look into improving the
> patch
> >> >> right now...
> >> >>
> >> >> Thanks, Sergey
> >> >>
> >> >> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com>
> >> wrote:
> >> >> > Did you get chance to look into this?
> >> >> >
> >> >> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <
> >> sberyozkin@gmail.com
> >> >> >wrote:
> >> >> >
> >> >> >> Sorry, not yet, hoping to do it shortly
> >> >> >>
> >> >> >> Sergey
> >> >> >>
> >> >> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <
> biju74techie@gmail.com>
> >> >> wrote:
> >> >> >> > did you get chance to update the patch and test it?
> >> >> >> >
> >> >> >> > Biju
> >> >> >> >
> >> >> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <
> biju74techie@gmail.com
> >> >
> >> >> >> wrote:
> >> >> >> >
> >> >> >> >> Attached the path in JIRA.
> >> >> >> >>
> >> >> >> >> Attaching with this mail also.
> >> >> >> >>
> >> >> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
> >> >> >> sberyozkin@gmail.com>wrote:
> >> >> >> >>
> >> >> >> >>> Hi
> >> >> >> >>>
> >> >> >> >>> Can you attach the updated patch to JIRA please ? I'm not
> seeing
> >> a
> >> >> >> >>> patch attached to your email message.
> >> >> >> >>>
> >> >> >> >>> Supporting explicit Lists for JAX-RS param annotations
> >> (@PathParam,
> >> >> >> >>> etc) is a JAX-RS spec requirement.
> >> >> >> >>> Supporting explicit Lists which are mapped to request payloads
> or
> >> >> >> >>> responses is the extensions. All JAX-RS stacks are probably
> >> >> supporting
> >> >> >> >>> it, but that is an extension.
> >> >> >> >>> Supporting MultivaluedMap in case of form submissions is a
> spec
> >> >> >> >>> requirement as well. It really only makes sense for form
> >> payloads.
> >> >> The
> >> >> >> >>> only other exception is probably QueryParams and may be
> >> >> HeaderParams,
> >> >> >> >>> but it has to be a MultivaluedMap for a single key/multiple
> >> values
> >> >> >> >>> case to work.
> >> >> >> >>>
> >> >> >> >>> Cheers, Sergey
> >> >> >> >>>
> >> >> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <
> >> biju74techie@gmail.com>
> >> >> >> >>> wrote:
> >> >> >> >>> > I gave the Explict Map Support, becuase CXF was supporting
> >> Explict
> >> >> >> List
> >> >> >> >>> > support.
> >> >> >> >>> >
> >> >> >> >>> > The code which i send you have only support for beans with
> >> nested
> >> >> Map
> >> >> >> >>> > interface.
> >> >> >> >>> >
> >> >> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
> >> >> biju74techie@gmail.com>
> >> >> >> >>> wrote:
> >> >> >> >>> >
> >> >> >> >>> >> That was my mistake. I was using Eclipse IDE and I
> formatted
> >> the
> >> >> >> java
> >> >> >> >>> file,
> >> >> >> >>> >> so the whole file got messed up.
> >> >> >> >>> >>
> >> >> >> >>> >> I revereted the changes and made support only for bean with
> >> >> nested
> >> >> >> Map
> >> >> >> >>> >> interface (FormParam(""),QueryParam("")..)
> >> >> >> >>> >>
> >> >> >> >>> >> Attaching the changed file with this mail.
> >> >> >> >>> >> ------------------------------
> >> >> >> >>> >> Details,
> >> >> >> >>> >>
> >> >> >> >>> >> Modified the changes only for supporting map's interface
> only
> >> >> inside
> >> >> >> >>> beans.
> >> >> >> >>> >>
> >> >> >> >>> >> Classes Changed,
> >> >> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
> >> >> >> >>> >>
> >> >> >> >>> >> Methods Changed
> >> >> >> >>> >> public static Object handleBean(...) - Added another if
> clause
> >> >> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
> >> >> >> >>> >>
> >> >> >> >>> >> Methods Added
> >> >> >> >>> >> isSupportedMap
> >> >> >> >>> >> mergeMap
> >> >> >> >>> >> convertMultimapToMap
> >> >> >> >>> >> injectIntoMap
> >> >> >> >>> >>
> >> >> >> >>> >> --------------------------
> >> >> >> >>> >>
> >> >> >> >>> >>
> >> >> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
> >> >> >> >>> sberyozkin@gmail.com>wrote:
> >> >> >> >>> >>
> >> >> >> >>> >>> Actually, I can see you modifying the code for explicit
> Maps
> >> be
> >> >> >> >>> >>> supported as well.
> >> >> >> >>> >>>
> >> >> >> >>> >>> That is not a bad idea but I'd prefer for one issue (to do
> >> with
> >> >> >> >>> >>> parameter beans containing Map fileds) addressed first.
> >> >> >> >>> >>>
> >> >> >> >>> >>> Explicit Maps can be supported right now (a bit of work is
> >> >> needed
> >> >> >> to
> >> >> >> >>> >>> register ParameterHandler to capture Form, query or path
> >> values
> >> >> or
> >> >> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
> >> >> >> >>> >>>
> >> >> >> >>> >>> Please, simplify the patch a bit so that only a
> >> 'FormParam(""),
> >> >> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be
> supported
> >> >> >> >>> >>>
> >> >> >> >>> >>> thanks, Sergey
> >> >> >> >>> >>>
> >> >> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
> >> >> >> >>> sberyozkin@gmail.com>
> >> >> >> >>> >>> wrote:
> >> >> >> >>> >>> > Hi
> >> >> >> >>> >>> >
> >> >> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
> >> >> >> biju74techie@gmail.com
> >> >> >> >>> >
> >> >> >> >>> >>> wrote:
> >> >> >> >>> >>> >> Updated the JIRA with DIFF file.
> >> >> >> >>> >>> >>
> >> >> >> >>> >>> >> May I know whether that worked.
> >> >> >> >>> >>> >>
> >> >> >> >>> >>> > I have problems applying the patch, as it seems like
> >> >> >> InjectionUtils
> >> >> >> >>> >>> > has been completely changed, I can't spot, by looking at
> >> the
> >> >> diff
> >> >> >> >>> >>> > file, what the actual changes are.
> >> >> >> >>> >>> > I'm going to attach svn properties file from my local
> >> snapshot
> >> >> to
> >> >> >> >>> >>> > JIRA, can you please give me a favor and try again with
> >> those
> >> >> >> >>> >>> > properties applied ?
> >> >> >> >>> >>> >
> >> >> >> >>> >>> > thanks, Sergey
> >> >> >> >>> >>> >
> >> >> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
> >> >> >> >>> >>> sberyozkin@gmail.com>wrote:
> >> >> >> >>> >>> >>
> >> >> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
> >> >> >> >>> >>> >>> Please update your local snapshot and create a patch
> >> >> >> >>> >>> >>>
> >> >> >> >>> >>> >>> thanks, Sergey
> >> >> >> >>> >>> >>>
> >> >> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
> >> >> >> >>> biju74techie@gmail.com>
> >> >> >> >>> >>> wrote:
> >> >> >> >>> >>> >>> > Created JIRA - CXF-3529
> >> >> >> >>> >>> >>> >
> >> >> >> >>> >>> >>> > Let me know what is the next step?
> >> >> >> >>> >>> >>> >
> >> >> >> >>> >>> >>> > Biju
> >> >> >> >>> >>> >>> >
> >> >> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
> >> >> >> >>> >>> sberyozkin@gmail.com
> >> >> >> >>> >>> >>> >wrote:
> >> >> >> >>> >>> >>> >
> >> >> >> >>> >>> >>> >> Hi
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
> >> >> >> >>> biju74techie@gmail.com
> >> >> >> >>> >>> >
> >> >> >> >>> >>> >>> wrote:
> >> >> >> >>> >>> >>> >> > Added the Map feature for service level and bean
> >> level.
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >> > I was not able to check-in the files, so
> attaching
> >> the
> >> >> >> same.
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >> I don't see an attachment, but what you need to do
> is
> >> to
> >> >> >> create
> >> >> >> >>> a
> >> >> >> >>> >>> CXF
> >> >> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >> > Following are the changes,
> >> >> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
> >> >> >> >>> >>> >>> >> > -- Changed Signature of
> >> >> >> InjectionUtils.createParameterObject
> >> >> >> >>> >>> >>> >> > -- Modified handleBean
> >> >> >> >>> >>> >>> >> > -- Modified createParameterObject
> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
> >> >> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
> >> >> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
> >> >> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >> > The code is tested with sample services like,
> >> >> >> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
> >> >> >> >>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer>
> >> map)
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >> > public class TestEmployeeTO  {
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >> >  //getters/setters
> >> >> >> >>> >>> >>> >> > }
> >> >> >> >>> >>> >>> >> > Input Data
> >> >> >> >>> >>> >>> >> >
> >> >> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >> >> >> >>> >>> >>> >> > Output
> >> >> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> >> >> >> >>> >>> >>> >> > map={y=9, x=11}
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >> thanks, Sergey
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >> > Please verify and let me know is this is good.
> >> >> >> >>> >>> >>> >> >
> >> >> >> >>> >>> >>> >> > Biju B
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >> --
> >> >> >> >>> >>> >>> >>  Sergey Beryozkin
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >> Application Integration Division of Talend
> >> >> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
> >> >> >> >>> >>> >>> >>
> >> >> >> >>> >>> >>> >
> >> >> >> >>> >>> >>>
> >> >> >> >>> >>> >>
> >> >> >> >>> >>> >
> >> >> >> >>> >>>
> >> >> >> >>> >>
> >> >> >> >>> >>
> >> >> >> >>> >
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >>> --
> >> >> >> >>>  Sergey Beryozkin
> >> >> >> >>>
> >> >> >> >>> Application Integration Division of Talend
> >> >> >> >>> http://sberyozkin.blogspot.com
> >> >> >> >>>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >>  Sergey Beryozkin
> >> >> >>
> >> >> >> Application Integration Division of Talend
> >> >> >> http://sberyozkin.blogspot.com
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>  Sergey Beryozkin
> >> >>
> >> >> Application Integration Division of Talend
> >> >> http://sberyozkin.blogspot.com
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
Your patch contains empty (if) branches so that can not be committed;
Allowing for Map<String,Primitive> will result in all but the last
name/value pairs with identical names being lost

Does it make sense ?
Cheers, Sergey

On Fri, Jun 3, 2011 at 1:22 AM, Biju Nair <bi...@gmail.com> wrote:
> I am confused on what you mean by "empty branches", can you just elaborate?
>
> Do you mean we need to have only Map<String,List<Primitive>> and not
> Map<String,Primitive>?
>
> On Thu, Jun 2, 2011 at 1:46 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Please check a previous message, we need a better Map check and no
>> empty branches
>>
>> thanks, Sergey
>>
>> On Thu, Jun 2, 2011 at 6:37 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Yes I can help you in improving. Let me know what needs to be done.
>> >
>> > On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> I did. It needs a bit more work and I'll need to allocate some time to
>> >> add a test and see what needs to be improved, ex, having empty if
>> >> branches is not possible. Realistically, it has to be Map<String,
>> >> List<Primitive>> (where Primitive is String or Integer/etc, to handle
>> >> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
>> >> return false if not (this can help with eliminating empty branches).
>> >> Would you like to improve this patch a bit ? I can do some test once
>> >> it's ready, but I can't afford at all to look into improving the patch
>> >> right now...
>> >>
>> >> Thanks, Sergey
>> >>
>> >> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > Did you get chance to look into this?
>> >> >
>> >> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <
>> sberyozkin@gmail.com
>> >> >wrote:
>> >> >
>> >> >> Sorry, not yet, hoping to do it shortly
>> >> >>
>> >> >> Sergey
>> >> >>
>> >> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <bi...@gmail.com>
>> >> wrote:
>> >> >> > did you get chance to update the patch and test it?
>> >> >> >
>> >> >> > Biju
>> >> >> >
>> >> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <biju74techie@gmail.com
>> >
>> >> >> wrote:
>> >> >> >
>> >> >> >> Attached the path in JIRA.
>> >> >> >>
>> >> >> >> Attaching with this mail also.
>> >> >> >>
>> >> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
>> >> >> sberyozkin@gmail.com>wrote:
>> >> >> >>
>> >> >> >>> Hi
>> >> >> >>>
>> >> >> >>> Can you attach the updated patch to JIRA please ? I'm not seeing
>> a
>> >> >> >>> patch attached to your email message.
>> >> >> >>>
>> >> >> >>> Supporting explicit Lists for JAX-RS param annotations
>> (@PathParam,
>> >> >> >>> etc) is a JAX-RS spec requirement.
>> >> >> >>> Supporting explicit Lists which are mapped to request payloads or
>> >> >> >>> responses is the extensions. All JAX-RS stacks are probably
>> >> supporting
>> >> >> >>> it, but that is an extension.
>> >> >> >>> Supporting MultivaluedMap in case of form submissions is a spec
>> >> >> >>> requirement as well. It really only makes sense for form
>> payloads.
>> >> The
>> >> >> >>> only other exception is probably QueryParams and may be
>> >> HeaderParams,
>> >> >> >>> but it has to be a MultivaluedMap for a single key/multiple
>> values
>> >> >> >>> case to work.
>> >> >> >>>
>> >> >> >>> Cheers, Sergey
>> >> >> >>>
>> >> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <
>> biju74techie@gmail.com>
>> >> >> >>> wrote:
>> >> >> >>> > I gave the Explict Map Support, becuase CXF was supporting
>> Explict
>> >> >> List
>> >> >> >>> > support.
>> >> >> >>> >
>> >> >> >>> > The code which i send you have only support for beans with
>> nested
>> >> Map
>> >> >> >>> > interface.
>> >> >> >>> >
>> >> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
>> >> biju74techie@gmail.com>
>> >> >> >>> wrote:
>> >> >> >>> >
>> >> >> >>> >> That was my mistake. I was using Eclipse IDE and I formatted
>> the
>> >> >> java
>> >> >> >>> file,
>> >> >> >>> >> so the whole file got messed up.
>> >> >> >>> >>
>> >> >> >>> >> I revereted the changes and made support only for bean with
>> >> nested
>> >> >> Map
>> >> >> >>> >> interface (FormParam(""),QueryParam("")..)
>> >> >> >>> >>
>> >> >> >>> >> Attaching the changed file with this mail.
>> >> >> >>> >> ------------------------------
>> >> >> >>> >> Details,
>> >> >> >>> >>
>> >> >> >>> >> Modified the changes only for supporting map's interface only
>> >> inside
>> >> >> >>> beans.
>> >> >> >>> >>
>> >> >> >>> >> Classes Changed,
>> >> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
>> >> >> >>> >>
>> >> >> >>> >> Methods Changed
>> >> >> >>> >> public static Object handleBean(...) - Added another if clause
>> >> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
>> >> >> >>> >>
>> >> >> >>> >> Methods Added
>> >> >> >>> >> isSupportedMap
>> >> >> >>> >> mergeMap
>> >> >> >>> >> convertMultimapToMap
>> >> >> >>> >> injectIntoMap
>> >> >> >>> >>
>> >> >> >>> >> --------------------------
>> >> >> >>> >>
>> >> >> >>> >>
>> >> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
>> >> >> >>> sberyozkin@gmail.com>wrote:
>> >> >> >>> >>
>> >> >> >>> >>> Actually, I can see you modifying the code for explicit Maps
>> be
>> >> >> >>> >>> supported as well.
>> >> >> >>> >>>
>> >> >> >>> >>> That is not a bad idea but I'd prefer for one issue (to do
>> with
>> >> >> >>> >>> parameter beans containing Map fileds) addressed first.
>> >> >> >>> >>>
>> >> >> >>> >>> Explicit Maps can be supported right now (a bit of work is
>> >> needed
>> >> >> to
>> >> >> >>> >>> register ParameterHandler to capture Form, query or path
>> values
>> >> or
>> >> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
>> >> >> >>> >>>
>> >> >> >>> >>> Please, simplify the patch a bit so that only a
>> 'FormParam(""),
>> >> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
>> >> >> >>> >>>
>> >> >> >>> >>> thanks, Sergey
>> >> >> >>> >>>
>> >> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
>> >> >> >>> sberyozkin@gmail.com>
>> >> >> >>> >>> wrote:
>> >> >> >>> >>> > Hi
>> >> >> >>> >>> >
>> >> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
>> >> >> biju74techie@gmail.com
>> >> >> >>> >
>> >> >> >>> >>> wrote:
>> >> >> >>> >>> >> Updated the JIRA with DIFF file.
>> >> >> >>> >>> >>
>> >> >> >>> >>> >> May I know whether that worked.
>> >> >> >>> >>> >>
>> >> >> >>> >>> > I have problems applying the patch, as it seems like
>> >> >> InjectionUtils
>> >> >> >>> >>> > has been completely changed, I can't spot, by looking at
>> the
>> >> diff
>> >> >> >>> >>> > file, what the actual changes are.
>> >> >> >>> >>> > I'm going to attach svn properties file from my local
>> snapshot
>> >> to
>> >> >> >>> >>> > JIRA, can you please give me a favor and try again with
>> those
>> >> >> >>> >>> > properties applied ?
>> >> >> >>> >>> >
>> >> >> >>> >>> > thanks, Sergey
>> >> >> >>> >>> >
>> >> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>> >> >> >>> >>> sberyozkin@gmail.com>wrote:
>> >> >> >>> >>> >>
>> >> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
>> >> >> >>> >>> >>> Please update your local snapshot and create a patch
>> >> >> >>> >>> >>>
>> >> >> >>> >>> >>> thanks, Sergey
>> >> >> >>> >>> >>>
>> >> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
>> >> >> >>> biju74techie@gmail.com>
>> >> >> >>> >>> wrote:
>> >> >> >>> >>> >>> > Created JIRA - CXF-3529
>> >> >> >>> >>> >>> >
>> >> >> >>> >>> >>> > Let me know what is the next step?
>> >> >> >>> >>> >>> >
>> >> >> >>> >>> >>> > Biju
>> >> >> >>> >>> >>> >
>> >> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>> >> >> >>> >>> sberyozkin@gmail.com
>> >> >> >>> >>> >>> >wrote:
>> >> >> >>> >>> >>> >
>> >> >> >>> >>> >>> >> Hi
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
>> >> >> >>> biju74techie@gmail.com
>> >> >> >>> >>> >
>> >> >> >>> >>> >>> wrote:
>> >> >> >>> >>> >>> >> > Added the Map feature for service level and bean
>> level.
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >> > I was not able to check-in the files, so attaching
>> the
>> >> >> same.
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >> I don't see an attachment, but what you need to do is
>> to
>> >> >> create
>> >> >> >>> a
>> >> >> >>> >>> CXF
>> >> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >> > Following are the changes,
>> >> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
>> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>> >> >> >>> >>> >>> >> > -- Changed Signature of
>> >> >> InjectionUtils.createParameterObject
>> >> >> >>> >>> >>> >> > -- Modified handleBean
>> >> >> >>> >>> >>> >> > -- Modified createParameterObject
>> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
>> >> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
>> >> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
>> >> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >> > The code is tested with sample services like,
>> >> >> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>> >> >> >>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer>
>> map)
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >> > public class TestEmployeeTO  {
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >> >  //getters/setters
>> >> >> >>> >>> >>> >> > }
>> >> >> >>> >>> >>> >> > Input Data
>> >> >> >>> >>> >>> >> >
>> >> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> >> >> >>> >>> >>> >> > Output
>> >> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> >> >> >>> >>> >>> >> > map={y=9, x=11}
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >> thanks, Sergey
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >> > Please verify and let me know is this is good.
>> >> >> >>> >>> >>> >> >
>> >> >> >>> >>> >>> >> > Biju B
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >> --
>> >> >> >>> >>> >>> >>  Sergey Beryozkin
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >> Application Integration Division of Talend
>> >> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
>> >> >> >>> >>> >>> >>
>> >> >> >>> >>> >>> >
>> >> >> >>> >>> >>>
>> >> >> >>> >>> >>
>> >> >> >>> >>> >
>> >> >> >>> >>>
>> >> >> >>> >>
>> >> >> >>> >>
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> --
>> >> >> >>>  Sergey Beryozkin
>> >> >> >>>
>> >> >> >>> Application Integration Division of Talend
>> >> >> >>> http://sberyozkin.blogspot.com
>> >> >> >>>
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>  Sergey Beryozkin
>> >> >>
>> >> >> Application Integration Division of Talend
>> >> >> http://sberyozkin.blogspot.com
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
I am confused on what you mean by "empty branches", can you just elaborate?

Do you mean we need to have only Map<String,List<Primitive>> and not
Map<String,Primitive>?

On Thu, Jun 2, 2011 at 1:46 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Please check a previous message, we need a better Map check and no
> empty branches
>
> thanks, Sergey
>
> On Thu, Jun 2, 2011 at 6:37 PM, Biju Nair <bi...@gmail.com> wrote:
> > Yes I can help you in improving. Let me know what needs to be done.
> >
> > On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> I did. It needs a bit more work and I'll need to allocate some time to
> >> add a test and see what needs to be improved, ex, having empty if
> >> branches is not possible. Realistically, it has to be Map<String,
> >> List<Primitive>> (where Primitive is String or Integer/etc, to handle
> >> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
> >> return false if not (this can help with eliminating empty branches).
> >> Would you like to improve this patch a bit ? I can do some test once
> >> it's ready, but I can't afford at all to look into improving the patch
> >> right now...
> >>
> >> Thanks, Sergey
> >>
> >> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > Did you get chance to look into this?
> >> >
> >> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >> >wrote:
> >> >
> >> >> Sorry, not yet, hoping to do it shortly
> >> >>
> >> >> Sergey
> >> >>
> >> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <bi...@gmail.com>
> >> wrote:
> >> >> > did you get chance to update the patch and test it?
> >> >> >
> >> >> > Biju
> >> >> >
> >> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <biju74techie@gmail.com
> >
> >> >> wrote:
> >> >> >
> >> >> >> Attached the path in JIRA.
> >> >> >>
> >> >> >> Attaching with this mail also.
> >> >> >>
> >> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
> >> >> sberyozkin@gmail.com>wrote:
> >> >> >>
> >> >> >>> Hi
> >> >> >>>
> >> >> >>> Can you attach the updated patch to JIRA please ? I'm not seeing
> a
> >> >> >>> patch attached to your email message.
> >> >> >>>
> >> >> >>> Supporting explicit Lists for JAX-RS param annotations
> (@PathParam,
> >> >> >>> etc) is a JAX-RS spec requirement.
> >> >> >>> Supporting explicit Lists which are mapped to request payloads or
> >> >> >>> responses is the extensions. All JAX-RS stacks are probably
> >> supporting
> >> >> >>> it, but that is an extension.
> >> >> >>> Supporting MultivaluedMap in case of form submissions is a spec
> >> >> >>> requirement as well. It really only makes sense for form
> payloads.
> >> The
> >> >> >>> only other exception is probably QueryParams and may be
> >> HeaderParams,
> >> >> >>> but it has to be a MultivaluedMap for a single key/multiple
> values
> >> >> >>> case to work.
> >> >> >>>
> >> >> >>> Cheers, Sergey
> >> >> >>>
> >> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <
> biju74techie@gmail.com>
> >> >> >>> wrote:
> >> >> >>> > I gave the Explict Map Support, becuase CXF was supporting
> Explict
> >> >> List
> >> >> >>> > support.
> >> >> >>> >
> >> >> >>> > The code which i send you have only support for beans with
> nested
> >> Map
> >> >> >>> > interface.
> >> >> >>> >
> >> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
> >> biju74techie@gmail.com>
> >> >> >>> wrote:
> >> >> >>> >
> >> >> >>> >> That was my mistake. I was using Eclipse IDE and I formatted
> the
> >> >> java
> >> >> >>> file,
> >> >> >>> >> so the whole file got messed up.
> >> >> >>> >>
> >> >> >>> >> I revereted the changes and made support only for bean with
> >> nested
> >> >> Map
> >> >> >>> >> interface (FormParam(""),QueryParam("")..)
> >> >> >>> >>
> >> >> >>> >> Attaching the changed file with this mail.
> >> >> >>> >> ------------------------------
> >> >> >>> >> Details,
> >> >> >>> >>
> >> >> >>> >> Modified the changes only for supporting map's interface only
> >> inside
> >> >> >>> beans.
> >> >> >>> >>
> >> >> >>> >> Classes Changed,
> >> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
> >> >> >>> >>
> >> >> >>> >> Methods Changed
> >> >> >>> >> public static Object handleBean(...) - Added another if clause
> >> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
> >> >> >>> >>
> >> >> >>> >> Methods Added
> >> >> >>> >> isSupportedMap
> >> >> >>> >> mergeMap
> >> >> >>> >> convertMultimapToMap
> >> >> >>> >> injectIntoMap
> >> >> >>> >>
> >> >> >>> >> --------------------------
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
> >> >> >>> sberyozkin@gmail.com>wrote:
> >> >> >>> >>
> >> >> >>> >>> Actually, I can see you modifying the code for explicit Maps
> be
> >> >> >>> >>> supported as well.
> >> >> >>> >>>
> >> >> >>> >>> That is not a bad idea but I'd prefer for one issue (to do
> with
> >> >> >>> >>> parameter beans containing Map fileds) addressed first.
> >> >> >>> >>>
> >> >> >>> >>> Explicit Maps can be supported right now (a bit of work is
> >> needed
> >> >> to
> >> >> >>> >>> register ParameterHandler to capture Form, query or path
> values
> >> or
> >> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
> >> >> >>> >>>
> >> >> >>> >>> Please, simplify the patch a bit so that only a
> 'FormParam(""),
> >> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
> >> >> >>> >>>
> >> >> >>> >>> thanks, Sergey
> >> >> >>> >>>
> >> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
> >> >> >>> sberyozkin@gmail.com>
> >> >> >>> >>> wrote:
> >> >> >>> >>> > Hi
> >> >> >>> >>> >
> >> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
> >> >> biju74techie@gmail.com
> >> >> >>> >
> >> >> >>> >>> wrote:
> >> >> >>> >>> >> Updated the JIRA with DIFF file.
> >> >> >>> >>> >>
> >> >> >>> >>> >> May I know whether that worked.
> >> >> >>> >>> >>
> >> >> >>> >>> > I have problems applying the patch, as it seems like
> >> >> InjectionUtils
> >> >> >>> >>> > has been completely changed, I can't spot, by looking at
> the
> >> diff
> >> >> >>> >>> > file, what the actual changes are.
> >> >> >>> >>> > I'm going to attach svn properties file from my local
> snapshot
> >> to
> >> >> >>> >>> > JIRA, can you please give me a favor and try again with
> those
> >> >> >>> >>> > properties applied ?
> >> >> >>> >>> >
> >> >> >>> >>> > thanks, Sergey
> >> >> >>> >>> >
> >> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
> >> >> >>> >>> sberyozkin@gmail.com>wrote:
> >> >> >>> >>> >>
> >> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
> >> >> >>> >>> >>> Please update your local snapshot and create a patch
> >> >> >>> >>> >>>
> >> >> >>> >>> >>> thanks, Sergey
> >> >> >>> >>> >>>
> >> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
> >> >> >>> biju74techie@gmail.com>
> >> >> >>> >>> wrote:
> >> >> >>> >>> >>> > Created JIRA - CXF-3529
> >> >> >>> >>> >>> >
> >> >> >>> >>> >>> > Let me know what is the next step?
> >> >> >>> >>> >>> >
> >> >> >>> >>> >>> > Biju
> >> >> >>> >>> >>> >
> >> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
> >> >> >>> >>> sberyozkin@gmail.com
> >> >> >>> >>> >>> >wrote:
> >> >> >>> >>> >>> >
> >> >> >>> >>> >>> >> Hi
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
> >> >> >>> biju74techie@gmail.com
> >> >> >>> >>> >
> >> >> >>> >>> >>> wrote:
> >> >> >>> >>> >>> >> > Added the Map feature for service level and bean
> level.
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >> > I was not able to check-in the files, so attaching
> the
> >> >> same.
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >> I don't see an attachment, but what you need to do is
> to
> >> >> create
> >> >> >>> a
> >> >> >>> >>> CXF
> >> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >> > Following are the changes,
> >> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
> >> >> >>> >>> >>> >> > -- Changed Signature of
> >> >> InjectionUtils.createParameterObject
> >> >> >>> >>> >>> >> > -- Modified handleBean
> >> >> >>> >>> >>> >> > -- Modified createParameterObject
> >> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
> >> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
> >> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
> >> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >> > The code is tested with sample services like,
> >> >> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
> >> >> >>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer>
> map)
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >> > public class TestEmployeeTO  {
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >> >  //getters/setters
> >> >> >>> >>> >>> >> > }
> >> >> >>> >>> >>> >> > Input Data
> >> >> >>> >>> >>> >> >
> >> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >> >> >>> >>> >>> >> > Output
> >> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> >> >> >>> >>> >>> >> > map={y=9, x=11}
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >> thanks, Sergey
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >> > Please verify and let me know is this is good.
> >> >> >>> >>> >>> >> >
> >> >> >>> >>> >>> >> > Biju B
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >> --
> >> >> >>> >>> >>> >>  Sergey Beryozkin
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >> Application Integration Division of Talend
> >> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
> >> >> >>> >>> >>> >>
> >> >> >>> >>> >>> >
> >> >> >>> >>> >>>
> >> >> >>> >>> >>
> >> >> >>> >>> >
> >> >> >>> >>>
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> --
> >> >> >>>  Sergey Beryozkin
> >> >> >>>
> >> >> >>> Application Integration Division of Talend
> >> >> >>> http://sberyozkin.blogspot.com
> >> >> >>>
> >> >> >>
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>  Sergey Beryozkin
> >> >>
> >> >> Application Integration Division of Talend
> >> >> http://sberyozkin.blogspot.com
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
Please check a previous message, we need a better Map check and no
empty branches

thanks, Sergey

On Thu, Jun 2, 2011 at 6:37 PM, Biju Nair <bi...@gmail.com> wrote:
> Yes I can help you in improving. Let me know what needs to be done.
>
> On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> I did. It needs a bit more work and I'll need to allocate some time to
>> add a test and see what needs to be improved, ex, having empty if
>> branches is not possible. Realistically, it has to be Map<String,
>> List<Primitive>> (where Primitive is String or Integer/etc, to handle
>> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
>> return false if not (this can help with eliminating empty branches).
>> Would you like to improve this patch a bit ? I can do some test once
>> it's ready, but I can't afford at all to look into improving the patch
>> right now...
>>
>> Thanks, Sergey
>>
>> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Did you get chance to look into this?
>> >
>> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Sorry, not yet, hoping to do it shortly
>> >>
>> >> Sergey
>> >>
>> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > did you get chance to update the patch and test it?
>> >> >
>> >> > Biju
>> >> >
>> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <bi...@gmail.com>
>> >> wrote:
>> >> >
>> >> >> Attached the path in JIRA.
>> >> >>
>> >> >> Attaching with this mail also.
>> >> >>
>> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
>> >> sberyozkin@gmail.com>wrote:
>> >> >>
>> >> >>> Hi
>> >> >>>
>> >> >>> Can you attach the updated patch to JIRA please ? I'm not seeing a
>> >> >>> patch attached to your email message.
>> >> >>>
>> >> >>> Supporting explicit Lists for JAX-RS param annotations (@PathParam,
>> >> >>> etc) is a JAX-RS spec requirement.
>> >> >>> Supporting explicit Lists which are mapped to request payloads or
>> >> >>> responses is the extensions. All JAX-RS stacks are probably
>> supporting
>> >> >>> it, but that is an extension.
>> >> >>> Supporting MultivaluedMap in case of form submissions is a spec
>> >> >>> requirement as well. It really only makes sense for form payloads.
>> The
>> >> >>> only other exception is probably QueryParams and may be
>> HeaderParams,
>> >> >>> but it has to be a MultivaluedMap for a single key/multiple values
>> >> >>> case to work.
>> >> >>>
>> >> >>> Cheers, Sergey
>> >> >>>
>> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com>
>> >> >>> wrote:
>> >> >>> > I gave the Explict Map Support, becuase CXF was supporting Explict
>> >> List
>> >> >>> > support.
>> >> >>> >
>> >> >>> > The code which i send you have only support for beans with nested
>> Map
>> >> >>> > interface.
>> >> >>> >
>> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
>> biju74techie@gmail.com>
>> >> >>> wrote:
>> >> >>> >
>> >> >>> >> That was my mistake. I was using Eclipse IDE and I formatted the
>> >> java
>> >> >>> file,
>> >> >>> >> so the whole file got messed up.
>> >> >>> >>
>> >> >>> >> I revereted the changes and made support only for bean with
>> nested
>> >> Map
>> >> >>> >> interface (FormParam(""),QueryParam("")..)
>> >> >>> >>
>> >> >>> >> Attaching the changed file with this mail.
>> >> >>> >> ------------------------------
>> >> >>> >> Details,
>> >> >>> >>
>> >> >>> >> Modified the changes only for supporting map's interface only
>> inside
>> >> >>> beans.
>> >> >>> >>
>> >> >>> >> Classes Changed,
>> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
>> >> >>> >>
>> >> >>> >> Methods Changed
>> >> >>> >> public static Object handleBean(...) - Added another if clause
>> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
>> >> >>> >>
>> >> >>> >> Methods Added
>> >> >>> >> isSupportedMap
>> >> >>> >> mergeMap
>> >> >>> >> convertMultimapToMap
>> >> >>> >> injectIntoMap
>> >> >>> >>
>> >> >>> >> --------------------------
>> >> >>> >>
>> >> >>> >>
>> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
>> >> >>> sberyozkin@gmail.com>wrote:
>> >> >>> >>
>> >> >>> >>> Actually, I can see you modifying the code for explicit Maps be
>> >> >>> >>> supported as well.
>> >> >>> >>>
>> >> >>> >>> That is not a bad idea but I'd prefer for one issue (to do with
>> >> >>> >>> parameter beans containing Map fileds) addressed first.
>> >> >>> >>>
>> >> >>> >>> Explicit Maps can be supported right now (a bit of work is
>> needed
>> >> to
>> >> >>> >>> register ParameterHandler to capture Form, query or path values
>> or
>> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
>> >> >>> >>>
>> >> >>> >>> Please, simplify the patch a bit so that only a 'FormParam(""),
>> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
>> >> >>> >>>
>> >> >>> >>> thanks, Sergey
>> >> >>> >>>
>> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
>> >> >>> sberyozkin@gmail.com>
>> >> >>> >>> wrote:
>> >> >>> >>> > Hi
>> >> >>> >>> >
>> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
>> >> biju74techie@gmail.com
>> >> >>> >
>> >> >>> >>> wrote:
>> >> >>> >>> >> Updated the JIRA with DIFF file.
>> >> >>> >>> >>
>> >> >>> >>> >> May I know whether that worked.
>> >> >>> >>> >>
>> >> >>> >>> > I have problems applying the patch, as it seems like
>> >> InjectionUtils
>> >> >>> >>> > has been completely changed, I can't spot, by looking at the
>> diff
>> >> >>> >>> > file, what the actual changes are.
>> >> >>> >>> > I'm going to attach svn properties file from my local snapshot
>> to
>> >> >>> >>> > JIRA, can you please give me a favor and try again with those
>> >> >>> >>> > properties applied ?
>> >> >>> >>> >
>> >> >>> >>> > thanks, Sergey
>> >> >>> >>> >
>> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>> >> >>> >>> sberyozkin@gmail.com>wrote:
>> >> >>> >>> >>
>> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
>> >> >>> >>> >>> Please update your local snapshot and create a patch
>> >> >>> >>> >>>
>> >> >>> >>> >>> thanks, Sergey
>> >> >>> >>> >>>
>> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
>> >> >>> biju74techie@gmail.com>
>> >> >>> >>> wrote:
>> >> >>> >>> >>> > Created JIRA - CXF-3529
>> >> >>> >>> >>> >
>> >> >>> >>> >>> > Let me know what is the next step?
>> >> >>> >>> >>> >
>> >> >>> >>> >>> > Biju
>> >> >>> >>> >>> >
>> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>> >> >>> >>> sberyozkin@gmail.com
>> >> >>> >>> >>> >wrote:
>> >> >>> >>> >>> >
>> >> >>> >>> >>> >> Hi
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
>> >> >>> biju74techie@gmail.com
>> >> >>> >>> >
>> >> >>> >>> >>> wrote:
>> >> >>> >>> >>> >> > Added the Map feature for service level and bean level.
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >> > I was not able to check-in the files, so attaching the
>> >> same.
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >> I don't see an attachment, but what you need to do is to
>> >> create
>> >> >>> a
>> >> >>> >>> CXF
>> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >> > Following are the changes,
>> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
>> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>> >> >>> >>> >>> >> > -- Changed Signature of
>> >> InjectionUtils.createParameterObject
>> >> >>> >>> >>> >> > -- Modified handleBean
>> >> >>> >>> >>> >> > -- Modified createParameterObject
>> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
>> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
>> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
>> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >> > The code is tested with sample services like,
>> >> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>> >> >>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >> > public class TestEmployeeTO  {
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >> >  //getters/setters
>> >> >>> >>> >>> >> > }
>> >> >>> >>> >>> >> > Input Data
>> >> >>> >>> >>> >> >
>> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> >> >>> >>> >>> >> > Output
>> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> >> >>> >>> >>> >> > map={y=9, x=11}
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >> thanks, Sergey
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >> > Please verify and let me know is this is good.
>> >> >>> >>> >>> >> >
>> >> >>> >>> >>> >> > Biju B
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >> --
>> >> >>> >>> >>> >>  Sergey Beryozkin
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >> Application Integration Division of Talend
>> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
>> >> >>> >>> >>> >>
>> >> >>> >>> >>> >
>> >> >>> >>> >>>
>> >> >>> >>> >>
>> >> >>> >>> >
>> >> >>> >>>
>> >> >>> >>
>> >> >>> >>
>> >> >>> >
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>>  Sergey Beryozkin
>> >> >>>
>> >> >>> Application Integration Division of Talend
>> >> >>> http://sberyozkin.blogspot.com
>> >> >>>
>> >> >>
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Yes I can help you in improving. Let me know what needs to be done.

On Wed, Jun 1, 2011 at 10:16 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> I did. It needs a bit more work and I'll need to allocate some time to
> add a test and see what needs to be improved, ex, having empty if
> branches is not possible. Realistically, it has to be Map<String,
> List<Primitive>> (where Primitive is String or Integer/etc, to handle
> m.v=1&m.v=2 or similar), so isMapSupported() should check it and
> return false if not (this can help with eliminating empty branches).
> Would you like to improve this patch a bit ? I can do some test once
> it's ready, but I can't afford at all to look into improving the patch
> right now...
>
> Thanks, Sergey
>
> On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com> wrote:
> > Did you get chance to look into this?
> >
> > On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Sorry, not yet, hoping to do it shortly
> >>
> >> Sergey
> >>
> >> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > did you get chance to update the patch and test it?
> >> >
> >> > Biju
> >> >
> >> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <bi...@gmail.com>
> >> wrote:
> >> >
> >> >> Attached the path in JIRA.
> >> >>
> >> >> Attaching with this mail also.
> >> >>
> >> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
> >> sberyozkin@gmail.com>wrote:
> >> >>
> >> >>> Hi
> >> >>>
> >> >>> Can you attach the updated patch to JIRA please ? I'm not seeing a
> >> >>> patch attached to your email message.
> >> >>>
> >> >>> Supporting explicit Lists for JAX-RS param annotations (@PathParam,
> >> >>> etc) is a JAX-RS spec requirement.
> >> >>> Supporting explicit Lists which are mapped to request payloads or
> >> >>> responses is the extensions. All JAX-RS stacks are probably
> supporting
> >> >>> it, but that is an extension.
> >> >>> Supporting MultivaluedMap in case of form submissions is a spec
> >> >>> requirement as well. It really only makes sense for form payloads.
> The
> >> >>> only other exception is probably QueryParams and may be
> HeaderParams,
> >> >>> but it has to be a MultivaluedMap for a single key/multiple values
> >> >>> case to work.
> >> >>>
> >> >>> Cheers, Sergey
> >> >>>
> >> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com>
> >> >>> wrote:
> >> >>> > I gave the Explict Map Support, becuase CXF was supporting Explict
> >> List
> >> >>> > support.
> >> >>> >
> >> >>> > The code which i send you have only support for beans with nested
> Map
> >> >>> > interface.
> >> >>> >
> >> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <
> biju74techie@gmail.com>
> >> >>> wrote:
> >> >>> >
> >> >>> >> That was my mistake. I was using Eclipse IDE and I formatted the
> >> java
> >> >>> file,
> >> >>> >> so the whole file got messed up.
> >> >>> >>
> >> >>> >> I revereted the changes and made support only for bean with
> nested
> >> Map
> >> >>> >> interface (FormParam(""),QueryParam("")..)
> >> >>> >>
> >> >>> >> Attaching the changed file with this mail.
> >> >>> >> ------------------------------
> >> >>> >> Details,
> >> >>> >>
> >> >>> >> Modified the changes only for supporting map's interface only
> inside
> >> >>> beans.
> >> >>> >>
> >> >>> >> Classes Changed,
> >> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
> >> >>> >>
> >> >>> >> Methods Changed
> >> >>> >> public static Object handleBean(...) - Added another if clause
> >> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
> >> >>> >>
> >> >>> >> Methods Added
> >> >>> >> isSupportedMap
> >> >>> >> mergeMap
> >> >>> >> convertMultimapToMap
> >> >>> >> injectIntoMap
> >> >>> >>
> >> >>> >> --------------------------
> >> >>> >>
> >> >>> >>
> >> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
> >> >>> sberyozkin@gmail.com>wrote:
> >> >>> >>
> >> >>> >>> Actually, I can see you modifying the code for explicit Maps be
> >> >>> >>> supported as well.
> >> >>> >>>
> >> >>> >>> That is not a bad idea but I'd prefer for one issue (to do with
> >> >>> >>> parameter beans containing Map fileds) addressed first.
> >> >>> >>>
> >> >>> >>> Explicit Maps can be supported right now (a bit of work is
> needed
> >> to
> >> >>> >>> register ParameterHandler to capture Form, query or path values
> or
> >> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
> >> >>> >>>
> >> >>> >>> Please, simplify the patch a bit so that only a 'FormParam(""),
> >> >>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
> >> >>> >>>
> >> >>> >>> thanks, Sergey
> >> >>> >>>
> >> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
> >> >>> sberyozkin@gmail.com>
> >> >>> >>> wrote:
> >> >>> >>> > Hi
> >> >>> >>> >
> >> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
> >> biju74techie@gmail.com
> >> >>> >
> >> >>> >>> wrote:
> >> >>> >>> >> Updated the JIRA with DIFF file.
> >> >>> >>> >>
> >> >>> >>> >> May I know whether that worked.
> >> >>> >>> >>
> >> >>> >>> > I have problems applying the patch, as it seems like
> >> InjectionUtils
> >> >>> >>> > has been completely changed, I can't spot, by looking at the
> diff
> >> >>> >>> > file, what the actual changes are.
> >> >>> >>> > I'm going to attach svn properties file from my local snapshot
> to
> >> >>> >>> > JIRA, can you please give me a favor and try again with those
> >> >>> >>> > properties applied ?
> >> >>> >>> >
> >> >>> >>> > thanks, Sergey
> >> >>> >>> >
> >> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
> >> >>> >>> sberyozkin@gmail.com>wrote:
> >> >>> >>> >>
> >> >>> >>> >>> Hi - did you see the comments on JIRA ?
> >> >>> >>> >>> Please update your local snapshot and create a patch
> >> >>> >>> >>>
> >> >>> >>> >>> thanks, Sergey
> >> >>> >>> >>>
> >> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
> >> >>> biju74techie@gmail.com>
> >> >>> >>> wrote:
> >> >>> >>> >>> > Created JIRA - CXF-3529
> >> >>> >>> >>> >
> >> >>> >>> >>> > Let me know what is the next step?
> >> >>> >>> >>> >
> >> >>> >>> >>> > Biju
> >> >>> >>> >>> >
> >> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
> >> >>> >>> sberyozkin@gmail.com
> >> >>> >>> >>> >wrote:
> >> >>> >>> >>> >
> >> >>> >>> >>> >> Hi
> >> >>> >>> >>> >>
> >> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
> >> >>> biju74techie@gmail.com
> >> >>> >>> >
> >> >>> >>> >>> wrote:
> >> >>> >>> >>> >> > Added the Map feature for service level and bean level.
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >> > I was not able to check-in the files, so attaching the
> >> same.
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >>
> >> >>> >>> >>> >> I don't see an attachment, but what you need to do is to
> >> create
> >> >>> a
> >> >>> >>> CXF
> >> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
> >> >>> >>> >>> >>
> >> >>> >>> >>> >>
> >> >>> >>> >>> >> > Following are the changes,
> >> >>> >>> >>> >> > Added Map Support to Rest Based Services
> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
> >> >>> >>> >>> >> > -- Changed Signature of
> >> InjectionUtils.createParameterObject
> >> >>> >>> >>> >> > -- Modified handleBean
> >> >>> >>> >>> >> > -- Modified createParameterObject
> >> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
> >> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
> >> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
> >> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >> > The code is tested with sample services like,
> >> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
> >> >>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >> > public class TestEmployeeTO  {
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >> >  private HashMap<String,String> currencies;
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >> >  //getters/setters
> >> >>> >>> >>> >> > }
> >> >>> >>> >>> >> > Input Data
> >> >>> >>> >>> >> >
> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >> >>> >>> >>> >> > Output
> >> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> >> >>> >>> >>> >> > map={y=9, x=11}
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >>
> >> >>> >>> >>> >> thanks, Sergey
> >> >>> >>> >>> >>
> >> >>> >>> >>> >>
> >> >>> >>> >>> >>
> >> >>> >>> >>> >> > Please verify and let me know is this is good.
> >> >>> >>> >>> >> >
> >> >>> >>> >>> >> > Biju B
> >> >>> >>> >>> >>
> >> >>> >>> >>> >>
> >> >>> >>> >>> >>
> >> >>> >>> >>> >> --
> >> >>> >>> >>> >>  Sergey Beryozkin
> >> >>> >>> >>> >>
> >> >>> >>> >>> >> Application Integration Division of Talend
> >> >>> >>> >>> >> http://sberyozkin.blogspot.com
> >> >>> >>> >>> >>
> >> >>> >>> >>> >
> >> >>> >>> >>>
> >> >>> >>> >>
> >> >>> >>> >
> >> >>> >>>
> >> >>> >>
> >> >>> >>
> >> >>> >
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>>  Sergey Beryozkin
> >> >>>
> >> >>> Application Integration Division of Talend
> >> >>> http://sberyozkin.blogspot.com
> >> >>>
> >> >>
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
I did. It needs a bit more work and I'll need to allocate some time to
add a test and see what needs to be improved, ex, having empty if
branches is not possible. Realistically, it has to be Map<String,
List<Primitive>> (where Primitive is String or Integer/etc, to handle
m.v=1&m.v=2 or similar), so isMapSupported() should check it and
return false if not (this can help with eliminating empty branches).
Would you like to improve this patch a bit ? I can do some test once
it's ready, but I can't afford at all to look into improving the patch
right now...

Thanks, Sergey

On Wed, Jun 1, 2011 at 6:02 PM, Biju Nair <bi...@gmail.com> wrote:
> Did you get chance to look into this?
>
> On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Sorry, not yet, hoping to do it shortly
>>
>> Sergey
>>
>> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <bi...@gmail.com> wrote:
>> > did you get chance to update the patch and test it?
>> >
>> > Biju
>> >
>> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >
>> >> Attached the path in JIRA.
>> >>
>> >> Attaching with this mail also.
>> >>
>> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com>wrote:
>> >>
>> >>> Hi
>> >>>
>> >>> Can you attach the updated patch to JIRA please ? I'm not seeing a
>> >>> patch attached to your email message.
>> >>>
>> >>> Supporting explicit Lists for JAX-RS param annotations (@PathParam,
>> >>> etc) is a JAX-RS spec requirement.
>> >>> Supporting explicit Lists which are mapped to request payloads or
>> >>> responses is the extensions. All JAX-RS stacks are probably supporting
>> >>> it, but that is an extension.
>> >>> Supporting MultivaluedMap in case of form submissions is a spec
>> >>> requirement as well. It really only makes sense for form payloads. The
>> >>> only other exception is probably QueryParams and may be HeaderParams,
>> >>> but it has to be a MultivaluedMap for a single key/multiple values
>> >>> case to work.
>> >>>
>> >>> Cheers, Sergey
>> >>>
>> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com>
>> >>> wrote:
>> >>> > I gave the Explict Map Support, becuase CXF was supporting Explict
>> List
>> >>> > support.
>> >>> >
>> >>> > The code which i send you have only support for beans with nested Map
>> >>> > interface.
>> >>> >
>> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <bi...@gmail.com>
>> >>> wrote:
>> >>> >
>> >>> >> That was my mistake. I was using Eclipse IDE and I formatted the
>> java
>> >>> file,
>> >>> >> so the whole file got messed up.
>> >>> >>
>> >>> >> I revereted the changes and made support only for bean with nested
>> Map
>> >>> >> interface (FormParam(""),QueryParam("")..)
>> >>> >>
>> >>> >> Attaching the changed file with this mail.
>> >>> >> ------------------------------
>> >>> >> Details,
>> >>> >>
>> >>> >> Modified the changes only for supporting map's interface only inside
>> >>> beans.
>> >>> >>
>> >>> >> Classes Changed,
>> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
>> >>> >>
>> >>> >> Methods Changed
>> >>> >> public static Object handleBean(...) - Added another if clause
>> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
>> >>> >>
>> >>> >> Methods Added
>> >>> >> isSupportedMap
>> >>> >> mergeMap
>> >>> >> convertMultimapToMap
>> >>> >> injectIntoMap
>> >>> >>
>> >>> >> --------------------------
>> >>> >>
>> >>> >>
>> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
>> >>> sberyozkin@gmail.com>wrote:
>> >>> >>
>> >>> >>> Actually, I can see you modifying the code for explicit Maps be
>> >>> >>> supported as well.
>> >>> >>>
>> >>> >>> That is not a bad idea but I'd prefer for one issue (to do with
>> >>> >>> parameter beans containing Map fileds) addressed first.
>> >>> >>>
>> >>> >>> Explicit Maps can be supported right now (a bit of work is needed
>> to
>> >>> >>> register ParameterHandler to capture Form, query or path values or
>> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
>> >>> >>>
>> >>> >>> Please, simplify the patch a bit so that only a 'FormParam(""),
>> >>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
>> >>> >>>
>> >>> >>> thanks, Sergey
>> >>> >>>
>> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
>> >>> sberyozkin@gmail.com>
>> >>> >>> wrote:
>> >>> >>> > Hi
>> >>> >>> >
>> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
>> biju74techie@gmail.com
>> >>> >
>> >>> >>> wrote:
>> >>> >>> >> Updated the JIRA with DIFF file.
>> >>> >>> >>
>> >>> >>> >> May I know whether that worked.
>> >>> >>> >>
>> >>> >>> > I have problems applying the patch, as it seems like
>> InjectionUtils
>> >>> >>> > has been completely changed, I can't spot, by looking at the diff
>> >>> >>> > file, what the actual changes are.
>> >>> >>> > I'm going to attach svn properties file from my local snapshot to
>> >>> >>> > JIRA, can you please give me a favor and try again with those
>> >>> >>> > properties applied ?
>> >>> >>> >
>> >>> >>> > thanks, Sergey
>> >>> >>> >
>> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>> >>> >>> sberyozkin@gmail.com>wrote:
>> >>> >>> >>
>> >>> >>> >>> Hi - did you see the comments on JIRA ?
>> >>> >>> >>> Please update your local snapshot and create a patch
>> >>> >>> >>>
>> >>> >>> >>> thanks, Sergey
>> >>> >>> >>>
>> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
>> >>> biju74techie@gmail.com>
>> >>> >>> wrote:
>> >>> >>> >>> > Created JIRA - CXF-3529
>> >>> >>> >>> >
>> >>> >>> >>> > Let me know what is the next step?
>> >>> >>> >>> >
>> >>> >>> >>> > Biju
>> >>> >>> >>> >
>> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>> >>> >>> sberyozkin@gmail.com
>> >>> >>> >>> >wrote:
>> >>> >>> >>> >
>> >>> >>> >>> >> Hi
>> >>> >>> >>> >>
>> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
>> >>> biju74techie@gmail.com
>> >>> >>> >
>> >>> >>> >>> wrote:
>> >>> >>> >>> >> > Added the Map feature for service level and bean level.
>> >>> >>> >>> >> >
>> >>> >>> >>> >> > I was not able to check-in the files, so attaching the
>> same.
>> >>> >>> >>> >> >
>> >>> >>> >>> >>
>> >>> >>> >>> >> I don't see an attachment, but what you need to do is to
>> create
>> >>> a
>> >>> >>> CXF
>> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
>> >>> >>> >>> >>
>> >>> >>> >>> >>
>> >>> >>> >>> >> > Following are the changes,
>> >>> >>> >>> >> > Added Map Support to Rest Based Services
>> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>> >>> >>> >>> >> > -- Changed Signature of
>> InjectionUtils.createParameterObject
>> >>> >>> >>> >> > -- Modified handleBean
>> >>> >>> >>> >> > -- Modified createParameterObject
>> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
>> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
>> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
>> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
>> >>> >>> >>> >> >
>> >>> >>> >>> >> > The code is tested with sample services like,
>> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>> >>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>> >>> >>> >>> >> >
>> >>> >>> >>> >> > public class TestEmployeeTO  {
>> >>> >>> >>> >> >
>> >>> >>> >>> >> >  private HashMap<String,String> currencies;
>> >>> >>> >>> >> >
>> >>> >>> >>> >> >  //getters/setters
>> >>> >>> >>> >> > }
>> >>> >>> >>> >> > Input Data
>> >>> >>> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> >>> >>> >>> >> > Output
>> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> >>> >>> >>> >> > map={y=9, x=11}
>> >>> >>> >>> >> >
>> >>> >>> >>> >>
>> >>> >>> >>> >> thanks, Sergey
>> >>> >>> >>> >>
>> >>> >>> >>> >>
>> >>> >>> >>> >>
>> >>> >>> >>> >> > Please verify and let me know is this is good.
>> >>> >>> >>> >> >
>> >>> >>> >>> >> > Biju B
>> >>> >>> >>> >>
>> >>> >>> >>> >>
>> >>> >>> >>> >>
>> >>> >>> >>> >> --
>> >>> >>> >>> >>  Sergey Beryozkin
>> >>> >>> >>> >>
>> >>> >>> >>> >> Application Integration Division of Talend
>> >>> >>> >>> >> http://sberyozkin.blogspot.com
>> >>> >>> >>> >>
>> >>> >>> >>> >
>> >>> >>> >>>
>> >>> >>> >>
>> >>> >>> >
>> >>> >>>
>> >>> >>
>> >>> >>
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>>  Sergey Beryozkin
>> >>>
>> >>> Application Integration Division of Talend
>> >>> http://sberyozkin.blogspot.com
>> >>>
>> >>
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Did you get chance to look into this?

On Thu, May 26, 2011 at 2:19 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Sorry, not yet, hoping to do it shortly
>
> Sergey
>
> On Thu, May 26, 2011 at 8:36 PM, Biju Nair <bi...@gmail.com> wrote:
> > did you get chance to update the patch and test it?
> >
> > Biju
> >
> > On Wed, May 25, 2011 at 9:09 AM, Biju Nair <bi...@gmail.com>
> wrote:
> >
> >> Attached the path in JIRA.
> >>
> >> Attaching with this mail also.
> >>
> >>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <
> sberyozkin@gmail.com>wrote:
> >>
> >>> Hi
> >>>
> >>> Can you attach the updated patch to JIRA please ? I'm not seeing a
> >>> patch attached to your email message.
> >>>
> >>> Supporting explicit Lists for JAX-RS param annotations (@PathParam,
> >>> etc) is a JAX-RS spec requirement.
> >>> Supporting explicit Lists which are mapped to request payloads or
> >>> responses is the extensions. All JAX-RS stacks are probably supporting
> >>> it, but that is an extension.
> >>> Supporting MultivaluedMap in case of form submissions is a spec
> >>> requirement as well. It really only makes sense for form payloads. The
> >>> only other exception is probably QueryParams and may be HeaderParams,
> >>> but it has to be a MultivaluedMap for a single key/multiple values
> >>> case to work.
> >>>
> >>> Cheers, Sergey
> >>>
> >>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com>
> >>> wrote:
> >>> > I gave the Explict Map Support, becuase CXF was supporting Explict
> List
> >>> > support.
> >>> >
> >>> > The code which i send you have only support for beans with nested Map
> >>> > interface.
> >>> >
> >>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <bi...@gmail.com>
> >>> wrote:
> >>> >
> >>> >> That was my mistake. I was using Eclipse IDE and I formatted the
> java
> >>> file,
> >>> >> so the whole file got messed up.
> >>> >>
> >>> >> I revereted the changes and made support only for bean with nested
> Map
> >>> >> interface (FormParam(""),QueryParam("")..)
> >>> >>
> >>> >> Attaching the changed file with this mail.
> >>> >> ------------------------------
> >>> >> Details,
> >>> >>
> >>> >> Modified the changes only for supporting map's interface only inside
> >>> beans.
> >>> >>
> >>> >> Classes Changed,
> >>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
> >>> >>
> >>> >> Methods Changed
> >>> >> public static Object handleBean(...) - Added another if clause
> >>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
> >>> >>
> >>> >> Methods Added
> >>> >> isSupportedMap
> >>> >> mergeMap
> >>> >> convertMultimapToMap
> >>> >> injectIntoMap
> >>> >>
> >>> >> --------------------------
> >>> >>
> >>> >>
> >>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
> >>> sberyozkin@gmail.com>wrote:
> >>> >>
> >>> >>> Actually, I can see you modifying the code for explicit Maps be
> >>> >>> supported as well.
> >>> >>>
> >>> >>> That is not a bad idea but I'd prefer for one issue (to do with
> >>> >>> parameter beans containing Map fileds) addressed first.
> >>> >>>
> >>> >>> Explicit Maps can be supported right now (a bit of work is needed
> to
> >>> >>> register ParameterHandler to capture Form, query or path values or
> >>> >>> XmlJavaTypeAdapter to capture say XML payload).
> >>> >>>
> >>> >>> Please, simplify the patch a bit so that only a 'FormParam(""),
> >>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
> >>> >>>
> >>> >>> thanks, Sergey
> >>> >>>
> >>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
> >>> sberyozkin@gmail.com>
> >>> >>> wrote:
> >>> >>> > Hi
> >>> >>> >
> >>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <
> biju74techie@gmail.com
> >>> >
> >>> >>> wrote:
> >>> >>> >> Updated the JIRA with DIFF file.
> >>> >>> >>
> >>> >>> >> May I know whether that worked.
> >>> >>> >>
> >>> >>> > I have problems applying the patch, as it seems like
> InjectionUtils
> >>> >>> > has been completely changed, I can't spot, by looking at the diff
> >>> >>> > file, what the actual changes are.
> >>> >>> > I'm going to attach svn properties file from my local snapshot to
> >>> >>> > JIRA, can you please give me a favor and try again with those
> >>> >>> > properties applied ?
> >>> >>> >
> >>> >>> > thanks, Sergey
> >>> >>> >
> >>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
> >>> >>> sberyozkin@gmail.com>wrote:
> >>> >>> >>
> >>> >>> >>> Hi - did you see the comments on JIRA ?
> >>> >>> >>> Please update your local snapshot and create a patch
> >>> >>> >>>
> >>> >>> >>> thanks, Sergey
> >>> >>> >>>
> >>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
> >>> biju74techie@gmail.com>
> >>> >>> wrote:
> >>> >>> >>> > Created JIRA - CXF-3529
> >>> >>> >>> >
> >>> >>> >>> > Let me know what is the next step?
> >>> >>> >>> >
> >>> >>> >>> > Biju
> >>> >>> >>> >
> >>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
> >>> >>> sberyozkin@gmail.com
> >>> >>> >>> >wrote:
> >>> >>> >>> >
> >>> >>> >>> >> Hi
> >>> >>> >>> >>
> >>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
> >>> biju74techie@gmail.com
> >>> >>> >
> >>> >>> >>> wrote:
> >>> >>> >>> >> > Added the Map feature for service level and bean level.
> >>> >>> >>> >> >
> >>> >>> >>> >> > I was not able to check-in the files, so attaching the
> same.
> >>> >>> >>> >> >
> >>> >>> >>> >>
> >>> >>> >>> >> I don't see an attachment, but what you need to do is to
> create
> >>> a
> >>> >>> CXF
> >>> >>> >>> >> JIRA, attach a patch and I will apply it.
> >>> >>> >>> >>
> >>> >>> >>> >>
> >>> >>> >>> >> > Following are the changes,
> >>> >>> >>> >> > Added Map Support to Rest Based Services
> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
> >>> >>> >>> >> > -- Changed Signature of
> InjectionUtils.createParameterObject
> >>> >>> >>> >> > -- Modified handleBean
> >>> >>> >>> >> > -- Modified createParameterObject
> >>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
> >>> >>> >>> >> > -- Added InjectionUtils.mergeMap
> >>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
> >>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
> >>> >>> >>> >> >
> >>> >>> >>> >> > The code is tested with sample services like,
> >>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
> >>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
> >>> >>> >>> >> >
> >>> >>> >>> >> > public class TestEmployeeTO  {
> >>> >>> >>> >> >
> >>> >>> >>> >> >  private HashMap<String,String> currencies;
> >>> >>> >>> >> >
> >>> >>> >>> >> >  //getters/setters
> >>> >>> >>> >> > }
> >>> >>> >>> >> > Input Data
> >>> >>> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >>> >>> >>> >> > Output
> >>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> >>> >>> >>> >> > map={y=9, x=11}
> >>> >>> >>> >> >
> >>> >>> >>> >>
> >>> >>> >>> >> thanks, Sergey
> >>> >>> >>> >>
> >>> >>> >>> >>
> >>> >>> >>> >>
> >>> >>> >>> >> > Please verify and let me know is this is good.
> >>> >>> >>> >> >
> >>> >>> >>> >> > Biju B
> >>> >>> >>> >>
> >>> >>> >>> >>
> >>> >>> >>> >>
> >>> >>> >>> >> --
> >>> >>> >>> >>  Sergey Beryozkin
> >>> >>> >>> >>
> >>> >>> >>> >> Application Integration Division of Talend
> >>> >>> >>> >> http://sberyozkin.blogspot.com
> >>> >>> >>> >>
> >>> >>> >>> >
> >>> >>> >>>
> >>> >>> >>
> >>> >>> >
> >>> >>>
> >>> >>
> >>> >>
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>>  Sergey Beryozkin
> >>>
> >>> Application Integration Division of Talend
> >>> http://sberyozkin.blogspot.com
> >>>
> >>
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
Sorry, not yet, hoping to do it shortly

Sergey

On Thu, May 26, 2011 at 8:36 PM, Biju Nair <bi...@gmail.com> wrote:
> did you get chance to update the patch and test it?
>
> Biju
>
> On Wed, May 25, 2011 at 9:09 AM, Biju Nair <bi...@gmail.com> wrote:
>
>> Attached the path in JIRA.
>>
>> Attaching with this mail also.
>>
>>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>>
>>> Hi
>>>
>>> Can you attach the updated patch to JIRA please ? I'm not seeing a
>>> patch attached to your email message.
>>>
>>> Supporting explicit Lists for JAX-RS param annotations (@PathParam,
>>> etc) is a JAX-RS spec requirement.
>>> Supporting explicit Lists which are mapped to request payloads or
>>> responses is the extensions. All JAX-RS stacks are probably supporting
>>> it, but that is an extension.
>>> Supporting MultivaluedMap in case of form submissions is a spec
>>> requirement as well. It really only makes sense for form payloads. The
>>> only other exception is probably QueryParams and may be HeaderParams,
>>> but it has to be a MultivaluedMap for a single key/multiple values
>>> case to work.
>>>
>>> Cheers, Sergey
>>>
>>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com>
>>> wrote:
>>> > I gave the Explict Map Support, becuase CXF was supporting Explict List
>>> > support.
>>> >
>>> > The code which i send you have only support for beans with nested Map
>>> > interface.
>>> >
>>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <bi...@gmail.com>
>>> wrote:
>>> >
>>> >> That was my mistake. I was using Eclipse IDE and I formatted the java
>>> file,
>>> >> so the whole file got messed up.
>>> >>
>>> >> I revereted the changes and made support only for bean with nested Map
>>> >> interface (FormParam(""),QueryParam("")..)
>>> >>
>>> >> Attaching the changed file with this mail.
>>> >> ------------------------------
>>> >> Details,
>>> >>
>>> >> Modified the changes only for supporting map's interface only inside
>>> beans.
>>> >>
>>> >> Classes Changed,
>>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
>>> >>
>>> >> Methods Changed
>>> >> public static Object handleBean(...) - Added another if clause
>>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
>>> >>
>>> >> Methods Added
>>> >> isSupportedMap
>>> >> mergeMap
>>> >> convertMultimapToMap
>>> >> injectIntoMap
>>> >>
>>> >> --------------------------
>>> >>
>>> >>
>>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
>>> sberyozkin@gmail.com>wrote:
>>> >>
>>> >>> Actually, I can see you modifying the code for explicit Maps be
>>> >>> supported as well.
>>> >>>
>>> >>> That is not a bad idea but I'd prefer for one issue (to do with
>>> >>> parameter beans containing Map fileds) addressed first.
>>> >>>
>>> >>> Explicit Maps can be supported right now (a bit of work is needed to
>>> >>> register ParameterHandler to capture Form, query or path values or
>>> >>> XmlJavaTypeAdapter to capture say XML payload).
>>> >>>
>>> >>> Please, simplify the patch a bit so that only a 'FormParam(""),
>>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
>>> >>>
>>> >>> thanks, Sergey
>>> >>>
>>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
>>> sberyozkin@gmail.com>
>>> >>> wrote:
>>> >>> > Hi
>>> >>> >
>>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <biju74techie@gmail.com
>>> >
>>> >>> wrote:
>>> >>> >> Updated the JIRA with DIFF file.
>>> >>> >>
>>> >>> >> May I know whether that worked.
>>> >>> >>
>>> >>> > I have problems applying the patch, as it seems like InjectionUtils
>>> >>> > has been completely changed, I can't spot, by looking at the diff
>>> >>> > file, what the actual changes are.
>>> >>> > I'm going to attach svn properties file from my local snapshot to
>>> >>> > JIRA, can you please give me a favor and try again with those
>>> >>> > properties applied ?
>>> >>> >
>>> >>> > thanks, Sergey
>>> >>> >
>>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>>> >>> sberyozkin@gmail.com>wrote:
>>> >>> >>
>>> >>> >>> Hi - did you see the comments on JIRA ?
>>> >>> >>> Please update your local snapshot and create a patch
>>> >>> >>>
>>> >>> >>> thanks, Sergey
>>> >>> >>>
>>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
>>> biju74techie@gmail.com>
>>> >>> wrote:
>>> >>> >>> > Created JIRA - CXF-3529
>>> >>> >>> >
>>> >>> >>> > Let me know what is the next step?
>>> >>> >>> >
>>> >>> >>> > Biju
>>> >>> >>> >
>>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>>> >>> sberyozkin@gmail.com
>>> >>> >>> >wrote:
>>> >>> >>> >
>>> >>> >>> >> Hi
>>> >>> >>> >>
>>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
>>> biju74techie@gmail.com
>>> >>> >
>>> >>> >>> wrote:
>>> >>> >>> >> > Added the Map feature for service level and bean level.
>>> >>> >>> >> >
>>> >>> >>> >> > I was not able to check-in the files, so attaching the same.
>>> >>> >>> >> >
>>> >>> >>> >>
>>> >>> >>> >> I don't see an attachment, but what you need to do is to create
>>> a
>>> >>> CXF
>>> >>> >>> >> JIRA, attach a patch and I will apply it.
>>> >>> >>> >>
>>> >>> >>> >>
>>> >>> >>> >> > Following are the changes,
>>> >>> >>> >> > Added Map Support to Rest Based Services
>>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>>> >>> >>> >> > -- Changed Signature of InjectionUtils.createParameterObject
>>> >>> >>> >> > -- Modified handleBean
>>> >>> >>> >> > -- Modified createParameterObject
>>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
>>> >>> >>> >> > -- Added InjectionUtils.mergeMap
>>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
>>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
>>> >>> >>> >> >
>>> >>> >>> >> > The code is tested with sample services like,
>>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>>> >>> >>> >> >
>>> >>> >>> >> > public class TestEmployeeTO  {
>>> >>> >>> >> >
>>> >>> >>> >> >  private HashMap<String,String> currencies;
>>> >>> >>> >> >
>>> >>> >>> >> >  //getters/setters
>>> >>> >>> >> > }
>>> >>> >>> >> > Input Data
>>> >>> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>>> >>> >>> >> > Output
>>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>>> >>> >>> >> > map={y=9, x=11}
>>> >>> >>> >> >
>>> >>> >>> >>
>>> >>> >>> >> thanks, Sergey
>>> >>> >>> >>
>>> >>> >>> >>
>>> >>> >>> >>
>>> >>> >>> >> > Please verify and let me know is this is good.
>>> >>> >>> >> >
>>> >>> >>> >> > Biju B
>>> >>> >>> >>
>>> >>> >>> >>
>>> >>> >>> >>
>>> >>> >>> >> --
>>> >>> >>> >>  Sergey Beryozkin
>>> >>> >>> >>
>>> >>> >>> >> Application Integration Division of Talend
>>> >>> >>> >> http://sberyozkin.blogspot.com
>>> >>> >>> >>
>>> >>> >>> >
>>> >>> >>>
>>> >>> >>
>>> >>> >
>>> >>>
>>> >>
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>>  Sergey Beryozkin
>>>
>>> Application Integration Division of Talend
>>> http://sberyozkin.blogspot.com
>>>
>>
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
did you get chance to update the patch and test it?

Biju

On Wed, May 25, 2011 at 9:09 AM, Biju Nair <bi...@gmail.com> wrote:

> Attached the path in JIRA.
>
> Attaching with this mail also.
>
>   On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> Can you attach the updated patch to JIRA please ? I'm not seeing a
>> patch attached to your email message.
>>
>> Supporting explicit Lists for JAX-RS param annotations (@PathParam,
>> etc) is a JAX-RS spec requirement.
>> Supporting explicit Lists which are mapped to request payloads or
>> responses is the extensions. All JAX-RS stacks are probably supporting
>> it, but that is an extension.
>> Supporting MultivaluedMap in case of form submissions is a spec
>> requirement as well. It really only makes sense for form payloads. The
>> only other exception is probably QueryParams and may be HeaderParams,
>> but it has to be a MultivaluedMap for a single key/multiple values
>> case to work.
>>
>> Cheers, Sergey
>>
>> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com>
>> wrote:
>> > I gave the Explict Map Support, becuase CXF was supporting Explict List
>> > support.
>> >
>> > The code which i send you have only support for beans with nested Map
>> > interface.
>> >
>> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >
>> >> That was my mistake. I was using Eclipse IDE and I formatted the java
>> file,
>> >> so the whole file got messed up.
>> >>
>> >> I revereted the changes and made support only for bean with nested Map
>> >> interface (FormParam(""),QueryParam("")..)
>> >>
>> >> Attaching the changed file with this mail.
>> >> ------------------------------
>> >> Details,
>> >>
>> >> Modified the changes only for supporting map's interface only inside
>> beans.
>> >>
>> >> Classes Changed,
>> >> org.apache.cxf.jaxrs.utils.InjectionUtils
>> >>
>> >> Methods Changed
>> >> public static Object handleBean(...) - Added another if clause
>> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
>> >>
>> >> Methods Added
>> >> isSupportedMap
>> >> mergeMap
>> >> convertMultimapToMap
>> >> injectIntoMap
>> >>
>> >> --------------------------
>> >>
>> >>
>> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com>wrote:
>> >>
>> >>> Actually, I can see you modifying the code for explicit Maps be
>> >>> supported as well.
>> >>>
>> >>> That is not a bad idea but I'd prefer for one issue (to do with
>> >>> parameter beans containing Map fileds) addressed first.
>> >>>
>> >>> Explicit Maps can be supported right now (a bit of work is needed to
>> >>> register ParameterHandler to capture Form, query or path values or
>> >>> XmlJavaTypeAdapter to capture say XML payload).
>> >>>
>> >>> Please, simplify the patch a bit so that only a 'FormParam(""),
>> >>> QueryParam(""),  or PathParam("") Map' case can be supported
>> >>>
>> >>> thanks, Sergey
>> >>>
>> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
>> sberyozkin@gmail.com>
>> >>> wrote:
>> >>> > Hi
>> >>> >
>> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <biju74techie@gmail.com
>> >
>> >>> wrote:
>> >>> >> Updated the JIRA with DIFF file.
>> >>> >>
>> >>> >> May I know whether that worked.
>> >>> >>
>> >>> > I have problems applying the patch, as it seems like InjectionUtils
>> >>> > has been completely changed, I can't spot, by looking at the diff
>> >>> > file, what the actual changes are.
>> >>> > I'm going to attach svn properties file from my local snapshot to
>> >>> > JIRA, can you please give me a favor and try again with those
>> >>> > properties applied ?
>> >>> >
>> >>> > thanks, Sergey
>> >>> >
>> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>> >>> sberyozkin@gmail.com>wrote:
>> >>> >>
>> >>> >>> Hi - did you see the comments on JIRA ?
>> >>> >>> Please update your local snapshot and create a patch
>> >>> >>>
>> >>> >>> thanks, Sergey
>> >>> >>>
>> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <
>> biju74techie@gmail.com>
>> >>> wrote:
>> >>> >>> > Created JIRA - CXF-3529
>> >>> >>> >
>> >>> >>> > Let me know what is the next step?
>> >>> >>> >
>> >>> >>> > Biju
>> >>> >>> >
>> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>> >>> sberyozkin@gmail.com
>> >>> >>> >wrote:
>> >>> >>> >
>> >>> >>> >> Hi
>> >>> >>> >>
>> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
>> biju74techie@gmail.com
>> >>> >
>> >>> >>> wrote:
>> >>> >>> >> > Added the Map feature for service level and bean level.
>> >>> >>> >> >
>> >>> >>> >> > I was not able to check-in the files, so attaching the same.
>> >>> >>> >> >
>> >>> >>> >>
>> >>> >>> >> I don't see an attachment, but what you need to do is to create
>> a
>> >>> CXF
>> >>> >>> >> JIRA, attach a patch and I will apply it.
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >> > Following are the changes,
>> >>> >>> >> > Added Map Support to Rest Based Services
>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>> >>> >>> >> > -- Changed Signature of InjectionUtils.createParameterObject
>> >>> >>> >> > -- Modified handleBean
>> >>> >>> >> > -- Modified createParameterObject
>> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
>> >>> >>> >> > -- Added InjectionUtils.mergeMap
>> >>> >>> >> > -- Added JAXRSUtils.processMapValue
>> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
>> >>> >>> >> >
>> >>> >>> >> > The code is tested with sample services like,
>> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>> >>> >>> >> >
>> >>> >>> >> > public class TestEmployeeTO  {
>> >>> >>> >> >
>> >>> >>> >> >  private HashMap<String,String> currencies;
>> >>> >>> >> >
>> >>> >>> >> >  //getters/setters
>> >>> >>> >> > }
>> >>> >>> >> > Input Data
>> >>> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> >>> >>> >> > Output
>> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> >>> >>> >> > map={y=9, x=11}
>> >>> >>> >> >
>> >>> >>> >>
>> >>> >>> >> thanks, Sergey
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >> > Please verify and let me know is this is good.
>> >>> >>> >> >
>> >>> >>> >> > Biju B
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >> --
>> >>> >>> >>  Sergey Beryozkin
>> >>> >>> >>
>> >>> >>> >> Application Integration Division of Talend
>> >>> >>> >> http://sberyozkin.blogspot.com
>> >>> >>> >>
>> >>> >>> >
>> >>> >>>
>> >>> >>
>> >>> >
>> >>>
>> >>
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Attached the path in JIRA.

Attaching with this mail also.

On Wed, May 25, 2011 at 4:33 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> Can you attach the updated patch to JIRA please ? I'm not seeing a
> patch attached to your email message.
>
> Supporting explicit Lists for JAX-RS param annotations (@PathParam,
> etc) is a JAX-RS spec requirement.
> Supporting explicit Lists which are mapped to request payloads or
> responses is the extensions. All JAX-RS stacks are probably supporting
> it, but that is an extension.
> Supporting MultivaluedMap in case of form submissions is a spec
> requirement as well. It really only makes sense for form payloads. The
> only other exception is probably QueryParams and may be HeaderParams,
> but it has to be a MultivaluedMap for a single key/multiple values
> case to work.
>
> Cheers, Sergey
>
> On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com> wrote:
> > I gave the Explict Map Support, becuase CXF was supporting Explict List
> > support.
> >
> > The code which i send you have only support for beans with nested Map
> > interface.
> >
> > On Tue, May 24, 2011 at 8:28 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >
> >> That was my mistake. I was using Eclipse IDE and I formatted the java
> file,
> >> so the whole file got messed up.
> >>
> >> I revereted the changes and made support only for bean with nested Map
> >> interface (FormParam(""),QueryParam("")..)
> >>
> >> Attaching the changed file with this mail.
> >> ------------------------------
> >> Details,
> >>
> >> Modified the changes only for supporting map's interface only inside
> beans.
> >>
> >> Classes Changed,
> >> org.apache.cxf.jaxrs.utils.InjectionUtils
> >>
> >> Methods Changed
> >> public static Object handleBean(...) - Added another if clause
> >> "} else if (InjectionUtils.isSupportedMap(type)) {"
> >>
> >> Methods Added
> >> isSupportedMap
> >> mergeMap
> >> convertMultimapToMap
> >> injectIntoMap
> >>
> >> --------------------------
> >>
> >>
> >>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <
> sberyozkin@gmail.com>wrote:
> >>
> >>> Actually, I can see you modifying the code for explicit Maps be
> >>> supported as well.
> >>>
> >>> That is not a bad idea but I'd prefer for one issue (to do with
> >>> parameter beans containing Map fileds) addressed first.
> >>>
> >>> Explicit Maps can be supported right now (a bit of work is needed to
> >>> register ParameterHandler to capture Form, query or path values or
> >>> XmlJavaTypeAdapter to capture say XML payload).
> >>>
> >>> Please, simplify the patch a bit so that only a 'FormParam(""),
> >>> QueryParam(""),  or PathParam("") Map' case can be supported
> >>>
> >>> thanks, Sergey
> >>>
> >>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <
> sberyozkin@gmail.com>
> >>> wrote:
> >>> > Hi
> >>> >
> >>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <bi...@gmail.com>
> >>> wrote:
> >>> >> Updated the JIRA with DIFF file.
> >>> >>
> >>> >> May I know whether that worked.
> >>> >>
> >>> > I have problems applying the patch, as it seems like InjectionUtils
> >>> > has been completely changed, I can't spot, by looking at the diff
> >>> > file, what the actual changes are.
> >>> > I'm going to attach svn properties file from my local snapshot to
> >>> > JIRA, can you please give me a favor and try again with those
> >>> > properties applied ?
> >>> >
> >>> > thanks, Sergey
> >>> >
> >>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
> >>> sberyozkin@gmail.com>wrote:
> >>> >>
> >>> >>> Hi - did you see the comments on JIRA ?
> >>> >>> Please update your local snapshot and create a patch
> >>> >>>
> >>> >>> thanks, Sergey
> >>> >>>
> >>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <biju74techie@gmail.com
> >
> >>> wrote:
> >>> >>> > Created JIRA - CXF-3529
> >>> >>> >
> >>> >>> > Let me know what is the next step?
> >>> >>> >
> >>> >>> > Biju
> >>> >>> >
> >>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
> >>> sberyozkin@gmail.com
> >>> >>> >wrote:
> >>> >>> >
> >>> >>> >> Hi
> >>> >>> >>
> >>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <
> biju74techie@gmail.com
> >>> >
> >>> >>> wrote:
> >>> >>> >> > Added the Map feature for service level and bean level.
> >>> >>> >> >
> >>> >>> >> > I was not able to check-in the files, so attaching the same.
> >>> >>> >> >
> >>> >>> >>
> >>> >>> >> I don't see an attachment, but what you need to do is to create
> a
> >>> CXF
> >>> >>> >> JIRA, attach a patch and I will apply it.
> >>> >>> >>
> >>> >>> >>
> >>> >>> >> > Following are the changes,
> >>> >>> >> > Added Map Support to Rest Based Services
> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
> >>> >>> >> > -- Changed Signature of InjectionUtils.createParameterObject
> >>> >>> >> > -- Modified handleBean
> >>> >>> >> > -- Modified createParameterObject
> >>> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >>> >> > -- Added InjectionUtils.isSupportedMap
> >>> >>> >> > -- Added InjectionUtils.mergeMap
> >>> >>> >> > -- Added JAXRSUtils.processMapValue
> >>> >>> >> > -- Changed JAXRSUtils.processFormParam
> >>> >>> >> >
> >>> >>> >> > The code is tested with sample services like,
> >>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
> >>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
> >>> >>> >> >
> >>> >>> >> > public class TestEmployeeTO  {
> >>> >>> >> >
> >>> >>> >> >  private HashMap<String,String> currencies;
> >>> >>> >> >
> >>> >>> >> >  //getters/setters
> >>> >>> >> > }
> >>> >>> >> > Input Data
> >>> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >>> >>> >> > Output
> >>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> >>> >>> >> > map={y=9, x=11}
> >>> >>> >> >
> >>> >>> >>
> >>> >>> >> thanks, Sergey
> >>> >>> >>
> >>> >>> >>
> >>> >>> >>
> >>> >>> >> > Please verify and let me know is this is good.
> >>> >>> >> >
> >>> >>> >> > Biju B
> >>> >>> >>
> >>> >>> >>
> >>> >>> >>
> >>> >>> >> --
> >>> >>> >>  Sergey Beryozkin
> >>> >>> >>
> >>> >>> >> Application Integration Division of Talend
> >>> >>> >> http://sberyozkin.blogspot.com
> >>> >>> >>
> >>> >>> >
> >>> >>>
> >>> >>
> >>> >
> >>>
> >>
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

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

Can you attach the updated patch to JIRA please ? I'm not seeing a
patch attached to your email message.

Supporting explicit Lists for JAX-RS param annotations (@PathParam,
etc) is a JAX-RS spec requirement.
Supporting explicit Lists which are mapped to request payloads or
responses is the extensions. All JAX-RS stacks are probably supporting
it, but that is an extension.
Supporting MultivaluedMap in case of form submissions is a spec
requirement as well. It really only makes sense for form payloads. The
only other exception is probably QueryParams and may be HeaderParams,
but it has to be a MultivaluedMap for a single key/multiple values
case to work.

Cheers, Sergey

On Wed, May 25, 2011 at 4:45 AM, Biju Nair <bi...@gmail.com> wrote:
> I gave the Explict Map Support, becuase CXF was supporting Explict List
> support.
>
> The code which i send you have only support for beans with nested Map
> interface.
>
> On Tue, May 24, 2011 at 8:28 PM, Biju Nair <bi...@gmail.com> wrote:
>
>> That was my mistake. I was using Eclipse IDE and I formatted the java file,
>> so the whole file got messed up.
>>
>> I revereted the changes and made support only for bean with nested Map
>> interface (FormParam(""),QueryParam("")..)
>>
>> Attaching the changed file with this mail.
>> ------------------------------
>> Details,
>>
>> Modified the changes only for supporting map's interface only inside beans.
>>
>> Classes Changed,
>> org.apache.cxf.jaxrs.utils.InjectionUtils
>>
>> Methods Changed
>> public static Object handleBean(...) - Added another if clause
>> "} else if (InjectionUtils.isSupportedMap(type)) {"
>>
>> Methods Added
>> isSupportedMap
>> mergeMap
>> convertMultimapToMap
>> injectIntoMap
>>
>> --------------------------
>>
>>
>>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>>
>>> Actually, I can see you modifying the code for explicit Maps be
>>> supported as well.
>>>
>>> That is not a bad idea but I'd prefer for one issue (to do with
>>> parameter beans containing Map fileds) addressed first.
>>>
>>> Explicit Maps can be supported right now (a bit of work is needed to
>>> register ParameterHandler to capture Form, query or path values or
>>> XmlJavaTypeAdapter to capture say XML payload).
>>>
>>> Please, simplify the patch a bit so that only a 'FormParam(""),
>>> QueryParam(""),  or PathParam("") Map' case can be supported
>>>
>>> thanks, Sergey
>>>
>>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <sb...@gmail.com>
>>> wrote:
>>> > Hi
>>> >
>>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <bi...@gmail.com>
>>> wrote:
>>> >> Updated the JIRA with DIFF file.
>>> >>
>>> >> May I know whether that worked.
>>> >>
>>> > I have problems applying the patch, as it seems like InjectionUtils
>>> > has been completely changed, I can't spot, by looking at the diff
>>> > file, what the actual changes are.
>>> > I'm going to attach svn properties file from my local snapshot to
>>> > JIRA, can you please give me a favor and try again with those
>>> > properties applied ?
>>> >
>>> > thanks, Sergey
>>> >
>>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>>> sberyozkin@gmail.com>wrote:
>>> >>
>>> >>> Hi - did you see the comments on JIRA ?
>>> >>> Please update your local snapshot and create a patch
>>> >>>
>>> >>> thanks, Sergey
>>> >>>
>>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <bi...@gmail.com>
>>> wrote:
>>> >>> > Created JIRA - CXF-3529
>>> >>> >
>>> >>> > Let me know what is the next step?
>>> >>> >
>>> >>> > Biju
>>> >>> >
>>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>>> sberyozkin@gmail.com
>>> >>> >wrote:
>>> >>> >
>>> >>> >> Hi
>>> >>> >>
>>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <biju74techie@gmail.com
>>> >
>>> >>> wrote:
>>> >>> >> > Added the Map feature for service level and bean level.
>>> >>> >> >
>>> >>> >> > I was not able to check-in the files, so attaching the same.
>>> >>> >> >
>>> >>> >>
>>> >>> >> I don't see an attachment, but what you need to do is to create a
>>> CXF
>>> >>> >> JIRA, attach a patch and I will apply it.
>>> >>> >>
>>> >>> >>
>>> >>> >> > Following are the changes,
>>> >>> >> > Added Map Support to Rest Based Services
>>> >>> >> > -- Added InjectionUtils.injectIntoMap
>>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>>> >>> >> > -- Changed Signature of InjectionUtils.createParameterObject
>>> >>> >> > -- Modified handleBean
>>> >>> >> > -- Modified createParameterObject
>>> >>> >> > -- Added InjectionUtils.injectIntoMap
>>> >>> >> > -- Added InjectionUtils.isSupportedMap
>>> >>> >> > -- Added InjectionUtils.mergeMap
>>> >>> >> > -- Added JAXRSUtils.processMapValue
>>> >>> >> > -- Changed JAXRSUtils.processFormParam
>>> >>> >> >
>>> >>> >> > The code is tested with sample services like,
>>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>>> >>> >> >
>>> >>> >> > public class TestEmployeeTO  {
>>> >>> >> >
>>> >>> >> >  private HashMap<String,String> currencies;
>>> >>> >> >
>>> >>> >> >  //getters/setters
>>> >>> >> > }
>>> >>> >> > Input Data
>>> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>>> >>> >> > Output
>>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>>> >>> >> > map={y=9, x=11}
>>> >>> >> >
>>> >>> >>
>>> >>> >> thanks, Sergey
>>> >>> >>
>>> >>> >>
>>> >>> >>
>>> >>> >> > Please verify and let me know is this is good.
>>> >>> >> >
>>> >>> >> > Biju B
>>> >>> >>
>>> >>> >>
>>> >>> >>
>>> >>> >> --
>>> >>> >>  Sergey Beryozkin
>>> >>> >>
>>> >>> >> Application Integration Division of Talend
>>> >>> >> http://sberyozkin.blogspot.com
>>> >>> >>
>>> >>> >
>>> >>>
>>> >>
>>> >
>>>
>>
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
I gave the Explict Map Support, becuase CXF was supporting Explict List
support.

The code which i send you have only support for beans with nested Map
interface.

On Tue, May 24, 2011 at 8:28 PM, Biju Nair <bi...@gmail.com> wrote:

> That was my mistake. I was using Eclipse IDE and I formatted the java file,
> so the whole file got messed up.
>
> I revereted the changes and made support only for bean with nested Map
> interface (FormParam(""),QueryParam("")..)
>
> Attaching the changed file with this mail.
> ------------------------------
> Details,
>
> Modified the changes only for supporting map's interface only inside beans.
>
> Classes Changed,
> org.apache.cxf.jaxrs.utils.InjectionUtils
>
> Methods Changed
> public static Object handleBean(...) - Added another if clause
> "} else if (InjectionUtils.isSupportedMap(type)) {"
>
> Methods Added
> isSupportedMap
> mergeMap
> convertMultimapToMap
> injectIntoMap
>
> --------------------------
>
>
>   On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Actually, I can see you modifying the code for explicit Maps be
>> supported as well.
>>
>> That is not a bad idea but I'd prefer for one issue (to do with
>> parameter beans containing Map fileds) addressed first.
>>
>> Explicit Maps can be supported right now (a bit of work is needed to
>> register ParameterHandler to capture Form, query or path values or
>> XmlJavaTypeAdapter to capture say XML payload).
>>
>> Please, simplify the patch a bit so that only a 'FormParam(""),
>> QueryParam(""),  or PathParam("") Map' case can be supported
>>
>> thanks, Sergey
>>
>> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>> > Hi
>> >
>> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> Updated the JIRA with DIFF file.
>> >>
>> >> May I know whether that worked.
>> >>
>> > I have problems applying the patch, as it seems like InjectionUtils
>> > has been completely changed, I can't spot, by looking at the diff
>> > file, what the actual changes are.
>> > I'm going to attach svn properties file from my local snapshot to
>> > JIRA, can you please give me a favor and try again with those
>> > properties applied ?
>> >
>> > thanks, Sergey
>> >
>> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com>wrote:
>> >>
>> >>> Hi - did you see the comments on JIRA ?
>> >>> Please update your local snapshot and create a patch
>> >>>
>> >>> thanks, Sergey
>> >>>
>> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >>> > Created JIRA - CXF-3529
>> >>> >
>> >>> > Let me know what is the next step?
>> >>> >
>> >>> > Biju
>> >>> >
>> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com
>> >>> >wrote:
>> >>> >
>> >>> >> Hi
>> >>> >>
>> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <biju74techie@gmail.com
>> >
>> >>> wrote:
>> >>> >> > Added the Map feature for service level and bean level.
>> >>> >> >
>> >>> >> > I was not able to check-in the files, so attaching the same.
>> >>> >> >
>> >>> >>
>> >>> >> I don't see an attachment, but what you need to do is to create a
>> CXF
>> >>> >> JIRA, attach a patch and I will apply it.
>> >>> >>
>> >>> >>
>> >>> >> > Following are the changes,
>> >>> >> > Added Map Support to Rest Based Services
>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >>> >> > -- Added InjectionUtils.convertMultimapToMap
>> >>> >> > -- Changed Signature of InjectionUtils.createParameterObject
>> >>> >> > -- Modified handleBean
>> >>> >> > -- Modified createParameterObject
>> >>> >> > -- Added InjectionUtils.injectIntoMap
>> >>> >> > -- Added InjectionUtils.isSupportedMap
>> >>> >> > -- Added InjectionUtils.mergeMap
>> >>> >> > -- Added JAXRSUtils.processMapValue
>> >>> >> > -- Changed JAXRSUtils.processFormParam
>> >>> >> >
>> >>> >> > The code is tested with sample services like,
>> >>> >> > public String debug(@FormParam("")TestEmployeeTO
>> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>> >>> >> >
>> >>> >> > public class TestEmployeeTO  {
>> >>> >> >
>> >>> >> >  private HashMap<String,String> currencies;
>> >>> >> >
>> >>> >> >  //getters/setters
>> >>> >> > }
>> >>> >> > Input Data
>> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> >>> >> > Output
>> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> >>> >> > map={y=9, x=11}
>> >>> >> >
>> >>> >>
>> >>> >> thanks, Sergey
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> > Please verify and let me know is this is good.
>> >>> >> >
>> >>> >> > Biju B
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> --
>> >>> >>  Sergey Beryozkin
>> >>> >>
>> >>> >> Application Integration Division of Talend
>> >>> >> http://sberyozkin.blogspot.com
>> >>> >>
>> >>> >
>> >>>
>> >>
>> >
>>
>
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
That was my mistake. I was using Eclipse IDE and I formatted the java file,
so the whole file got messed up.

I revereted the changes and made support only for bean with nested Map
interface (FormParam(""),QueryParam("")..)

Attaching the changed file with this mail.
------------------------------
Details,

Modified the changes only for supporting map's interface only inside beans.

Classes Changed,
org.apache.cxf.jaxrs.utils.InjectionUtils

Methods Changed
public static Object handleBean(...) - Added another if clause
"} else if (InjectionUtils.isSupportedMap(type)) {"

Methods Added
isSupportedMap
mergeMap
convertMultimapToMap
injectIntoMap

--------------------------

On Tue, May 24, 2011 at 4:36 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Actually, I can see you modifying the code for explicit Maps be
> supported as well.
>
> That is not a bad idea but I'd prefer for one issue (to do with
> parameter beans containing Map fileds) addressed first.
>
> Explicit Maps can be supported right now (a bit of work is needed to
> register ParameterHandler to capture Form, query or path values or
> XmlJavaTypeAdapter to capture say XML payload).
>
> Please, simplify the patch a bit so that only a 'FormParam(""),
> QueryParam(""),  or PathParam("") Map' case can be supported
>
> thanks, Sergey
>
> On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
> > Hi
> >
> > On Fri, May 20, 2011 at 11:23 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> Updated the JIRA with DIFF file.
> >>
> >> May I know whether that worked.
> >>
> > I have problems applying the patch, as it seems like InjectionUtils
> > has been completely changed, I can't spot, by looking at the diff
> > file, what the actual changes are.
> > I'm going to attach svn properties file from my local snapshot to
> > JIRA, can you please give me a favor and try again with those
> > properties applied ?
> >
> > thanks, Sergey
> >
> >> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >>
> >>> Hi - did you see the comments on JIRA ?
> >>> Please update your local snapshot and create a patch
> >>>
> >>> thanks, Sergey
> >>>
> >>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >>> > Created JIRA - CXF-3529
> >>> >
> >>> > Let me know what is the next step?
> >>> >
> >>> > Biju
> >>> >
> >>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >>> >wrote:
> >>> >
> >>> >> Hi
> >>> >>
> >>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <bi...@gmail.com>
> >>> wrote:
> >>> >> > Added the Map feature for service level and bean level.
> >>> >> >
> >>> >> > I was not able to check-in the files, so attaching the same.
> >>> >> >
> >>> >>
> >>> >> I don't see an attachment, but what you need to do is to create a
> CXF
> >>> >> JIRA, attach a patch and I will apply it.
> >>> >>
> >>> >>
> >>> >> > Following are the changes,
> >>> >> > Added Map Support to Rest Based Services
> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >> > -- Added InjectionUtils.convertMultimapToMap
> >>> >> > -- Changed Signature of InjectionUtils.createParameterObject
> >>> >> > -- Modified handleBean
> >>> >> > -- Modified createParameterObject
> >>> >> > -- Added InjectionUtils.injectIntoMap
> >>> >> > -- Added InjectionUtils.isSupportedMap
> >>> >> > -- Added InjectionUtils.mergeMap
> >>> >> > -- Added JAXRSUtils.processMapValue
> >>> >> > -- Changed JAXRSUtils.processFormParam
> >>> >> >
> >>> >> > The code is tested with sample services like,
> >>> >> > public String debug(@FormParam("")TestEmployeeTO
> >>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
> >>> >> >
> >>> >> > public class TestEmployeeTO  {
> >>> >> >
> >>> >> >  private HashMap<String,String> currencies;
> >>> >> >
> >>> >> >  //getters/setters
> >>> >> > }
> >>> >> > Input Data
> >>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >>> >> > Output
> >>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> >>> >> > map={y=9, x=11}
> >>> >> >
> >>> >>
> >>> >> thanks, Sergey
> >>> >>
> >>> >>
> >>> >>
> >>> >> > Please verify and let me know is this is good.
> >>> >> >
> >>> >> > Biju B
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >>  Sergey Beryozkin
> >>> >>
> >>> >> Application Integration Division of Talend
> >>> >> http://sberyozkin.blogspot.com
> >>> >>
> >>> >
> >>>
> >>
> >
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
Actually, I can see you modifying the code for explicit Maps be
supported as well.

That is not a bad idea but I'd prefer for one issue (to do with
parameter beans containing Map fileds) addressed first.

Explicit Maps can be supported right now (a bit of work is needed to
register ParameterHandler to capture Form, query or path values or
XmlJavaTypeAdapter to capture say XML payload).

Please, simplify the patch a bit so that only a 'FormParam(""),
QueryParam(""),  or PathParam("") Map' case can be supported

thanks, Sergey

On Tue, May 24, 2011 at 12:04 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Hi
>
> On Fri, May 20, 2011 at 11:23 PM, Biju Nair <bi...@gmail.com> wrote:
>> Updated the JIRA with DIFF file.
>>
>> May I know whether that worked.
>>
> I have problems applying the patch, as it seems like InjectionUtils
> has been completely changed, I can't spot, by looking at the diff
> file, what the actual changes are.
> I'm going to attach svn properties file from my local snapshot to
> JIRA, can you please give me a favor and try again with those
> properties applied ?
>
> thanks, Sergey
>
>> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>>
>>> Hi - did you see the comments on JIRA ?
>>> Please update your local snapshot and create a patch
>>>
>>> thanks, Sergey
>>>
>>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <bi...@gmail.com> wrote:
>>> > Created JIRA - CXF-3529
>>> >
>>> > Let me know what is the next step?
>>> >
>>> > Biju
>>> >
>>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <sberyozkin@gmail.com
>>> >wrote:
>>> >
>>> >> Hi
>>> >>
>>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <bi...@gmail.com>
>>> wrote:
>>> >> > Added the Map feature for service level and bean level.
>>> >> >
>>> >> > I was not able to check-in the files, so attaching the same.
>>> >> >
>>> >>
>>> >> I don't see an attachment, but what you need to do is to create a CXF
>>> >> JIRA, attach a patch and I will apply it.
>>> >>
>>> >>
>>> >> > Following are the changes,
>>> >> > Added Map Support to Rest Based Services
>>> >> > -- Added InjectionUtils.injectIntoMap
>>> >> > -- Added InjectionUtils.convertMultimapToMap
>>> >> > -- Changed Signature of InjectionUtils.createParameterObject
>>> >> > -- Modified handleBean
>>> >> > -- Modified createParameterObject
>>> >> > -- Added InjectionUtils.injectIntoMap
>>> >> > -- Added InjectionUtils.isSupportedMap
>>> >> > -- Added InjectionUtils.mergeMap
>>> >> > -- Added JAXRSUtils.processMapValue
>>> >> > -- Changed JAXRSUtils.processFormParam
>>> >> >
>>> >> > The code is tested with sample services like,
>>> >> > public String debug(@FormParam("")TestEmployeeTO
>>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>>> >> >
>>> >> > public class TestEmployeeTO  {
>>> >> >
>>> >> >  private HashMap<String,String> currencies;
>>> >> >
>>> >> >  //getters/setters
>>> >> > }
>>> >> > Input Data
>>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>>> >> > Output
>>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>>> >> > map={y=9, x=11}
>>> >> >
>>> >>
>>> >> thanks, Sergey
>>> >>
>>> >>
>>> >>
>>> >> > Please verify and let me know is this is good.
>>> >> >
>>> >> > Biju B
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >>  Sergey Beryozkin
>>> >>
>>> >> Application Integration Division of Talend
>>> >> http://sberyozkin.blogspot.com
>>> >>
>>> >
>>>
>>
>

Re: Custom Reuqest Param Name for Bean Request Object

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

On Fri, May 20, 2011 at 11:23 PM, Biju Nair <bi...@gmail.com> wrote:
> Updated the JIRA with DIFF file.
>
> May I know whether that worked.
>
I have problems applying the patch, as it seems like InjectionUtils
has been completely changed, I can't spot, by looking at the diff
file, what the actual changes are.
I'm going to attach svn properties file from my local snapshot to
JIRA, can you please give me a favor and try again with those
properties applied ?

thanks, Sergey

> On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi - did you see the comments on JIRA ?
>> Please update your local snapshot and create a patch
>>
>> thanks, Sergey
>>
>> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Created JIRA - CXF-3529
>> >
>> > Let me know what is the next step?
>> >
>> > Biju
>> >
>> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Hi
>> >>
>> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > Added the Map feature for service level and bean level.
>> >> >
>> >> > I was not able to check-in the files, so attaching the same.
>> >> >
>> >>
>> >> I don't see an attachment, but what you need to do is to create a CXF
>> >> JIRA, attach a patch and I will apply it.
>> >>
>> >>
>> >> > Following are the changes,
>> >> > Added Map Support to Rest Based Services
>> >> > -- Added InjectionUtils.injectIntoMap
>> >> > -- Added InjectionUtils.convertMultimapToMap
>> >> > -- Changed Signature of InjectionUtils.createParameterObject
>> >> > -- Modified handleBean
>> >> > -- Modified createParameterObject
>> >> > -- Added InjectionUtils.injectIntoMap
>> >> > -- Added InjectionUtils.isSupportedMap
>> >> > -- Added InjectionUtils.mergeMap
>> >> > -- Added JAXRSUtils.processMapValue
>> >> > -- Changed JAXRSUtils.processFormParam
>> >> >
>> >> > The code is tested with sample services like,
>> >> > public String debug(@FormParam("")TestEmployeeTO
>> >> > testObject1,@FormParam("map") Map<String,Integer> map)
>> >> >
>> >> > public class TestEmployeeTO  {
>> >> >
>> >> >  private HashMap<String,String> currencies;
>> >> >
>> >> >  //getters/setters
>> >> > }
>> >> > Input Data
>> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> >> > Output
>> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> >> > map={y=9, x=11}
>> >> >
>> >>
>> >> thanks, Sergey
>> >>
>> >>
>> >>
>> >> > Please verify and let me know is this is good.
>> >> >
>> >> > Biju B
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Updated the JIRA with DIFF file.

May I know whether that worked.

On Fri, May 20, 2011 at 2:26 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi - did you see the comments on JIRA ?
> Please update your local snapshot and create a patch
>
> thanks, Sergey
>
> On Tue, May 17, 2011 at 9:25 PM, Biju Nair <bi...@gmail.com> wrote:
> > Created JIRA - CXF-3529
> >
> > Let me know what is the next step?
> >
> > Biju
> >
> > On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Hi
> >>
> >> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > Added the Map feature for service level and bean level.
> >> >
> >> > I was not able to check-in the files, so attaching the same.
> >> >
> >>
> >> I don't see an attachment, but what you need to do is to create a CXF
> >> JIRA, attach a patch and I will apply it.
> >>
> >>
> >> > Following are the changes,
> >> > Added Map Support to Rest Based Services
> >> > -- Added InjectionUtils.injectIntoMap
> >> > -- Added InjectionUtils.convertMultimapToMap
> >> > -- Changed Signature of InjectionUtils.createParameterObject
> >> > -- Modified handleBean
> >> > -- Modified createParameterObject
> >> > -- Added InjectionUtils.injectIntoMap
> >> > -- Added InjectionUtils.isSupportedMap
> >> > -- Added InjectionUtils.mergeMap
> >> > -- Added JAXRSUtils.processMapValue
> >> > -- Changed JAXRSUtils.processFormParam
> >> >
> >> > The code is tested with sample services like,
> >> > public String debug(@FormParam("")TestEmployeeTO
> >> > testObject1,@FormParam("map") Map<String,Integer> map)
> >> >
> >> > public class TestEmployeeTO  {
> >> >
> >> >  private HashMap<String,String> currencies;
> >> >
> >> >  //getters/setters
> >> > }
> >> > Input Data
> >> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> >> > Output
> >> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> >> > map={y=9, x=11}
> >> >
> >>
> >> thanks, Sergey
> >>
> >>
> >>
> >> > Please verify and let me know is this is good.
> >> >
> >> > Biju B
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi - did you see the comments on JIRA ?
Please update your local snapshot and create a patch

thanks, Sergey

On Tue, May 17, 2011 at 9:25 PM, Biju Nair <bi...@gmail.com> wrote:
> Created JIRA - CXF-3529
>
> Let me know what is the next step?
>
> Biju
>
> On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <bi...@gmail.com> wrote:
>> > Added the Map feature for service level and bean level.
>> >
>> > I was not able to check-in the files, so attaching the same.
>> >
>>
>> I don't see an attachment, but what you need to do is to create a CXF
>> JIRA, attach a patch and I will apply it.
>>
>>
>> > Following are the changes,
>> > Added Map Support to Rest Based Services
>> > -- Added InjectionUtils.injectIntoMap
>> > -- Added InjectionUtils.convertMultimapToMap
>> > -- Changed Signature of InjectionUtils.createParameterObject
>> > -- Modified handleBean
>> > -- Modified createParameterObject
>> > -- Added InjectionUtils.injectIntoMap
>> > -- Added InjectionUtils.isSupportedMap
>> > -- Added InjectionUtils.mergeMap
>> > -- Added JAXRSUtils.processMapValue
>> > -- Changed JAXRSUtils.processFormParam
>> >
>> > The code is tested with sample services like,
>> > public String debug(@FormParam("")TestEmployeeTO
>> > testObject1,@FormParam("map") Map<String,Integer> map)
>> >
>> > public class TestEmployeeTO  {
>> >
>> >  private HashMap<String,String> currencies;
>> >
>> >  //getters/setters
>> > }
>> > Input Data
>> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
>> > Output
>> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
>> > map={y=9, x=11}
>> >
>>
>> thanks, Sergey
>>
>>
>>
>> > Please verify and let me know is this is good.
>> >
>> > Biju B
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Created JIRA - CXF-3529

Let me know what is the next step?

Biju

On Tue, May 17, 2011 at 1:51 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On Tue, May 17, 2011 at 7:09 AM, Biju Nair <bi...@gmail.com> wrote:
> > Added the Map feature for service level and bean level.
> >
> > I was not able to check-in the files, so attaching the same.
> >
>
> I don't see an attachment, but what you need to do is to create a CXF
> JIRA, attach a patch and I will apply it.
>
>
> > Following are the changes,
> > Added Map Support to Rest Based Services
> > -- Added InjectionUtils.injectIntoMap
> > -- Added InjectionUtils.convertMultimapToMap
> > -- Changed Signature of InjectionUtils.createParameterObject
> > -- Modified handleBean
> > -- Modified createParameterObject
> > -- Added InjectionUtils.injectIntoMap
> > -- Added InjectionUtils.isSupportedMap
> > -- Added InjectionUtils.mergeMap
> > -- Added JAXRSUtils.processMapValue
> > -- Changed JAXRSUtils.processFormParam
> >
> > The code is tested with sample services like,
> > public String debug(@FormParam("")TestEmployeeTO
> > testObject1,@FormParam("map") Map<String,Integer> map)
> >
> > public class TestEmployeeTO  {
> >
> >  private HashMap<String,String> currencies;
> >
> >  //getters/setters
> > }
> > Input Data
> > map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> > Output
> > TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> > map={y=9, x=11}
> >
>
> thanks, Sergey
>
>
>
> > Please verify and let me know is this is good.
> >
> > Biju B
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

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

On Tue, May 17, 2011 at 7:09 AM, Biju Nair <bi...@gmail.com> wrote:
> Added the Map feature for service level and bean level.
>
> I was not able to check-in the files, so attaching the same.
>

I don't see an attachment, but what you need to do is to create a CXF
JIRA, attach a patch and I will apply it.


> Following are the changes,
> Added Map Support to Rest Based Services
> -- Added InjectionUtils.injectIntoMap
> -- Added InjectionUtils.convertMultimapToMap
> -- Changed Signature of InjectionUtils.createParameterObject
> -- Modified handleBean
> -- Modified createParameterObject
> -- Added InjectionUtils.injectIntoMap
> -- Added InjectionUtils.isSupportedMap
> -- Added InjectionUtils.mergeMap
> -- Added JAXRSUtils.processMapValue
> -- Changed JAXRSUtils.processFormParam
>
> The code is tested with sample services like,
> public String debug(@FormParam("")TestEmployeeTO
> testObject1,@FormParam("map") Map<String,Integer> map)
>
> public class TestEmployeeTO  {
>
>  private HashMap<String,String> currencies;
>
>  //getters/setters
> }
> Input Data
> map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
> Output
> TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
> map={y=9, x=11}
>

thanks, Sergey



> Please verify and let me know is this is good.
>
> Biju B



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Added the Map feature for service level and bean level.

I was not able to check-in the files, so attaching the same.

Following are the changes,
Added Map Support to Rest Based Services
-- Added InjectionUtils.injectIntoMap
-- Added InjectionUtils.convertMultimapToMap
-- Changed Signature of InjectionUtils.createParameterObject
-- Modified handleBean
-- Modified createParameterObject
-- Added InjectionUtils.injectIntoMap
-- Added InjectionUtils.isSupportedMap
-- Added InjectionUtils.mergeMap
-- Added JAXRSUtils.processMapValue
-- Changed JAXRSUtils.processFormParam

The code is tested with sample services like,
*public String debug(@FormParam("")TestEmployeeTO
testObject1,@FormParam("map") Map<String,Integer> map)*

public class TestEmployeeTO  {

 private HashMap<String,String> currencies;

 //getters/setters
}
Input Data
map.x=11&map.y=9&currencies.IND=INR&currencies.USA=DOLLAR
Output
TestEmployeeTO[currencies={IND=INR, USA=DOLLAR}]
map={y=9, x=11}

Please verify and let me know is this is good.

Biju B

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
Yes, that URL is correct [1]

Did you have problems checking it out ? If yes then it must've been a
transient issue

Cheers, Sergey

[1] http://cxf.apache.org/source-repository.html

On Fri, May 13, 2011 at 6:35 PM, Biju Nair <bi...@gmail.com> wrote:
> i don't see the SVN branch.
>
> I am trying to change in http://svn.apache.org/repos/asf/cxf/trunk - is that
> ok? If not can you sen me the SVN link?
>
> On Fri, May 13, 2011 at 1:48 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> 2.4.1-SNAPSHOT is the trunk version - so please check it out if you
>> decide to work on a pacth, I'll then backmerge it to
>> 2.3.5-SNAPSHOT
>>
>> Cheers, Sergey
>>
>> On Thu, May 12, 2011 at 9:51 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Which version of CXF you are working on?
>> >
>> > I was working with 2.3.1.
>> >
>> > On Thu, May 12, 2011 at 1:08 PM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Hi
>> >>
>> >> On Thu, May 12, 2011 at 8:21 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > Just to clarify,
>> >> >
>> >> > the user bean will be something like,
>> >> > class User{
>> >> >   Map<String, String> params;
>> >> > }
>> >> >
>> >> > Request Data will be user.params.k1=v1&*user.*params.k2=v2
>> >>
>> >> Yes if User is a nested bean, otherwise just
>> >> params.k1=v1&params.k2=v2
>> >>
>> >> if we have FormParam("") User
>> >>
>> >> >
>> >> > Finally, the params map will have [{k1=v1},{k2=v2}]
>> >> >
>> >> > Right?
>> >> Yes
>> >>
>> >> >
>> >> > I will check this and let you know.
>> >> >
>> >> Ok, thanks. By the way I'm planning to have this code reused for
>> >> handling more involved FIQL queries, ex, one can do
>> >>
>> >> /books?_s=id=gt=1
>> >>
>> >> "Find all books with id greater than 1"
>> >>
>> >> but we can't express the same query if Book happens to have a nested
>> >> ID bean, etc:
>> >>
>> >> /books?_s=id=gt=id.1
>> >>
>> >> Cheers, Sergey
>> >>
>> >> > Biju B
>> >> >
>> >> > On Thu, May 12, 2011 at 10:52 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com
>> >> >wrote:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> On Thu, May 12, 2011 at 5:55 PM, Biju Nair <bi...@gmail.com>
>> >> wrote:
>> >> >> > Yes I understood that we don't need two solution for same problem
>> :).
>> >> >> >
>> >> >> > Just want you let know, if you try to put something like
>> >> >> > "testaddress.City=Pleasanton&testAddress.stateName=CA"
>> >> >> > testAddress.stateName will not be populated. What I saw in your
>> code
>> >> is,
>> >> >> for
>> >> >> > first parameter the TestAddress instance is created and put into
>> map
>> >> as
>> >> >> > testaddress=<object> and in second parameter new TestAddress object
>> is
>> >> >> > creates and put into map as testAddress=<object>.
>> >> >> >
>> >> >> > Code Says ==> parsedValues.put(beanKey, value);
>> >> >> >
>> >> >> I see, I checked the actual property name, such as "set+ 'stateName'"
>> >> >> is checked against available methods (and I guess fields) in a
>> >> >> case-insensitive way...
>> >> >>
>> >> >> > Anyway thanks for the discussion.
>> >> >> >
>> >> >> cool, thanks for starting it up
>> >> >>
>> >> >> > Can you elaborate on "Maps are not supported for example" - Let me
>> see
>> >> >> > whether I can contribute?
>> >> >> >
>> >> >> Awhile back, a user asked about it but I recall I just did not get to
>> >> >> doing it, example
>> >> >>
>> >> >> user.params.k1=v1&params.k2=v2
>> >> >>
>> >> >> where a User bean has Map<String, String> property, which can be
>> handy
>> >> >> in some cases too.
>> >> >> have a look please if you get a chance
>> >> >>
>> >> >> Cheers, Sergey
>> >> >>
>> >> >> > Biju B
>> >> >> >
>> >> >> > On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <
>> >> sberyozkin@gmail.com
>> >> >> >wrote:
>> >> >> >
>> >> >> >> Hi
>> >> >> >>
>> >> >> >> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <
>> biju74techie@gmail.com>
>> >> >> wrote:
>> >> >> >> > Thanks for the reply.
>> >> >> >> >
>> >> >> >> > Just for clarification,
>> >> >> >> > If I have a Employee bean as follows,
>> >> >> >> > class Employee{
>> >> >> >> >    String name;
>> >> >> >> >    Address homeAddress;
>> >> >> >> >   //getters and setters are there
>> >> >> >> > }
>> >> >> >> >
>> >> >> >> > class Address{
>> >> >> >> >    String line1;
>> >> >> >> >   String line2;
>> >> >> >> >   //getters and setters are there
>> >> >> >> > }
>> >> >> >> > there is a rest service as String update(@FormParam("") Employee
>> >> >> >> employee)
>> >> >> >> >
>> >> >> >> > In the current approach, we need to pass request data as *
>> >> >> >> >
>> name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
>> >> >> >> >
>> >> >> >> > which means we need to have homeAddress as case sensitive right?
>> >> and
>> >> >> it
>> >> >> >> > won't work with "homeaddress.line1" right?
>> >> >> >>
>> >> >> >> No, the comparison is case-insensitive.
>> >> >> >>
>> >> >> >> > Also later if we try to change the variable names we need to ask
>> >> all
>> >> >> the
>> >> >> >> > clients to change the request params. Am I right or something
>> >> missing
>> >> >> >> here.
>> >> >> >> >
>> >> >> >>
>> >> >> >> I guess some care has to be taken with regard to refactoring the
>> bean
>> >> >> >> class which is meant to capture the input from
>> >> >> >> remote clients.
>> >> >> >>
>> >> >> >> If you have a User.setAddress() method which is meant to capture
>> an
>> >> an
>> >> >> >> 'address' property then yes, if you go ahead and remove it or
>> rename
>> >> >> >> it to setUserAddress then yes, "address" property won't be
>> injected -
>> >> >> >> but customers does not have to be affected in such cases -
>> replacing
>> >> >> >> the form submission payload can be easily done on the server side,
>> >> ex,
>> >> >> >> at the RequestFilter level or better yet, by providing a custom
>> >> >> >> MessageBodyReader which extends CXF FormEncodingProvider and
>> >> overrides
>> >> >> >> its populateMap method - let superclass to read the data and then
>> >> just
>> >> >> >> replace the key 'address' with say 'customerAddress'
>> >> >> >>
>> >> >> >> Look, as I tried to say in the previous email, it's basically not
>> >> >> >> about CXF solution is better then yours, etc :-). I just don't
>> think
>> >> >> >> we should have two solutions for this case 'shipped' with CXF. The
>> >> CXF
>> >> >> >> one may not be ideal but it has its benefits too, one of them is
>> that
>> >> >> >> WADLGenerator can understand such beans when generating query or
>> form
>> >> >> >> parameters, etc, the other one is that JAX-RS proxies understand
>> how
>> >> >> >> to deal with them, etc.
>> >> >> >>
>> >> >> >> I'd encourage you to help us to improve the existing solution if
>> you
>> >> >> >> find some drawbacks. Maps are not supported for example.
>> >> >> >>
>> >> >> >> Thanks, Sergey
>> >> >> >>
>> >> >> >> Cheers, Sergey
>> >> >> >>
>> >> >> >> > Please confirm.
>> >> >> >> >
>> >> >> >> > Biju B
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <
>> >> >> sberyozkin@gmail.com
>> >> >> >> >wrote:
>> >> >> >> >
>> >> >> >> >> Hi
>> >> >> >> >>
>> >> >> >> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <
>> >> biju74techie@gmail.com>
>> >> >> >> >> wrote:
>> >> >> >> >> > Thanks for the reply.
>> >> >> >> >> >
>> >> >> >> >> > But in the first approach the client users has to follow Java
>> >> >> naming
>> >> >> >> >> > conventions (espc a non-java client) right?
>> >> >> >> >> Clients use "user.name" or "user.address.value" if they need
>> to,
>> >> the
>> >> >> >> >> difference between the two approaches
>> >> >> >> >> in that with your annotations you can selectively point to a
>> >> >> >> >> particular field and say this is what "user.name" has to be
>> >> mapped
>> >> >> to,
>> >> >> >> >> while with the default approach one has to make sure nested
>> beans
>> >> are
>> >> >> >> >> available.
>> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> > Regarding the MultiValueMap, i like the idea, but not for
>> Bean
>> >> >> based.
>> >> >> >> >> Here
>> >> >> >> >> > the developers need to convert the map to Bean right?
>> >> >> >> >> >
>> >> >> >> >> > I still prefer to use *@FormParam("") object*, because this
>> >> looks
>> >> >> like
>> >> >> >> >> > standard in CXF for primitive type arguments.
>> >> >> >> *@FormParam("identifier")
>> >> >> >> >> id.*
>> >> >> >> >>
>> >> >> >> >> I like @FormParam("") too, it's a  CXF extension (using ""),
>> but
>> >> it
>> >> >> >> >> allows for capturing many values while still allowing for some
>> >> >> >> >> flexibility re property types  as opposed to using
>>  MultiValuedMap
>> >> >> >> >> (which is JAX-RS compliant).
>> >> >> >> >>
>> >> >> >> >> > **
>> >> >> >> >> > I think you can ask the same contributer to include the
>> >> annotation
>> >> >> >> >> approach
>> >> >> >> >> > or some custom way of declaring user-defined names, rather
>> than
>> >> >> java
>> >> >> >> >> > variables.
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> As I said the problem is how to have "user.a.b.c" mapped to a
>> >> >> >> >> particular property. CXF has one solution for it which I think
>> is
>> >> >> good
>> >> >> >> >> enough. Your solution is also interesting but I'm not sure CXF
>> >> should
>> >> >> >> >> multiple solutions for this particular issue
>> >> >> >> >>
>> >> >> >> >> Thanks, Sergey
>> >> >> >> >>  > Biju B
>> >> >> >> >> >
>> >> >> >> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
>> >> >> >> sberyozkin@gmail.com
>> >> >> >> >> >wrote:
>> >> >> >> >> >
>> >> >> >> >> >> Hi
>> >> >> >> >> >>
>> >> >> >> >> >> Please see comments inline
>> >> >> >> >> >>
>> >> >> >> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <
>> >> >> biju74techie@gmail.com>
>> >> >> >> >> wrote:
>> >> >> >> >> >> > Hi Team,
>> >> >> >> >> >> >
>> >> >> >> >> >> > Currently I was helping a team in building rest based
>> >> services
>> >> >> >> using
>> >> >> >> >> CXF.
>> >> >> >> >> >> I
>> >> >> >> >> >> > noticed that for bean based service arguments (*Ex. String
>> >> >> >> >> >> > getData(@FormParam("") TestObj tObj)*)
>> >> >> >> >> >> > you have to include @FormParam with empty qualifer name
>> and
>> >> the
>> >> >> >> >> request
>> >> >> >> >> >> > parameter should follow bean property naming conventions.
>> Say
>> >> >> >> example
>> >> >> >> >> >> > if TestObj has a property 'userName' (which is java style)
>> >> then
>> >> >> the
>> >> >> >> >> >> request
>> >> >> >> >> >> > parameter should be userName=Joe.
>> >> >> >> >> >> > But in our requirement (mostly everywhere) the request
>> >> >> parameters
>> >> >> >> need
>> >> >> >> >> >> not
>> >> >> >> >> >> > use the Java Style. Here we were asked to use 'user.name
>> '.
>> >> >> >> >> >> >
>> >> >> >> >> >> > I know for non-bean based parameters CXF supports this as
>> >> >> >> @FormParam("
>> >> >> >> >> >> > user.name") String userName, Is this possible for Bean
>> Based
>> >> >> also?
>> >> >> >> >> >> >
>> >> >> >> >> >> > As part of providing solution to team, I wrote a CXF
>> Request
>> >> >> >> Handler,
>> >> >> >> >> >> > which transforms all the request based parmeters to bean
>> >> based.
>> >> >> >> >> >> > Now the TestObj will looks like,
>> >> >> >> >> >> > class TestObject {
>> >> >> >> >> >> >       @RequestParam("user.name")
>> >> >> >> >> >> >       String userName;
>> >> >> >> >> >> > ...
>> >> >> >> >> >> > }
>> >> >> >> >> >> > Using the @ReuestParam I will be identifying the actual
>> >> request
>> >> >> >> param.
>> >> >> >> >> >> > The component I wrote supports primitives, nested beans
>> and
>> >> >> >> >> collections
>> >> >> >> >> >> > also.
>> >> >> >> >> >> >
>> >> >> >> >> >> That is interesting, however I think your requirement can
>> >> already
>> >> >> be
>> >> >> >> >> >> handled:
>> >> >> >> >> >>
>> >> >> >> >> >> public class TestObject {
>> >> >> >> >> >>    public User getUser() {
>> >> >> >> >> >>         return new User();
>> >> >> >> >> >>    }
>> >> >> >> >> >>    public void setUser(User user) {}
>> >> >> >> >> >> }
>> >> >> >> >> >>
>> >> >> >> >> >> public class User {
>> >> >> >> >> >>    public String getName() {
>> >> >> >> >> >>         return name;
>> >> >> >> >> >>    }
>> >> >> >> >> >>    public void setName(String name) {}
>> >> >> >> >> >> }
>> >> >> >> >> >>
>> >> >> >> >> >> That is more verbose that your solution but the user who
>> >> >> contributed
>> >> >> >> >> >> the patch earlier on did a lot of work for nested beans to
>> >> work,
>> >> >> with
>> >> >> >> >> >> collections supported as well. And no extra annotations is
>> >> >> required.
>> >> >> >> >> >>
>> >> >> >> >> >> Another option is just use MultivaluedMap in case of form
>> >> >> submissions
>> >> >> >> >> >> or explicit FormParam("user.name")
>> >> >> >> >> >>
>> >> >> >> >> >> What do you think ?
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> Cheers, Sergey
>> >> >> >> >> >>
>> >> >> >> >> >> > *My Suggestion is can you include this feature in next
>> >> version
>> >> >> of
>> >> >> >> CXF?
>> >> >> >> >> >> and
>> >> >> >> >> >>  > Can I contribute my code?*
>> >> >> >> >> >> >
>> >> >> >> >> >> > Biju B
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> Sergey Beryozkin
>> >> >> >> >> >>
>> >> >> >> >> >> Application Integration Division of Talend
>> >> >> >> >> >> http://sberyozkin.blogspot.com
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >>  Sergey Beryozkin
>> >> >> >> >>
>> >> >> >> >> Application Integration Division of Talend
>> >> >> >> >> http://sberyozkin.blogspot.com
>> >> >> >> >>
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >>  Sergey Beryozkin
>> >> >> >>
>> >> >> >> Application Integration Division of Talend
>> >> >> >> http://sberyozkin.blogspot.com
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>  Sergey Beryozkin
>> >> >>
>> >> >> Application Integration Division of Talend
>> >> >> http://sberyozkin.blogspot.com
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
i don't see the SVN branch.

I am trying to change in http://svn.apache.org/repos/asf/cxf/trunk - is that
ok? If not can you sen me the SVN link?

On Fri, May 13, 2011 at 1:48 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> 2.4.1-SNAPSHOT is the trunk version - so please check it out if you
> decide to work on a pacth, I'll then backmerge it to
> 2.3.5-SNAPSHOT
>
> Cheers, Sergey
>
> On Thu, May 12, 2011 at 9:51 PM, Biju Nair <bi...@gmail.com> wrote:
> > Which version of CXF you are working on?
> >
> > I was working with 2.3.1.
> >
> > On Thu, May 12, 2011 at 1:08 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Hi
> >>
> >> On Thu, May 12, 2011 at 8:21 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > Just to clarify,
> >> >
> >> > the user bean will be something like,
> >> > class User{
> >> >   Map<String, String> params;
> >> > }
> >> >
> >> > Request Data will be user.params.k1=v1&*user.*params.k2=v2
> >>
> >> Yes if User is a nested bean, otherwise just
> >> params.k1=v1&params.k2=v2
> >>
> >> if we have FormParam("") User
> >>
> >> >
> >> > Finally, the params map will have [{k1=v1},{k2=v2}]
> >> >
> >> > Right?
> >> Yes
> >>
> >> >
> >> > I will check this and let you know.
> >> >
> >> Ok, thanks. By the way I'm planning to have this code reused for
> >> handling more involved FIQL queries, ex, one can do
> >>
> >> /books?_s=id=gt=1
> >>
> >> "Find all books with id greater than 1"
> >>
> >> but we can't express the same query if Book happens to have a nested
> >> ID bean, etc:
> >>
> >> /books?_s=id=gt=id.1
> >>
> >> Cheers, Sergey
> >>
> >> > Biju B
> >> >
> >> > On Thu, May 12, 2011 at 10:52 AM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >> >wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> On Thu, May 12, 2011 at 5:55 PM, Biju Nair <bi...@gmail.com>
> >> wrote:
> >> >> > Yes I understood that we don't need two solution for same problem
> :).
> >> >> >
> >> >> > Just want you let know, if you try to put something like
> >> >> > "testaddress.City=Pleasanton&testAddress.stateName=CA"
> >> >> > testAddress.stateName will not be populated. What I saw in your
> code
> >> is,
> >> >> for
> >> >> > first parameter the TestAddress instance is created and put into
> map
> >> as
> >> >> > testaddress=<object> and in second parameter new TestAddress object
> is
> >> >> > creates and put into map as testAddress=<object>.
> >> >> >
> >> >> > Code Says ==> parsedValues.put(beanKey, value);
> >> >> >
> >> >> I see, I checked the actual property name, such as "set+ 'stateName'"
> >> >> is checked against available methods (and I guess fields) in a
> >> >> case-insensitive way...
> >> >>
> >> >> > Anyway thanks for the discussion.
> >> >> >
> >> >> cool, thanks for starting it up
> >> >>
> >> >> > Can you elaborate on "Maps are not supported for example" - Let me
> see
> >> >> > whether I can contribute?
> >> >> >
> >> >> Awhile back, a user asked about it but I recall I just did not get to
> >> >> doing it, example
> >> >>
> >> >> user.params.k1=v1&params.k2=v2
> >> >>
> >> >> where a User bean has Map<String, String> property, which can be
> handy
> >> >> in some cases too.
> >> >> have a look please if you get a chance
> >> >>
> >> >> Cheers, Sergey
> >> >>
> >> >> > Biju B
> >> >> >
> >> >> > On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <
> >> sberyozkin@gmail.com
> >> >> >wrote:
> >> >> >
> >> >> >> Hi
> >> >> >>
> >> >> >> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <
> biju74techie@gmail.com>
> >> >> wrote:
> >> >> >> > Thanks for the reply.
> >> >> >> >
> >> >> >> > Just for clarification,
> >> >> >> > If I have a Employee bean as follows,
> >> >> >> > class Employee{
> >> >> >> >    String name;
> >> >> >> >    Address homeAddress;
> >> >> >> >   //getters and setters are there
> >> >> >> > }
> >> >> >> >
> >> >> >> > class Address{
> >> >> >> >    String line1;
> >> >> >> >   String line2;
> >> >> >> >   //getters and setters are there
> >> >> >> > }
> >> >> >> > there is a rest service as String update(@FormParam("") Employee
> >> >> >> employee)
> >> >> >> >
> >> >> >> > In the current approach, we need to pass request data as *
> >> >> >> >
> name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
> >> >> >> >
> >> >> >> > which means we need to have homeAddress as case sensitive right?
> >> and
> >> >> it
> >> >> >> > won't work with "homeaddress.line1" right?
> >> >> >>
> >> >> >> No, the comparison is case-insensitive.
> >> >> >>
> >> >> >> > Also later if we try to change the variable names we need to ask
> >> all
> >> >> the
> >> >> >> > clients to change the request params. Am I right or something
> >> missing
> >> >> >> here.
> >> >> >> >
> >> >> >>
> >> >> >> I guess some care has to be taken with regard to refactoring the
> bean
> >> >> >> class which is meant to capture the input from
> >> >> >> remote clients.
> >> >> >>
> >> >> >> If you have a User.setAddress() method which is meant to capture
> an
> >> an
> >> >> >> 'address' property then yes, if you go ahead and remove it or
> rename
> >> >> >> it to setUserAddress then yes, "address" property won't be
> injected -
> >> >> >> but customers does not have to be affected in such cases -
> replacing
> >> >> >> the form submission payload can be easily done on the server side,
> >> ex,
> >> >> >> at the RequestFilter level or better yet, by providing a custom
> >> >> >> MessageBodyReader which extends CXF FormEncodingProvider and
> >> overrides
> >> >> >> its populateMap method - let superclass to read the data and then
> >> just
> >> >> >> replace the key 'address' with say 'customerAddress'
> >> >> >>
> >> >> >> Look, as I tried to say in the previous email, it's basically not
> >> >> >> about CXF solution is better then yours, etc :-). I just don't
> think
> >> >> >> we should have two solutions for this case 'shipped' with CXF. The
> >> CXF
> >> >> >> one may not be ideal but it has its benefits too, one of them is
> that
> >> >> >> WADLGenerator can understand such beans when generating query or
> form
> >> >> >> parameters, etc, the other one is that JAX-RS proxies understand
> how
> >> >> >> to deal with them, etc.
> >> >> >>
> >> >> >> I'd encourage you to help us to improve the existing solution if
> you
> >> >> >> find some drawbacks. Maps are not supported for example.
> >> >> >>
> >> >> >> Thanks, Sergey
> >> >> >>
> >> >> >> Cheers, Sergey
> >> >> >>
> >> >> >> > Please confirm.
> >> >> >> >
> >> >> >> > Biju B
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <
> >> >> sberyozkin@gmail.com
> >> >> >> >wrote:
> >> >> >> >
> >> >> >> >> Hi
> >> >> >> >>
> >> >> >> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <
> >> biju74techie@gmail.com>
> >> >> >> >> wrote:
> >> >> >> >> > Thanks for the reply.
> >> >> >> >> >
> >> >> >> >> > But in the first approach the client users has to follow Java
> >> >> naming
> >> >> >> >> > conventions (espc a non-java client) right?
> >> >> >> >> Clients use "user.name" or "user.address.value" if they need
> to,
> >> the
> >> >> >> >> difference between the two approaches
> >> >> >> >> in that with your annotations you can selectively point to a
> >> >> >> >> particular field and say this is what "user.name" has to be
> >> mapped
> >> >> to,
> >> >> >> >> while with the default approach one has to make sure nested
> beans
> >> are
> >> >> >> >> available.
> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> > Regarding the MultiValueMap, i like the idea, but not for
> Bean
> >> >> based.
> >> >> >> >> Here
> >> >> >> >> > the developers need to convert the map to Bean right?
> >> >> >> >> >
> >> >> >> >> > I still prefer to use *@FormParam("") object*, because this
> >> looks
> >> >> like
> >> >> >> >> > standard in CXF for primitive type arguments.
> >> >> >> *@FormParam("identifier")
> >> >> >> >> id.*
> >> >> >> >>
> >> >> >> >> I like @FormParam("") too, it's a  CXF extension (using ""),
> but
> >> it
> >> >> >> >> allows for capturing many values while still allowing for some
> >> >> >> >> flexibility re property types  as opposed to using
>  MultiValuedMap
> >> >> >> >> (which is JAX-RS compliant).
> >> >> >> >>
> >> >> >> >> > **
> >> >> >> >> > I think you can ask the same contributer to include the
> >> annotation
> >> >> >> >> approach
> >> >> >> >> > or some custom way of declaring user-defined names, rather
> than
> >> >> java
> >> >> >> >> > variables.
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> As I said the problem is how to have "user.a.b.c" mapped to a
> >> >> >> >> particular property. CXF has one solution for it which I think
> is
> >> >> good
> >> >> >> >> enough. Your solution is also interesting but I'm not sure CXF
> >> should
> >> >> >> >> multiple solutions for this particular issue
> >> >> >> >>
> >> >> >> >> Thanks, Sergey
> >> >> >> >>  > Biju B
> >> >> >> >> >
> >> >> >> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
> >> >> >> sberyozkin@gmail.com
> >> >> >> >> >wrote:
> >> >> >> >> >
> >> >> >> >> >> Hi
> >> >> >> >> >>
> >> >> >> >> >> Please see comments inline
> >> >> >> >> >>
> >> >> >> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <
> >> >> biju74techie@gmail.com>
> >> >> >> >> wrote:
> >> >> >> >> >> > Hi Team,
> >> >> >> >> >> >
> >> >> >> >> >> > Currently I was helping a team in building rest based
> >> services
> >> >> >> using
> >> >> >> >> CXF.
> >> >> >> >> >> I
> >> >> >> >> >> > noticed that for bean based service arguments (*Ex. String
> >> >> >> >> >> > getData(@FormParam("") TestObj tObj)*)
> >> >> >> >> >> > you have to include @FormParam with empty qualifer name
> and
> >> the
> >> >> >> >> request
> >> >> >> >> >> > parameter should follow bean property naming conventions.
> Say
> >> >> >> example
> >> >> >> >> >> > if TestObj has a property 'userName' (which is java style)
> >> then
> >> >> the
> >> >> >> >> >> request
> >> >> >> >> >> > parameter should be userName=Joe.
> >> >> >> >> >> > But in our requirement (mostly everywhere) the request
> >> >> parameters
> >> >> >> need
> >> >> >> >> >> not
> >> >> >> >> >> > use the Java Style. Here we were asked to use 'user.name
> '.
> >> >> >> >> >> >
> >> >> >> >> >> > I know for non-bean based parameters CXF supports this as
> >> >> >> @FormParam("
> >> >> >> >> >> > user.name") String userName, Is this possible for Bean
> Based
> >> >> also?
> >> >> >> >> >> >
> >> >> >> >> >> > As part of providing solution to team, I wrote a CXF
> Request
> >> >> >> Handler,
> >> >> >> >> >> > which transforms all the request based parmeters to bean
> >> based.
> >> >> >> >> >> > Now the TestObj will looks like,
> >> >> >> >> >> > class TestObject {
> >> >> >> >> >> >       @RequestParam("user.name")
> >> >> >> >> >> >       String userName;
> >> >> >> >> >> > ...
> >> >> >> >> >> > }
> >> >> >> >> >> > Using the @ReuestParam I will be identifying the actual
> >> request
> >> >> >> param.
> >> >> >> >> >> > The component I wrote supports primitives, nested beans
> and
> >> >> >> >> collections
> >> >> >> >> >> > also.
> >> >> >> >> >> >
> >> >> >> >> >> That is interesting, however I think your requirement can
> >> already
> >> >> be
> >> >> >> >> >> handled:
> >> >> >> >> >>
> >> >> >> >> >> public class TestObject {
> >> >> >> >> >>    public User getUser() {
> >> >> >> >> >>         return new User();
> >> >> >> >> >>    }
> >> >> >> >> >>    public void setUser(User user) {}
> >> >> >> >> >> }
> >> >> >> >> >>
> >> >> >> >> >> public class User {
> >> >> >> >> >>    public String getName() {
> >> >> >> >> >>         return name;
> >> >> >> >> >>    }
> >> >> >> >> >>    public void setName(String name) {}
> >> >> >> >> >> }
> >> >> >> >> >>
> >> >> >> >> >> That is more verbose that your solution but the user who
> >> >> contributed
> >> >> >> >> >> the patch earlier on did a lot of work for nested beans to
> >> work,
> >> >> with
> >> >> >> >> >> collections supported as well. And no extra annotations is
> >> >> required.
> >> >> >> >> >>
> >> >> >> >> >> Another option is just use MultivaluedMap in case of form
> >> >> submissions
> >> >> >> >> >> or explicit FormParam("user.name")
> >> >> >> >> >>
> >> >> >> >> >> What do you think ?
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> Cheers, Sergey
> >> >> >> >> >>
> >> >> >> >> >> > *My Suggestion is can you include this feature in next
> >> version
> >> >> of
> >> >> >> CXF?
> >> >> >> >> >> and
> >> >> >> >> >>  > Can I contribute my code?*
> >> >> >> >> >> >
> >> >> >> >> >> > Biju B
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> Sergey Beryozkin
> >> >> >> >> >>
> >> >> >> >> >> Application Integration Division of Talend
> >> >> >> >> >> http://sberyozkin.blogspot.com
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >>  Sergey Beryozkin
> >> >> >> >>
> >> >> >> >> Application Integration Division of Talend
> >> >> >> >> http://sberyozkin.blogspot.com
> >> >> >> >>
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >>  Sergey Beryozkin
> >> >> >>
> >> >> >> Application Integration Division of Talend
> >> >> >> http://sberyozkin.blogspot.com
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>  Sergey Beryozkin
> >> >>
> >> >> Application Integration Division of Talend
> >> >> http://sberyozkin.blogspot.com
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Sergey Beryozkin <sb...@gmail.com>.
2.4.1-SNAPSHOT is the trunk version - so please check it out if you
decide to work on a pacth, I'll then backmerge it to
2.3.5-SNAPSHOT

Cheers, Sergey

On Thu, May 12, 2011 at 9:51 PM, Biju Nair <bi...@gmail.com> wrote:
> Which version of CXF you are working on?
>
> I was working with 2.3.1.
>
> On Thu, May 12, 2011 at 1:08 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> On Thu, May 12, 2011 at 8:21 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Just to clarify,
>> >
>> > the user bean will be something like,
>> > class User{
>> >   Map<String, String> params;
>> > }
>> >
>> > Request Data will be user.params.k1=v1&*user.*params.k2=v2
>>
>> Yes if User is a nested bean, otherwise just
>> params.k1=v1&params.k2=v2
>>
>> if we have FormParam("") User
>>
>> >
>> > Finally, the params map will have [{k1=v1},{k2=v2}]
>> >
>> > Right?
>> Yes
>>
>> >
>> > I will check this and let you know.
>> >
>> Ok, thanks. By the way I'm planning to have this code reused for
>> handling more involved FIQL queries, ex, one can do
>>
>> /books?_s=id=gt=1
>>
>> "Find all books with id greater than 1"
>>
>> but we can't express the same query if Book happens to have a nested
>> ID bean, etc:
>>
>> /books?_s=id=gt=id.1
>>
>> Cheers, Sergey
>>
>> > Biju B
>> >
>> > On Thu, May 12, 2011 at 10:52 AM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Hi
>> >>
>> >> On Thu, May 12, 2011 at 5:55 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > Yes I understood that we don't need two solution for same problem :).
>> >> >
>> >> > Just want you let know, if you try to put something like
>> >> > "testaddress.City=Pleasanton&testAddress.stateName=CA"
>> >> > testAddress.stateName will not be populated. What I saw in your code
>> is,
>> >> for
>> >> > first parameter the TestAddress instance is created and put into map
>> as
>> >> > testaddress=<object> and in second parameter new TestAddress object is
>> >> > creates and put into map as testAddress=<object>.
>> >> >
>> >> > Code Says ==> parsedValues.put(beanKey, value);
>> >> >
>> >> I see, I checked the actual property name, such as "set+ 'stateName'"
>> >> is checked against available methods (and I guess fields) in a
>> >> case-insensitive way...
>> >>
>> >> > Anyway thanks for the discussion.
>> >> >
>> >> cool, thanks for starting it up
>> >>
>> >> > Can you elaborate on "Maps are not supported for example" - Let me see
>> >> > whether I can contribute?
>> >> >
>> >> Awhile back, a user asked about it but I recall I just did not get to
>> >> doing it, example
>> >>
>> >> user.params.k1=v1&params.k2=v2
>> >>
>> >> where a User bean has Map<String, String> property, which can be handy
>> >> in some cases too.
>> >> have a look please if you get a chance
>> >>
>> >> Cheers, Sergey
>> >>
>> >> > Biju B
>> >> >
>> >> > On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com
>> >> >wrote:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <bi...@gmail.com>
>> >> wrote:
>> >> >> > Thanks for the reply.
>> >> >> >
>> >> >> > Just for clarification,
>> >> >> > If I have a Employee bean as follows,
>> >> >> > class Employee{
>> >> >> >    String name;
>> >> >> >    Address homeAddress;
>> >> >> >   //getters and setters are there
>> >> >> > }
>> >> >> >
>> >> >> > class Address{
>> >> >> >    String line1;
>> >> >> >   String line2;
>> >> >> >   //getters and setters are there
>> >> >> > }
>> >> >> > there is a rest service as String update(@FormParam("") Employee
>> >> >> employee)
>> >> >> >
>> >> >> > In the current approach, we need to pass request data as *
>> >> >> > name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
>> >> >> >
>> >> >> > which means we need to have homeAddress as case sensitive right?
>> and
>> >> it
>> >> >> > won't work with "homeaddress.line1" right?
>> >> >>
>> >> >> No, the comparison is case-insensitive.
>> >> >>
>> >> >> > Also later if we try to change the variable names we need to ask
>> all
>> >> the
>> >> >> > clients to change the request params. Am I right or something
>> missing
>> >> >> here.
>> >> >> >
>> >> >>
>> >> >> I guess some care has to be taken with regard to refactoring the bean
>> >> >> class which is meant to capture the input from
>> >> >> remote clients.
>> >> >>
>> >> >> If you have a User.setAddress() method which is meant to capture an
>> an
>> >> >> 'address' property then yes, if you go ahead and remove it or rename
>> >> >> it to setUserAddress then yes, "address" property won't be injected -
>> >> >> but customers does not have to be affected in such cases - replacing
>> >> >> the form submission payload can be easily done on the server side,
>> ex,
>> >> >> at the RequestFilter level or better yet, by providing a custom
>> >> >> MessageBodyReader which extends CXF FormEncodingProvider and
>> overrides
>> >> >> its populateMap method - let superclass to read the data and then
>> just
>> >> >> replace the key 'address' with say 'customerAddress'
>> >> >>
>> >> >> Look, as I tried to say in the previous email, it's basically not
>> >> >> about CXF solution is better then yours, etc :-). I just don't think
>> >> >> we should have two solutions for this case 'shipped' with CXF. The
>> CXF
>> >> >> one may not be ideal but it has its benefits too, one of them is that
>> >> >> WADLGenerator can understand such beans when generating query or form
>> >> >> parameters, etc, the other one is that JAX-RS proxies understand how
>> >> >> to deal with them, etc.
>> >> >>
>> >> >> I'd encourage you to help us to improve the existing solution if you
>> >> >> find some drawbacks. Maps are not supported for example.
>> >> >>
>> >> >> Thanks, Sergey
>> >> >>
>> >> >> Cheers, Sergey
>> >> >>
>> >> >> > Please confirm.
>> >> >> >
>> >> >> > Biju B
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <
>> >> sberyozkin@gmail.com
>> >> >> >wrote:
>> >> >> >
>> >> >> >> Hi
>> >> >> >>
>> >> >> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <
>> biju74techie@gmail.com>
>> >> >> >> wrote:
>> >> >> >> > Thanks for the reply.
>> >> >> >> >
>> >> >> >> > But in the first approach the client users has to follow Java
>> >> naming
>> >> >> >> > conventions (espc a non-java client) right?
>> >> >> >> Clients use "user.name" or "user.address.value" if they need to,
>> the
>> >> >> >> difference between the two approaches
>> >> >> >> in that with your annotations you can selectively point to a
>> >> >> >> particular field and say this is what "user.name" has to be
>> mapped
>> >> to,
>> >> >> >> while with the default approach one has to make sure nested beans
>> are
>> >> >> >> available.
>> >> >> >>
>> >> >> >> >
>> >> >> >> > Regarding the MultiValueMap, i like the idea, but not for Bean
>> >> based.
>> >> >> >> Here
>> >> >> >> > the developers need to convert the map to Bean right?
>> >> >> >> >
>> >> >> >> > I still prefer to use *@FormParam("") object*, because this
>> looks
>> >> like
>> >> >> >> > standard in CXF for primitive type arguments.
>> >> >> *@FormParam("identifier")
>> >> >> >> id.*
>> >> >> >>
>> >> >> >> I like @FormParam("") too, it's a  CXF extension (using ""), but
>> it
>> >> >> >> allows for capturing many values while still allowing for some
>> >> >> >> flexibility re property types  as opposed to using  MultiValuedMap
>> >> >> >> (which is JAX-RS compliant).
>> >> >> >>
>> >> >> >> > **
>> >> >> >> > I think you can ask the same contributer to include the
>> annotation
>> >> >> >> approach
>> >> >> >> > or some custom way of declaring user-defined names, rather than
>> >> java
>> >> >> >> > variables.
>> >> >> >> >
>> >> >> >>
>> >> >> >> As I said the problem is how to have "user.a.b.c" mapped to a
>> >> >> >> particular property. CXF has one solution for it which I think is
>> >> good
>> >> >> >> enough. Your solution is also interesting but I'm not sure CXF
>> should
>> >> >> >> multiple solutions for this particular issue
>> >> >> >>
>> >> >> >> Thanks, Sergey
>> >> >> >>  > Biju B
>> >> >> >> >
>> >> >> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
>> >> >> sberyozkin@gmail.com
>> >> >> >> >wrote:
>> >> >> >> >
>> >> >> >> >> Hi
>> >> >> >> >>
>> >> >> >> >> Please see comments inline
>> >> >> >> >>
>> >> >> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <
>> >> biju74techie@gmail.com>
>> >> >> >> wrote:
>> >> >> >> >> > Hi Team,
>> >> >> >> >> >
>> >> >> >> >> > Currently I was helping a team in building rest based
>> services
>> >> >> using
>> >> >> >> CXF.
>> >> >> >> >> I
>> >> >> >> >> > noticed that for bean based service arguments (*Ex. String
>> >> >> >> >> > getData(@FormParam("") TestObj tObj)*)
>> >> >> >> >> > you have to include @FormParam with empty qualifer name and
>> the
>> >> >> >> request
>> >> >> >> >> > parameter should follow bean property naming conventions. Say
>> >> >> example
>> >> >> >> >> > if TestObj has a property 'userName' (which is java style)
>> then
>> >> the
>> >> >> >> >> request
>> >> >> >> >> > parameter should be userName=Joe.
>> >> >> >> >> > But in our requirement (mostly everywhere) the request
>> >> parameters
>> >> >> need
>> >> >> >> >> not
>> >> >> >> >> > use the Java Style. Here we were asked to use 'user.name'.
>> >> >> >> >> >
>> >> >> >> >> > I know for non-bean based parameters CXF supports this as
>> >> >> @FormParam("
>> >> >> >> >> > user.name") String userName, Is this possible for Bean Based
>> >> also?
>> >> >> >> >> >
>> >> >> >> >> > As part of providing solution to team, I wrote a CXF Request
>> >> >> Handler,
>> >> >> >> >> > which transforms all the request based parmeters to bean
>> based.
>> >> >> >> >> > Now the TestObj will looks like,
>> >> >> >> >> > class TestObject {
>> >> >> >> >> >       @RequestParam("user.name")
>> >> >> >> >> >       String userName;
>> >> >> >> >> > ...
>> >> >> >> >> > }
>> >> >> >> >> > Using the @ReuestParam I will be identifying the actual
>> request
>> >> >> param.
>> >> >> >> >> > The component I wrote supports primitives, nested beans and
>> >> >> >> collections
>> >> >> >> >> > also.
>> >> >> >> >> >
>> >> >> >> >> That is interesting, however I think your requirement can
>> already
>> >> be
>> >> >> >> >> handled:
>> >> >> >> >>
>> >> >> >> >> public class TestObject {
>> >> >> >> >>    public User getUser() {
>> >> >> >> >>         return new User();
>> >> >> >> >>    }
>> >> >> >> >>    public void setUser(User user) {}
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> public class User {
>> >> >> >> >>    public String getName() {
>> >> >> >> >>         return name;
>> >> >> >> >>    }
>> >> >> >> >>    public void setName(String name) {}
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> That is more verbose that your solution but the user who
>> >> contributed
>> >> >> >> >> the patch earlier on did a lot of work for nested beans to
>> work,
>> >> with
>> >> >> >> >> collections supported as well. And no extra annotations is
>> >> required.
>> >> >> >> >>
>> >> >> >> >> Another option is just use MultivaluedMap in case of form
>> >> submissions
>> >> >> >> >> or explicit FormParam("user.name")
>> >> >> >> >>
>> >> >> >> >> What do you think ?
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> Cheers, Sergey
>> >> >> >> >>
>> >> >> >> >> > *My Suggestion is can you include this feature in next
>> version
>> >> of
>> >> >> CXF?
>> >> >> >> >> and
>> >> >> >> >>  > Can I contribute my code?*
>> >> >> >> >> >
>> >> >> >> >> > Biju B
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> Sergey Beryozkin
>> >> >> >> >>
>> >> >> >> >> Application Integration Division of Talend
>> >> >> >> >> http://sberyozkin.blogspot.com
>> >> >> >> >>
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >>  Sergey Beryozkin
>> >> >> >>
>> >> >> >> Application Integration Division of Talend
>> >> >> >> http://sberyozkin.blogspot.com
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>  Sergey Beryozkin
>> >> >>
>> >> >> Application Integration Division of Talend
>> >> >> http://sberyozkin.blogspot.com
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Which version of CXF you are working on?

I was working with 2.3.1.

On Thu, May 12, 2011 at 1:08 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On Thu, May 12, 2011 at 8:21 PM, Biju Nair <bi...@gmail.com> wrote:
> > Just to clarify,
> >
> > the user bean will be something like,
> > class User{
> >   Map<String, String> params;
> > }
> >
> > Request Data will be user.params.k1=v1&*user.*params.k2=v2
>
> Yes if User is a nested bean, otherwise just
> params.k1=v1&params.k2=v2
>
> if we have FormParam("") User
>
> >
> > Finally, the params map will have [{k1=v1},{k2=v2}]
> >
> > Right?
> Yes
>
> >
> > I will check this and let you know.
> >
> Ok, thanks. By the way I'm planning to have this code reused for
> handling more involved FIQL queries, ex, one can do
>
> /books?_s=id=gt=1
>
> "Find all books with id greater than 1"
>
> but we can't express the same query if Book happens to have a nested
> ID bean, etc:
>
> /books?_s=id=gt=id.1
>
> Cheers, Sergey
>
> > Biju B
> >
> > On Thu, May 12, 2011 at 10:52 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Hi
> >>
> >> On Thu, May 12, 2011 at 5:55 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > Yes I understood that we don't need two solution for same problem :).
> >> >
> >> > Just want you let know, if you try to put something like
> >> > "testaddress.City=Pleasanton&testAddress.stateName=CA"
> >> > testAddress.stateName will not be populated. What I saw in your code
> is,
> >> for
> >> > first parameter the TestAddress instance is created and put into map
> as
> >> > testaddress=<object> and in second parameter new TestAddress object is
> >> > creates and put into map as testAddress=<object>.
> >> >
> >> > Code Says ==> parsedValues.put(beanKey, value);
> >> >
> >> I see, I checked the actual property name, such as "set+ 'stateName'"
> >> is checked against available methods (and I guess fields) in a
> >> case-insensitive way...
> >>
> >> > Anyway thanks for the discussion.
> >> >
> >> cool, thanks for starting it up
> >>
> >> > Can you elaborate on "Maps are not supported for example" - Let me see
> >> > whether I can contribute?
> >> >
> >> Awhile back, a user asked about it but I recall I just did not get to
> >> doing it, example
> >>
> >> user.params.k1=v1&params.k2=v2
> >>
> >> where a User bean has Map<String, String> property, which can be handy
> >> in some cases too.
> >> have a look please if you get a chance
> >>
> >> Cheers, Sergey
> >>
> >> > Biju B
> >> >
> >> > On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >> >wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <bi...@gmail.com>
> >> wrote:
> >> >> > Thanks for the reply.
> >> >> >
> >> >> > Just for clarification,
> >> >> > If I have a Employee bean as follows,
> >> >> > class Employee{
> >> >> >    String name;
> >> >> >    Address homeAddress;
> >> >> >   //getters and setters are there
> >> >> > }
> >> >> >
> >> >> > class Address{
> >> >> >    String line1;
> >> >> >   String line2;
> >> >> >   //getters and setters are there
> >> >> > }
> >> >> > there is a rest service as String update(@FormParam("") Employee
> >> >> employee)
> >> >> >
> >> >> > In the current approach, we need to pass request data as *
> >> >> > name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
> >> >> >
> >> >> > which means we need to have homeAddress as case sensitive right?
> and
> >> it
> >> >> > won't work with "homeaddress.line1" right?
> >> >>
> >> >> No, the comparison is case-insensitive.
> >> >>
> >> >> > Also later if we try to change the variable names we need to ask
> all
> >> the
> >> >> > clients to change the request params. Am I right or something
> missing
> >> >> here.
> >> >> >
> >> >>
> >> >> I guess some care has to be taken with regard to refactoring the bean
> >> >> class which is meant to capture the input from
> >> >> remote clients.
> >> >>
> >> >> If you have a User.setAddress() method which is meant to capture an
> an
> >> >> 'address' property then yes, if you go ahead and remove it or rename
> >> >> it to setUserAddress then yes, "address" property won't be injected -
> >> >> but customers does not have to be affected in such cases - replacing
> >> >> the form submission payload can be easily done on the server side,
> ex,
> >> >> at the RequestFilter level or better yet, by providing a custom
> >> >> MessageBodyReader which extends CXF FormEncodingProvider and
> overrides
> >> >> its populateMap method - let superclass to read the data and then
> just
> >> >> replace the key 'address' with say 'customerAddress'
> >> >>
> >> >> Look, as I tried to say in the previous email, it's basically not
> >> >> about CXF solution is better then yours, etc :-). I just don't think
> >> >> we should have two solutions for this case 'shipped' with CXF. The
> CXF
> >> >> one may not be ideal but it has its benefits too, one of them is that
> >> >> WADLGenerator can understand such beans when generating query or form
> >> >> parameters, etc, the other one is that JAX-RS proxies understand how
> >> >> to deal with them, etc.
> >> >>
> >> >> I'd encourage you to help us to improve the existing solution if you
> >> >> find some drawbacks. Maps are not supported for example.
> >> >>
> >> >> Thanks, Sergey
> >> >>
> >> >> Cheers, Sergey
> >> >>
> >> >> > Please confirm.
> >> >> >
> >> >> > Biju B
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <
> >> sberyozkin@gmail.com
> >> >> >wrote:
> >> >> >
> >> >> >> Hi
> >> >> >>
> >> >> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <
> biju74techie@gmail.com>
> >> >> >> wrote:
> >> >> >> > Thanks for the reply.
> >> >> >> >
> >> >> >> > But in the first approach the client users has to follow Java
> >> naming
> >> >> >> > conventions (espc a non-java client) right?
> >> >> >> Clients use "user.name" or "user.address.value" if they need to,
> the
> >> >> >> difference between the two approaches
> >> >> >> in that with your annotations you can selectively point to a
> >> >> >> particular field and say this is what "user.name" has to be
> mapped
> >> to,
> >> >> >> while with the default approach one has to make sure nested beans
> are
> >> >> >> available.
> >> >> >>
> >> >> >> >
> >> >> >> > Regarding the MultiValueMap, i like the idea, but not for Bean
> >> based.
> >> >> >> Here
> >> >> >> > the developers need to convert the map to Bean right?
> >> >> >> >
> >> >> >> > I still prefer to use *@FormParam("") object*, because this
> looks
> >> like
> >> >> >> > standard in CXF for primitive type arguments.
> >> >> *@FormParam("identifier")
> >> >> >> id.*
> >> >> >>
> >> >> >> I like @FormParam("") too, it's a  CXF extension (using ""), but
> it
> >> >> >> allows for capturing many values while still allowing for some
> >> >> >> flexibility re property types  as opposed to using  MultiValuedMap
> >> >> >> (which is JAX-RS compliant).
> >> >> >>
> >> >> >> > **
> >> >> >> > I think you can ask the same contributer to include the
> annotation
> >> >> >> approach
> >> >> >> > or some custom way of declaring user-defined names, rather than
> >> java
> >> >> >> > variables.
> >> >> >> >
> >> >> >>
> >> >> >> As I said the problem is how to have "user.a.b.c" mapped to a
> >> >> >> particular property. CXF has one solution for it which I think is
> >> good
> >> >> >> enough. Your solution is also interesting but I'm not sure CXF
> should
> >> >> >> multiple solutions for this particular issue
> >> >> >>
> >> >> >> Thanks, Sergey
> >> >> >>  > Biju B
> >> >> >> >
> >> >> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
> >> >> sberyozkin@gmail.com
> >> >> >> >wrote:
> >> >> >> >
> >> >> >> >> Hi
> >> >> >> >>
> >> >> >> >> Please see comments inline
> >> >> >> >>
> >> >> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <
> >> biju74techie@gmail.com>
> >> >> >> wrote:
> >> >> >> >> > Hi Team,
> >> >> >> >> >
> >> >> >> >> > Currently I was helping a team in building rest based
> services
> >> >> using
> >> >> >> CXF.
> >> >> >> >> I
> >> >> >> >> > noticed that for bean based service arguments (*Ex. String
> >> >> >> >> > getData(@FormParam("") TestObj tObj)*)
> >> >> >> >> > you have to include @FormParam with empty qualifer name and
> the
> >> >> >> request
> >> >> >> >> > parameter should follow bean property naming conventions. Say
> >> >> example
> >> >> >> >> > if TestObj has a property 'userName' (which is java style)
> then
> >> the
> >> >> >> >> request
> >> >> >> >> > parameter should be userName=Joe.
> >> >> >> >> > But in our requirement (mostly everywhere) the request
> >> parameters
> >> >> need
> >> >> >> >> not
> >> >> >> >> > use the Java Style. Here we were asked to use 'user.name'.
> >> >> >> >> >
> >> >> >> >> > I know for non-bean based parameters CXF supports this as
> >> >> @FormParam("
> >> >> >> >> > user.name") String userName, Is this possible for Bean Based
> >> also?
> >> >> >> >> >
> >> >> >> >> > As part of providing solution to team, I wrote a CXF Request
> >> >> Handler,
> >> >> >> >> > which transforms all the request based parmeters to bean
> based.
> >> >> >> >> > Now the TestObj will looks like,
> >> >> >> >> > class TestObject {
> >> >> >> >> >       @RequestParam("user.name")
> >> >> >> >> >       String userName;
> >> >> >> >> > ...
> >> >> >> >> > }
> >> >> >> >> > Using the @ReuestParam I will be identifying the actual
> request
> >> >> param.
> >> >> >> >> > The component I wrote supports primitives, nested beans and
> >> >> >> collections
> >> >> >> >> > also.
> >> >> >> >> >
> >> >> >> >> That is interesting, however I think your requirement can
> already
> >> be
> >> >> >> >> handled:
> >> >> >> >>
> >> >> >> >> public class TestObject {
> >> >> >> >>    public User getUser() {
> >> >> >> >>         return new User();
> >> >> >> >>    }
> >> >> >> >>    public void setUser(User user) {}
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> public class User {
> >> >> >> >>    public String getName() {
> >> >> >> >>         return name;
> >> >> >> >>    }
> >> >> >> >>    public void setName(String name) {}
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> That is more verbose that your solution but the user who
> >> contributed
> >> >> >> >> the patch earlier on did a lot of work for nested beans to
> work,
> >> with
> >> >> >> >> collections supported as well. And no extra annotations is
> >> required.
> >> >> >> >>
> >> >> >> >> Another option is just use MultivaluedMap in case of form
> >> submissions
> >> >> >> >> or explicit FormParam("user.name")
> >> >> >> >>
> >> >> >> >> What do you think ?
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Cheers, Sergey
> >> >> >> >>
> >> >> >> >> > *My Suggestion is can you include this feature in next
> version
> >> of
> >> >> CXF?
> >> >> >> >> and
> >> >> >> >>  > Can I contribute my code?*
> >> >> >> >> >
> >> >> >> >> > Biju B
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> Sergey Beryozkin
> >> >> >> >>
> >> >> >> >> Application Integration Division of Talend
> >> >> >> >> http://sberyozkin.blogspot.com
> >> >> >> >>
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >>  Sergey Beryozkin
> >> >> >>
> >> >> >> Application Integration Division of Talend
> >> >> >> http://sberyozkin.blogspot.com
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>  Sergey Beryozkin
> >> >>
> >> >> Application Integration Division of Talend
> >> >> http://sberyozkin.blogspot.com
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

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

On Thu, May 12, 2011 at 8:21 PM, Biju Nair <bi...@gmail.com> wrote:
> Just to clarify,
>
> the user bean will be something like,
> class User{
>   Map<String, String> params;
> }
>
> Request Data will be user.params.k1=v1&*user.*params.k2=v2

Yes if User is a nested bean, otherwise just
params.k1=v1&params.k2=v2

if we have FormParam("") User

>
> Finally, the params map will have [{k1=v1},{k2=v2}]
>
> Right?
Yes

>
> I will check this and let you know.
>
Ok, thanks. By the way I'm planning to have this code reused for
handling more involved FIQL queries, ex, one can do

/books?_s=id=gt=1

"Find all books with id greater than 1"

but we can't express the same query if Book happens to have a nested
ID bean, etc:

/books?_s=id=gt=id.1

Cheers, Sergey

> Biju B
>
> On Thu, May 12, 2011 at 10:52 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> On Thu, May 12, 2011 at 5:55 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Yes I understood that we don't need two solution for same problem :).
>> >
>> > Just want you let know, if you try to put something like
>> > "testaddress.City=Pleasanton&testAddress.stateName=CA"
>> > testAddress.stateName will not be populated. What I saw in your code is,
>> for
>> > first parameter the TestAddress instance is created and put into map as
>> > testaddress=<object> and in second parameter new TestAddress object is
>> > creates and put into map as testAddress=<object>.
>> >
>> > Code Says ==> parsedValues.put(beanKey, value);
>> >
>> I see, I checked the actual property name, such as "set+ 'stateName'"
>> is checked against available methods (and I guess fields) in a
>> case-insensitive way...
>>
>> > Anyway thanks for the discussion.
>> >
>> cool, thanks for starting it up
>>
>> > Can you elaborate on "Maps are not supported for example" - Let me see
>> > whether I can contribute?
>> >
>> Awhile back, a user asked about it but I recall I just did not get to
>> doing it, example
>>
>> user.params.k1=v1&params.k2=v2
>>
>> where a User bean has Map<String, String> property, which can be handy
>> in some cases too.
>> have a look please if you get a chance
>>
>> Cheers, Sergey
>>
>> > Biju B
>> >
>> > On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Hi
>> >>
>> >> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > Thanks for the reply.
>> >> >
>> >> > Just for clarification,
>> >> > If I have a Employee bean as follows,
>> >> > class Employee{
>> >> >    String name;
>> >> >    Address homeAddress;
>> >> >   //getters and setters are there
>> >> > }
>> >> >
>> >> > class Address{
>> >> >    String line1;
>> >> >   String line2;
>> >> >   //getters and setters are there
>> >> > }
>> >> > there is a rest service as String update(@FormParam("") Employee
>> >> employee)
>> >> >
>> >> > In the current approach, we need to pass request data as *
>> >> > name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
>> >> >
>> >> > which means we need to have homeAddress as case sensitive right? and
>> it
>> >> > won't work with "homeaddress.line1" right?
>> >>
>> >> No, the comparison is case-insensitive.
>> >>
>> >> > Also later if we try to change the variable names we need to ask all
>> the
>> >> > clients to change the request params. Am I right or something missing
>> >> here.
>> >> >
>> >>
>> >> I guess some care has to be taken with regard to refactoring the bean
>> >> class which is meant to capture the input from
>> >> remote clients.
>> >>
>> >> If you have a User.setAddress() method which is meant to capture an an
>> >> 'address' property then yes, if you go ahead and remove it or rename
>> >> it to setUserAddress then yes, "address" property won't be injected -
>> >> but customers does not have to be affected in such cases - replacing
>> >> the form submission payload can be easily done on the server side, ex,
>> >> at the RequestFilter level or better yet, by providing a custom
>> >> MessageBodyReader which extends CXF FormEncodingProvider and overrides
>> >> its populateMap method - let superclass to read the data and then just
>> >> replace the key 'address' with say 'customerAddress'
>> >>
>> >> Look, as I tried to say in the previous email, it's basically not
>> >> about CXF solution is better then yours, etc :-). I just don't think
>> >> we should have two solutions for this case 'shipped' with CXF. The CXF
>> >> one may not be ideal but it has its benefits too, one of them is that
>> >> WADLGenerator can understand such beans when generating query or form
>> >> parameters, etc, the other one is that JAX-RS proxies understand how
>> >> to deal with them, etc.
>> >>
>> >> I'd encourage you to help us to improve the existing solution if you
>> >> find some drawbacks. Maps are not supported for example.
>> >>
>> >> Thanks, Sergey
>> >>
>> >> Cheers, Sergey
>> >>
>> >> > Please confirm.
>> >> >
>> >> > Biju B
>> >> >
>> >> >
>> >> >
>> >> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com
>> >> >wrote:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <bi...@gmail.com>
>> >> >> wrote:
>> >> >> > Thanks for the reply.
>> >> >> >
>> >> >> > But in the first approach the client users has to follow Java
>> naming
>> >> >> > conventions (espc a non-java client) right?
>> >> >> Clients use "user.name" or "user.address.value" if they need to, the
>> >> >> difference between the two approaches
>> >> >> in that with your annotations you can selectively point to a
>> >> >> particular field and say this is what "user.name" has to be mapped
>> to,
>> >> >> while with the default approach one has to make sure nested beans are
>> >> >> available.
>> >> >>
>> >> >> >
>> >> >> > Regarding the MultiValueMap, i like the idea, but not for Bean
>> based.
>> >> >> Here
>> >> >> > the developers need to convert the map to Bean right?
>> >> >> >
>> >> >> > I still prefer to use *@FormParam("") object*, because this looks
>> like
>> >> >> > standard in CXF for primitive type arguments.
>> >> *@FormParam("identifier")
>> >> >> id.*
>> >> >>
>> >> >> I like @FormParam("") too, it's a  CXF extension (using ""), but it
>> >> >> allows for capturing many values while still allowing for some
>> >> >> flexibility re property types  as opposed to using  MultiValuedMap
>> >> >> (which is JAX-RS compliant).
>> >> >>
>> >> >> > **
>> >> >> > I think you can ask the same contributer to include the annotation
>> >> >> approach
>> >> >> > or some custom way of declaring user-defined names, rather than
>> java
>> >> >> > variables.
>> >> >> >
>> >> >>
>> >> >> As I said the problem is how to have "user.a.b.c" mapped to a
>> >> >> particular property. CXF has one solution for it which I think is
>> good
>> >> >> enough. Your solution is also interesting but I'm not sure CXF should
>> >> >> multiple solutions for this particular issue
>> >> >>
>> >> >> Thanks, Sergey
>> >> >>  > Biju B
>> >> >> >
>> >> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
>> >> sberyozkin@gmail.com
>> >> >> >wrote:
>> >> >> >
>> >> >> >> Hi
>> >> >> >>
>> >> >> >> Please see comments inline
>> >> >> >>
>> >> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <
>> biju74techie@gmail.com>
>> >> >> wrote:
>> >> >> >> > Hi Team,
>> >> >> >> >
>> >> >> >> > Currently I was helping a team in building rest based services
>> >> using
>> >> >> CXF.
>> >> >> >> I
>> >> >> >> > noticed that for bean based service arguments (*Ex. String
>> >> >> >> > getData(@FormParam("") TestObj tObj)*)
>> >> >> >> > you have to include @FormParam with empty qualifer name and the
>> >> >> request
>> >> >> >> > parameter should follow bean property naming conventions. Say
>> >> example
>> >> >> >> > if TestObj has a property 'userName' (which is java style) then
>> the
>> >> >> >> request
>> >> >> >> > parameter should be userName=Joe.
>> >> >> >> > But in our requirement (mostly everywhere) the request
>> parameters
>> >> need
>> >> >> >> not
>> >> >> >> > use the Java Style. Here we were asked to use 'user.name'.
>> >> >> >> >
>> >> >> >> > I know for non-bean based parameters CXF supports this as
>> >> @FormParam("
>> >> >> >> > user.name") String userName, Is this possible for Bean Based
>> also?
>> >> >> >> >
>> >> >> >> > As part of providing solution to team, I wrote a CXF Request
>> >> Handler,
>> >> >> >> > which transforms all the request based parmeters to bean based.
>> >> >> >> > Now the TestObj will looks like,
>> >> >> >> > class TestObject {
>> >> >> >> >       @RequestParam("user.name")
>> >> >> >> >       String userName;
>> >> >> >> > ...
>> >> >> >> > }
>> >> >> >> > Using the @ReuestParam I will be identifying the actual request
>> >> param.
>> >> >> >> > The component I wrote supports primitives, nested beans and
>> >> >> collections
>> >> >> >> > also.
>> >> >> >> >
>> >> >> >> That is interesting, however I think your requirement can already
>> be
>> >> >> >> handled:
>> >> >> >>
>> >> >> >> public class TestObject {
>> >> >> >>    public User getUser() {
>> >> >> >>         return new User();
>> >> >> >>    }
>> >> >> >>    public void setUser(User user) {}
>> >> >> >> }
>> >> >> >>
>> >> >> >> public class User {
>> >> >> >>    public String getName() {
>> >> >> >>         return name;
>> >> >> >>    }
>> >> >> >>    public void setName(String name) {}
>> >> >> >> }
>> >> >> >>
>> >> >> >> That is more verbose that your solution but the user who
>> contributed
>> >> >> >> the patch earlier on did a lot of work for nested beans to work,
>> with
>> >> >> >> collections supported as well. And no extra annotations is
>> required.
>> >> >> >>
>> >> >> >> Another option is just use MultivaluedMap in case of form
>> submissions
>> >> >> >> or explicit FormParam("user.name")
>> >> >> >>
>> >> >> >> What do you think ?
>> >> >> >>
>> >> >> >>
>> >> >> >> Cheers, Sergey
>> >> >> >>
>> >> >> >> > *My Suggestion is can you include this feature in next version
>> of
>> >> CXF?
>> >> >> >> and
>> >> >> >>  > Can I contribute my code?*
>> >> >> >> >
>> >> >> >> > Biju B
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Sergey Beryozkin
>> >> >> >>
>> >> >> >> Application Integration Division of Talend
>> >> >> >> http://sberyozkin.blogspot.com
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>  Sergey Beryozkin
>> >> >>
>> >> >> Application Integration Division of Talend
>> >> >> http://sberyozkin.blogspot.com
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Just to clarify,

the user bean will be something like,
class User{
   Map<String, String> params;
}

Request Data will be user.params.k1=v1&*user.*params.k2=v2

Finally, the params map will have [{k1=v1},{k2=v2}]

Right?

I will check this and let you know.

Biju B

On Thu, May 12, 2011 at 10:52 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On Thu, May 12, 2011 at 5:55 PM, Biju Nair <bi...@gmail.com> wrote:
> > Yes I understood that we don't need two solution for same problem :).
> >
> > Just want you let know, if you try to put something like
> > "testaddress.City=Pleasanton&testAddress.stateName=CA"
> > testAddress.stateName will not be populated. What I saw in your code is,
> for
> > first parameter the TestAddress instance is created and put into map as
> > testaddress=<object> and in second parameter new TestAddress object is
> > creates and put into map as testAddress=<object>.
> >
> > Code Says ==> parsedValues.put(beanKey, value);
> >
> I see, I checked the actual property name, such as "set+ 'stateName'"
> is checked against available methods (and I guess fields) in a
> case-insensitive way...
>
> > Anyway thanks for the discussion.
> >
> cool, thanks for starting it up
>
> > Can you elaborate on "Maps are not supported for example" - Let me see
> > whether I can contribute?
> >
> Awhile back, a user asked about it but I recall I just did not get to
> doing it, example
>
> user.params.k1=v1&params.k2=v2
>
> where a User bean has Map<String, String> property, which can be handy
> in some cases too.
> have a look please if you get a chance
>
> Cheers, Sergey
>
> > Biju B
> >
> > On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Hi
> >>
> >> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > Thanks for the reply.
> >> >
> >> > Just for clarification,
> >> > If I have a Employee bean as follows,
> >> > class Employee{
> >> >    String name;
> >> >    Address homeAddress;
> >> >   //getters and setters are there
> >> > }
> >> >
> >> > class Address{
> >> >    String line1;
> >> >   String line2;
> >> >   //getters and setters are there
> >> > }
> >> > there is a rest service as String update(@FormParam("") Employee
> >> employee)
> >> >
> >> > In the current approach, we need to pass request data as *
> >> > name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
> >> >
> >> > which means we need to have homeAddress as case sensitive right? and
> it
> >> > won't work with "homeaddress.line1" right?
> >>
> >> No, the comparison is case-insensitive.
> >>
> >> > Also later if we try to change the variable names we need to ask all
> the
> >> > clients to change the request params. Am I right or something missing
> >> here.
> >> >
> >>
> >> I guess some care has to be taken with regard to refactoring the bean
> >> class which is meant to capture the input from
> >> remote clients.
> >>
> >> If you have a User.setAddress() method which is meant to capture an an
> >> 'address' property then yes, if you go ahead and remove it or rename
> >> it to setUserAddress then yes, "address" property won't be injected -
> >> but customers does not have to be affected in such cases - replacing
> >> the form submission payload can be easily done on the server side, ex,
> >> at the RequestFilter level or better yet, by providing a custom
> >> MessageBodyReader which extends CXF FormEncodingProvider and overrides
> >> its populateMap method - let superclass to read the data and then just
> >> replace the key 'address' with say 'customerAddress'
> >>
> >> Look, as I tried to say in the previous email, it's basically not
> >> about CXF solution is better then yours, etc :-). I just don't think
> >> we should have two solutions for this case 'shipped' with CXF. The CXF
> >> one may not be ideal but it has its benefits too, one of them is that
> >> WADLGenerator can understand such beans when generating query or form
> >> parameters, etc, the other one is that JAX-RS proxies understand how
> >> to deal with them, etc.
> >>
> >> I'd encourage you to help us to improve the existing solution if you
> >> find some drawbacks. Maps are not supported for example.
> >>
> >> Thanks, Sergey
> >>
> >> Cheers, Sergey
> >>
> >> > Please confirm.
> >> >
> >> > Biju B
> >> >
> >> >
> >> >
> >> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >> >wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <bi...@gmail.com>
> >> >> wrote:
> >> >> > Thanks for the reply.
> >> >> >
> >> >> > But in the first approach the client users has to follow Java
> naming
> >> >> > conventions (espc a non-java client) right?
> >> >> Clients use "user.name" or "user.address.value" if they need to, the
> >> >> difference between the two approaches
> >> >> in that with your annotations you can selectively point to a
> >> >> particular field and say this is what "user.name" has to be mapped
> to,
> >> >> while with the default approach one has to make sure nested beans are
> >> >> available.
> >> >>
> >> >> >
> >> >> > Regarding the MultiValueMap, i like the idea, but not for Bean
> based.
> >> >> Here
> >> >> > the developers need to convert the map to Bean right?
> >> >> >
> >> >> > I still prefer to use *@FormParam("") object*, because this looks
> like
> >> >> > standard in CXF for primitive type arguments.
> >> *@FormParam("identifier")
> >> >> id.*
> >> >>
> >> >> I like @FormParam("") too, it's a  CXF extension (using ""), but it
> >> >> allows for capturing many values while still allowing for some
> >> >> flexibility re property types  as opposed to using  MultiValuedMap
> >> >> (which is JAX-RS compliant).
> >> >>
> >> >> > **
> >> >> > I think you can ask the same contributer to include the annotation
> >> >> approach
> >> >> > or some custom way of declaring user-defined names, rather than
> java
> >> >> > variables.
> >> >> >
> >> >>
> >> >> As I said the problem is how to have "user.a.b.c" mapped to a
> >> >> particular property. CXF has one solution for it which I think is
> good
> >> >> enough. Your solution is also interesting but I'm not sure CXF should
> >> >> multiple solutions for this particular issue
> >> >>
> >> >> Thanks, Sergey
> >> >>  > Biju B
> >> >> >
> >> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
> >> sberyozkin@gmail.com
> >> >> >wrote:
> >> >> >
> >> >> >> Hi
> >> >> >>
> >> >> >> Please see comments inline
> >> >> >>
> >> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <
> biju74techie@gmail.com>
> >> >> wrote:
> >> >> >> > Hi Team,
> >> >> >> >
> >> >> >> > Currently I was helping a team in building rest based services
> >> using
> >> >> CXF.
> >> >> >> I
> >> >> >> > noticed that for bean based service arguments (*Ex. String
> >> >> >> > getData(@FormParam("") TestObj tObj)*)
> >> >> >> > you have to include @FormParam with empty qualifer name and the
> >> >> request
> >> >> >> > parameter should follow bean property naming conventions. Say
> >> example
> >> >> >> > if TestObj has a property 'userName' (which is java style) then
> the
> >> >> >> request
> >> >> >> > parameter should be userName=Joe.
> >> >> >> > But in our requirement (mostly everywhere) the request
> parameters
> >> need
> >> >> >> not
> >> >> >> > use the Java Style. Here we were asked to use 'user.name'.
> >> >> >> >
> >> >> >> > I know for non-bean based parameters CXF supports this as
> >> @FormParam("
> >> >> >> > user.name") String userName, Is this possible for Bean Based
> also?
> >> >> >> >
> >> >> >> > As part of providing solution to team, I wrote a CXF Request
> >> Handler,
> >> >> >> > which transforms all the request based parmeters to bean based.
> >> >> >> > Now the TestObj will looks like,
> >> >> >> > class TestObject {
> >> >> >> >       @RequestParam("user.name")
> >> >> >> >       String userName;
> >> >> >> > ...
> >> >> >> > }
> >> >> >> > Using the @ReuestParam I will be identifying the actual request
> >> param.
> >> >> >> > The component I wrote supports primitives, nested beans and
> >> >> collections
> >> >> >> > also.
> >> >> >> >
> >> >> >> That is interesting, however I think your requirement can already
> be
> >> >> >> handled:
> >> >> >>
> >> >> >> public class TestObject {
> >> >> >>    public User getUser() {
> >> >> >>         return new User();
> >> >> >>    }
> >> >> >>    public void setUser(User user) {}
> >> >> >> }
> >> >> >>
> >> >> >> public class User {
> >> >> >>    public String getName() {
> >> >> >>         return name;
> >> >> >>    }
> >> >> >>    public void setName(String name) {}
> >> >> >> }
> >> >> >>
> >> >> >> That is more verbose that your solution but the user who
> contributed
> >> >> >> the patch earlier on did a lot of work for nested beans to work,
> with
> >> >> >> collections supported as well. And no extra annotations is
> required.
> >> >> >>
> >> >> >> Another option is just use MultivaluedMap in case of form
> submissions
> >> >> >> or explicit FormParam("user.name")
> >> >> >>
> >> >> >> What do you think ?
> >> >> >>
> >> >> >>
> >> >> >> Cheers, Sergey
> >> >> >>
> >> >> >> > *My Suggestion is can you include this feature in next version
> of
> >> CXF?
> >> >> >> and
> >> >> >>  > Can I contribute my code?*
> >> >> >> >
> >> >> >> > Biju B
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> Sergey Beryozkin
> >> >> >>
> >> >> >> Application Integration Division of Talend
> >> >> >> http://sberyozkin.blogspot.com
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>  Sergey Beryozkin
> >> >>
> >> >> Application Integration Division of Talend
> >> >> http://sberyozkin.blogspot.com
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

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

On Thu, May 12, 2011 at 5:55 PM, Biju Nair <bi...@gmail.com> wrote:
> Yes I understood that we don't need two solution for same problem :).
>
> Just want you let know, if you try to put something like
> "testaddress.City=Pleasanton&testAddress.stateName=CA"
> testAddress.stateName will not be populated. What I saw in your code is, for
> first parameter the TestAddress instance is created and put into map as
> testaddress=<object> and in second parameter new TestAddress object is
> creates and put into map as testAddress=<object>.
>
> Code Says ==> parsedValues.put(beanKey, value);
>
I see, I checked the actual property name, such as "set+ 'stateName'"
is checked against available methods (and I guess fields) in a
case-insensitive way...

> Anyway thanks for the discussion.
>
cool, thanks for starting it up

> Can you elaborate on "Maps are not supported for example" - Let me see
> whether I can contribute?
>
Awhile back, a user asked about it but I recall I just did not get to
doing it, example

user.params.k1=v1&params.k2=v2

where a User bean has Map<String, String> property, which can be handy
in some cases too.
have a look please if you get a chance

Cheers, Sergey

> Biju B
>
> On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Thanks for the reply.
>> >
>> > Just for clarification,
>> > If I have a Employee bean as follows,
>> > class Employee{
>> >    String name;
>> >    Address homeAddress;
>> >   //getters and setters are there
>> > }
>> >
>> > class Address{
>> >    String line1;
>> >   String line2;
>> >   //getters and setters are there
>> > }
>> > there is a rest service as String update(@FormParam("") Employee
>> employee)
>> >
>> > In the current approach, we need to pass request data as *
>> > name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
>> >
>> > which means we need to have homeAddress as case sensitive right? and it
>> > won't work with "homeaddress.line1" right?
>>
>> No, the comparison is case-insensitive.
>>
>> > Also later if we try to change the variable names we need to ask all the
>> > clients to change the request params. Am I right or something missing
>> here.
>> >
>>
>> I guess some care has to be taken with regard to refactoring the bean
>> class which is meant to capture the input from
>> remote clients.
>>
>> If you have a User.setAddress() method which is meant to capture an an
>> 'address' property then yes, if you go ahead and remove it or rename
>> it to setUserAddress then yes, "address" property won't be injected -
>> but customers does not have to be affected in such cases - replacing
>> the form submission payload can be easily done on the server side, ex,
>> at the RequestFilter level or better yet, by providing a custom
>> MessageBodyReader which extends CXF FormEncodingProvider and overrides
>> its populateMap method - let superclass to read the data and then just
>> replace the key 'address' with say 'customerAddress'
>>
>> Look, as I tried to say in the previous email, it's basically not
>> about CXF solution is better then yours, etc :-). I just don't think
>> we should have two solutions for this case 'shipped' with CXF. The CXF
>> one may not be ideal but it has its benefits too, one of them is that
>> WADLGenerator can understand such beans when generating query or form
>> parameters, etc, the other one is that JAX-RS proxies understand how
>> to deal with them, etc.
>>
>> I'd encourage you to help us to improve the existing solution if you
>> find some drawbacks. Maps are not supported for example.
>>
>> Thanks, Sergey
>>
>> Cheers, Sergey
>>
>> > Please confirm.
>> >
>> > Biju B
>> >
>> >
>> >
>> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Hi
>> >>
>> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <bi...@gmail.com>
>> >> wrote:
>> >> > Thanks for the reply.
>> >> >
>> >> > But in the first approach the client users has to follow Java naming
>> >> > conventions (espc a non-java client) right?
>> >> Clients use "user.name" or "user.address.value" if they need to, the
>> >> difference between the two approaches
>> >> in that with your annotations you can selectively point to a
>> >> particular field and say this is what "user.name" has to be mapped to,
>> >> while with the default approach one has to make sure nested beans are
>> >> available.
>> >>
>> >> >
>> >> > Regarding the MultiValueMap, i like the idea, but not for Bean based.
>> >> Here
>> >> > the developers need to convert the map to Bean right?
>> >> >
>> >> > I still prefer to use *@FormParam("") object*, because this looks like
>> >> > standard in CXF for primitive type arguments.
>> *@FormParam("identifier")
>> >> id.*
>> >>
>> >> I like @FormParam("") too, it's a  CXF extension (using ""), but it
>> >> allows for capturing many values while still allowing for some
>> >> flexibility re property types  as opposed to using  MultiValuedMap
>> >> (which is JAX-RS compliant).
>> >>
>> >> > **
>> >> > I think you can ask the same contributer to include the annotation
>> >> approach
>> >> > or some custom way of declaring user-defined names, rather than java
>> >> > variables.
>> >> >
>> >>
>> >> As I said the problem is how to have "user.a.b.c" mapped to a
>> >> particular property. CXF has one solution for it which I think is good
>> >> enough. Your solution is also interesting but I'm not sure CXF should
>> >> multiple solutions for this particular issue
>> >>
>> >> Thanks, Sergey
>> >>  > Biju B
>> >> >
>> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
>> sberyozkin@gmail.com
>> >> >wrote:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> Please see comments inline
>> >> >>
>> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <bi...@gmail.com>
>> >> wrote:
>> >> >> > Hi Team,
>> >> >> >
>> >> >> > Currently I was helping a team in building rest based services
>> using
>> >> CXF.
>> >> >> I
>> >> >> > noticed that for bean based service arguments (*Ex. String
>> >> >> > getData(@FormParam("") TestObj tObj)*)
>> >> >> > you have to include @FormParam with empty qualifer name and the
>> >> request
>> >> >> > parameter should follow bean property naming conventions. Say
>> example
>> >> >> > if TestObj has a property 'userName' (which is java style) then the
>> >> >> request
>> >> >> > parameter should be userName=Joe.
>> >> >> > But in our requirement (mostly everywhere) the request parameters
>> need
>> >> >> not
>> >> >> > use the Java Style. Here we were asked to use 'user.name'.
>> >> >> >
>> >> >> > I know for non-bean based parameters CXF supports this as
>> @FormParam("
>> >> >> > user.name") String userName, Is this possible for Bean Based also?
>> >> >> >
>> >> >> > As part of providing solution to team, I wrote a CXF Request
>> Handler,
>> >> >> > which transforms all the request based parmeters to bean based.
>> >> >> > Now the TestObj will looks like,
>> >> >> > class TestObject {
>> >> >> >       @RequestParam("user.name")
>> >> >> >       String userName;
>> >> >> > ...
>> >> >> > }
>> >> >> > Using the @ReuestParam I will be identifying the actual request
>> param.
>> >> >> > The component I wrote supports primitives, nested beans and
>> >> collections
>> >> >> > also.
>> >> >> >
>> >> >> That is interesting, however I think your requirement can already be
>> >> >> handled:
>> >> >>
>> >> >> public class TestObject {
>> >> >>    public User getUser() {
>> >> >>         return new User();
>> >> >>    }
>> >> >>    public void setUser(User user) {}
>> >> >> }
>> >> >>
>> >> >> public class User {
>> >> >>    public String getName() {
>> >> >>         return name;
>> >> >>    }
>> >> >>    public void setName(String name) {}
>> >> >> }
>> >> >>
>> >> >> That is more verbose that your solution but the user who contributed
>> >> >> the patch earlier on did a lot of work for nested beans to work, with
>> >> >> collections supported as well. And no extra annotations is required.
>> >> >>
>> >> >> Another option is just use MultivaluedMap in case of form submissions
>> >> >> or explicit FormParam("user.name")
>> >> >>
>> >> >> What do you think ?
>> >> >>
>> >> >>
>> >> >> Cheers, Sergey
>> >> >>
>> >> >> > *My Suggestion is can you include this feature in next version of
>> CXF?
>> >> >> and
>> >> >>  > Can I contribute my code?*
>> >> >> >
>> >> >> > Biju B
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Sergey Beryozkin
>> >> >>
>> >> >> Application Integration Division of Talend
>> >> >> http://sberyozkin.blogspot.com
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>  Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Yes I understood that we don't need two solution for same problem :).

Just want you let know, if you try to put something like
"testaddress.City=Pleasanton&testAddress.stateName=CA"
testAddress.stateName will not be populated. What I saw in your code is, for
first parameter the TestAddress instance is created and put into map as
testaddress=<object> and in second parameter new TestAddress object is
creates and put into map as testAddress=<object>.

Code Says ==> parsedValues.put(beanKey, value);

Anyway thanks for the discussion.

Can you elaborate on "Maps are not supported for example" - Let me see
whether I can contribute?

Biju B

On Thu, May 12, 2011 at 2:43 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On Wed, May 11, 2011 at 5:34 PM, Biju Nair <bi...@gmail.com> wrote:
> > Thanks for the reply.
> >
> > Just for clarification,
> > If I have a Employee bean as follows,
> > class Employee{
> >    String name;
> >    Address homeAddress;
> >   //getters and setters are there
> > }
> >
> > class Address{
> >    String line1;
> >   String line2;
> >   //getters and setters are there
> > }
> > there is a rest service as String update(@FormParam("") Employee
> employee)
> >
> > In the current approach, we need to pass request data as *
> > name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
> >
> > which means we need to have homeAddress as case sensitive right? and it
> > won't work with "homeaddress.line1" right?
>
> No, the comparison is case-insensitive.
>
> > Also later if we try to change the variable names we need to ask all the
> > clients to change the request params. Am I right or something missing
> here.
> >
>
> I guess some care has to be taken with regard to refactoring the bean
> class which is meant to capture the input from
> remote clients.
>
> If you have a User.setAddress() method which is meant to capture an an
> 'address' property then yes, if you go ahead and remove it or rename
> it to setUserAddress then yes, "address" property won't be injected -
> but customers does not have to be affected in such cases - replacing
> the form submission payload can be easily done on the server side, ex,
> at the RequestFilter level or better yet, by providing a custom
> MessageBodyReader which extends CXF FormEncodingProvider and overrides
> its populateMap method - let superclass to read the data and then just
> replace the key 'address' with say 'customerAddress'
>
> Look, as I tried to say in the previous email, it's basically not
> about CXF solution is better then yours, etc :-). I just don't think
> we should have two solutions for this case 'shipped' with CXF. The CXF
> one may not be ideal but it has its benefits too, one of them is that
> WADLGenerator can understand such beans when generating query or form
> parameters, etc, the other one is that JAX-RS proxies understand how
> to deal with them, etc.
>
> I'd encourage you to help us to improve the existing solution if you
> find some drawbacks. Maps are not supported for example.
>
> Thanks, Sergey
>
> Cheers, Sergey
>
> > Please confirm.
> >
> > Biju B
> >
> >
> >
> > On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Hi
> >>
> >> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <bi...@gmail.com>
> >> wrote:
> >> > Thanks for the reply.
> >> >
> >> > But in the first approach the client users has to follow Java naming
> >> > conventions (espc a non-java client) right?
> >> Clients use "user.name" or "user.address.value" if they need to, the
> >> difference between the two approaches
> >> in that with your annotations you can selectively point to a
> >> particular field and say this is what "user.name" has to be mapped to,
> >> while with the default approach one has to make sure nested beans are
> >> available.
> >>
> >> >
> >> > Regarding the MultiValueMap, i like the idea, but not for Bean based.
> >> Here
> >> > the developers need to convert the map to Bean right?
> >> >
> >> > I still prefer to use *@FormParam("") object*, because this looks like
> >> > standard in CXF for primitive type arguments.
> *@FormParam("identifier")
> >> id.*
> >>
> >> I like @FormParam("") too, it's a  CXF extension (using ""), but it
> >> allows for capturing many values while still allowing for some
> >> flexibility re property types  as opposed to using  MultiValuedMap
> >> (which is JAX-RS compliant).
> >>
> >> > **
> >> > I think you can ask the same contributer to include the annotation
> >> approach
> >> > or some custom way of declaring user-defined names, rather than java
> >> > variables.
> >> >
> >>
> >> As I said the problem is how to have "user.a.b.c" mapped to a
> >> particular property. CXF has one solution for it which I think is good
> >> enough. Your solution is also interesting but I'm not sure CXF should
> >> multiple solutions for this particular issue
> >>
> >> Thanks, Sergey
> >>  > Biju B
> >> >
> >> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >> >wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> Please see comments inline
> >> >>
> >> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <bi...@gmail.com>
> >> wrote:
> >> >> > Hi Team,
> >> >> >
> >> >> > Currently I was helping a team in building rest based services
> using
> >> CXF.
> >> >> I
> >> >> > noticed that for bean based service arguments (*Ex. String
> >> >> > getData(@FormParam("") TestObj tObj)*)
> >> >> > you have to include @FormParam with empty qualifer name and the
> >> request
> >> >> > parameter should follow bean property naming conventions. Say
> example
> >> >> > if TestObj has a property 'userName' (which is java style) then the
> >> >> request
> >> >> > parameter should be userName=Joe.
> >> >> > But in our requirement (mostly everywhere) the request parameters
> need
> >> >> not
> >> >> > use the Java Style. Here we were asked to use 'user.name'.
> >> >> >
> >> >> > I know for non-bean based parameters CXF supports this as
> @FormParam("
> >> >> > user.name") String userName, Is this possible for Bean Based also?
> >> >> >
> >> >> > As part of providing solution to team, I wrote a CXF Request
> Handler,
> >> >> > which transforms all the request based parmeters to bean based.
> >> >> > Now the TestObj will looks like,
> >> >> > class TestObject {
> >> >> >       @RequestParam("user.name")
> >> >> >       String userName;
> >> >> > ...
> >> >> > }
> >> >> > Using the @ReuestParam I will be identifying the actual request
> param.
> >> >> > The component I wrote supports primitives, nested beans and
> >> collections
> >> >> > also.
> >> >> >
> >> >> That is interesting, however I think your requirement can already be
> >> >> handled:
> >> >>
> >> >> public class TestObject {
> >> >>    public User getUser() {
> >> >>         return new User();
> >> >>    }
> >> >>    public void setUser(User user) {}
> >> >> }
> >> >>
> >> >> public class User {
> >> >>    public String getName() {
> >> >>         return name;
> >> >>    }
> >> >>    public void setName(String name) {}
> >> >> }
> >> >>
> >> >> That is more verbose that your solution but the user who contributed
> >> >> the patch earlier on did a lot of work for nested beans to work, with
> >> >> collections supported as well. And no extra annotations is required.
> >> >>
> >> >> Another option is just use MultivaluedMap in case of form submissions
> >> >> or explicit FormParam("user.name")
> >> >>
> >> >> What do you think ?
> >> >>
> >> >>
> >> >> Cheers, Sergey
> >> >>
> >> >> > *My Suggestion is can you include this feature in next version of
> CXF?
> >> >> and
> >> >>  > Can I contribute my code?*
> >> >> >
> >> >> > Biju B
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Sergey Beryozkin
> >> >>
> >> >> Application Integration Division of Talend
> >> >> http://sberyozkin.blogspot.com
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >>  Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

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

On Wed, May 11, 2011 at 5:34 PM, Biju Nair <bi...@gmail.com> wrote:
> Thanks for the reply.
>
> Just for clarification,
> If I have a Employee bean as follows,
> class Employee{
>    String name;
>    Address homeAddress;
>   //getters and setters are there
> }
>
> class Address{
>    String line1;
>   String line2;
>   //getters and setters are there
> }
> there is a rest service as String update(@FormParam("") Employee employee)
>
> In the current approach, we need to pass request data as *
> name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*
>
> which means we need to have homeAddress as case sensitive right? and it
> won't work with "homeaddress.line1" right?

No, the comparison is case-insensitive.

> Also later if we try to change the variable names we need to ask all the
> clients to change the request params. Am I right or something missing here.
>

I guess some care has to be taken with regard to refactoring the bean
class which is meant to capture the input from
remote clients.

If you have a User.setAddress() method which is meant to capture an an
'address' property then yes, if you go ahead and remove it or rename
it to setUserAddress then yes, "address" property won't be injected -
but customers does not have to be affected in such cases - replacing
the form submission payload can be easily done on the server side, ex,
at the RequestFilter level or better yet, by providing a custom
MessageBodyReader which extends CXF FormEncodingProvider and overrides
its populateMap method - let superclass to read the data and then just
replace the key 'address' with say 'customerAddress'

Look, as I tried to say in the previous email, it's basically not
about CXF solution is better then yours, etc :-). I just don't think
we should have two solutions for this case 'shipped' with CXF. The CXF
one may not be ideal but it has its benefits too, one of them is that
WADLGenerator can understand such beans when generating query or form
parameters, etc, the other one is that JAX-RS proxies understand how
to deal with them, etc.

I'd encourage you to help us to improve the existing solution if you
find some drawbacks. Maps are not supported for example.

Thanks, Sergey

Cheers, Sergey

> Please confirm.
>
> Biju B
>
>
>
> On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> > Thanks for the reply.
>> >
>> > But in the first approach the client users has to follow Java naming
>> > conventions (espc a non-java client) right?
>> Clients use "user.name" or "user.address.value" if they need to, the
>> difference between the two approaches
>> in that with your annotations you can selectively point to a
>> particular field and say this is what "user.name" has to be mapped to,
>> while with the default approach one has to make sure nested beans are
>> available.
>>
>> >
>> > Regarding the MultiValueMap, i like the idea, but not for Bean based.
>> Here
>> > the developers need to convert the map to Bean right?
>> >
>> > I still prefer to use *@FormParam("") object*, because this looks like
>> > standard in CXF for primitive type arguments. *@FormParam("identifier")
>> id.*
>>
>> I like @FormParam("") too, it's a  CXF extension (using ""), but it
>> allows for capturing many values while still allowing for some
>> flexibility re property types  as opposed to using  MultiValuedMap
>> (which is JAX-RS compliant).
>>
>> > **
>> > I think you can ask the same contributer to include the annotation
>> approach
>> > or some custom way of declaring user-defined names, rather than java
>> > variables.
>> >
>>
>> As I said the problem is how to have "user.a.b.c" mapped to a
>> particular property. CXF has one solution for it which I think is good
>> enough. Your solution is also interesting but I'm not sure CXF should
>> multiple solutions for this particular issue
>>
>> Thanks, Sergey
>>  > Biju B
>> >
>> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>> >
>> >> Hi
>> >>
>> >> Please see comments inline
>> >>
>> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <bi...@gmail.com>
>> wrote:
>> >> > Hi Team,
>> >> >
>> >> > Currently I was helping a team in building rest based services using
>> CXF.
>> >> I
>> >> > noticed that for bean based service arguments (*Ex. String
>> >> > getData(@FormParam("") TestObj tObj)*)
>> >> > you have to include @FormParam with empty qualifer name and the
>> request
>> >> > parameter should follow bean property naming conventions. Say example
>> >> > if TestObj has a property 'userName' (which is java style) then the
>> >> request
>> >> > parameter should be userName=Joe.
>> >> > But in our requirement (mostly everywhere) the request parameters need
>> >> not
>> >> > use the Java Style. Here we were asked to use 'user.name'.
>> >> >
>> >> > I know for non-bean based parameters CXF supports this as @FormParam("
>> >> > user.name") String userName, Is this possible for Bean Based also?
>> >> >
>> >> > As part of providing solution to team, I wrote a CXF Request Handler,
>> >> > which transforms all the request based parmeters to bean based.
>> >> > Now the TestObj will looks like,
>> >> > class TestObject {
>> >> >       @RequestParam("user.name")
>> >> >       String userName;
>> >> > ...
>> >> > }
>> >> > Using the @ReuestParam I will be identifying the actual request param.
>> >> > The component I wrote supports primitives, nested beans and
>> collections
>> >> > also.
>> >> >
>> >> That is interesting, however I think your requirement can already be
>> >> handled:
>> >>
>> >> public class TestObject {
>> >>    public User getUser() {
>> >>         return new User();
>> >>    }
>> >>    public void setUser(User user) {}
>> >> }
>> >>
>> >> public class User {
>> >>    public String getName() {
>> >>         return name;
>> >>    }
>> >>    public void setName(String name) {}
>> >> }
>> >>
>> >> That is more verbose that your solution but the user who contributed
>> >> the patch earlier on did a lot of work for nested beans to work, with
>> >> collections supported as well. And no extra annotations is required.
>> >>
>> >> Another option is just use MultivaluedMap in case of form submissions
>> >> or explicit FormParam("user.name")
>> >>
>> >> What do you think ?
>> >>
>> >>
>> >> Cheers, Sergey
>> >>
>> >> > *My Suggestion is can you include this feature in next version of CXF?
>> >> and
>> >>  > Can I contribute my code?*
>> >> >
>> >> > Biju B
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >>
>> >
>>
>>
>>
>> --
>>  Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Thanks for the reply.

Just for clarification,
If I have a Employee bean as follows,
class Employee{
    String name;
    Address homeAddress;
   //getters and setters are there
}

class Address{
    String line1;
   String line2;
   //getters and setters are there
}
there is a rest service as String update(@FormParam("") Employee employee)

In the current approach, we need to pass request data as *
name=Joe&homeAddress.line1=MyLocation&homeAddress.line2=MyStreet*

which means we need to have homeAddress as case sensitive right? and it
won't work with "homeaddress.line1" right?
Also later if we try to change the variable names we need to ask all the
clients to change the request params. Am I right or something missing here.

Please confirm.

Biju B



On Wed, May 11, 2011 at 1:45 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On Tue, May 10, 2011 at 10:07 PM, Biju Nair <bi...@gmail.com>
> wrote:
> > Thanks for the reply.
> >
> > But in the first approach the client users has to follow Java naming
> > conventions (espc a non-java client) right?
> Clients use "user.name" or "user.address.value" if they need to, the
> difference between the two approaches
> in that with your annotations you can selectively point to a
> particular field and say this is what "user.name" has to be mapped to,
> while with the default approach one has to make sure nested beans are
> available.
>
> >
> > Regarding the MultiValueMap, i like the idea, but not for Bean based.
> Here
> > the developers need to convert the map to Bean right?
> >
> > I still prefer to use *@FormParam("") object*, because this looks like
> > standard in CXF for primitive type arguments. *@FormParam("identifier")
> id.*
>
> I like @FormParam("") too, it's a  CXF extension (using ""), but it
> allows for capturing many values while still allowing for some
> flexibility re property types  as opposed to using  MultiValuedMap
> (which is JAX-RS compliant).
>
> > **
> > I think you can ask the same contributer to include the annotation
> approach
> > or some custom way of declaring user-defined names, rather than java
> > variables.
> >
>
> As I said the problem is how to have "user.a.b.c" mapped to a
> particular property. CXF has one solution for it which I think is good
> enough. Your solution is also interesting but I'm not sure CXF should
> multiple solutions for this particular issue
>
> Thanks, Sergey
>  > Biju B
> >
> > On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Hi
> >>
> >> Please see comments inline
> >>
> >> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <bi...@gmail.com>
> wrote:
> >> > Hi Team,
> >> >
> >> > Currently I was helping a team in building rest based services using
> CXF.
> >> I
> >> > noticed that for bean based service arguments (*Ex. String
> >> > getData(@FormParam("") TestObj tObj)*)
> >> > you have to include @FormParam with empty qualifer name and the
> request
> >> > parameter should follow bean property naming conventions. Say example
> >> > if TestObj has a property 'userName' (which is java style) then the
> >> request
> >> > parameter should be userName=Joe.
> >> > But in our requirement (mostly everywhere) the request parameters need
> >> not
> >> > use the Java Style. Here we were asked to use 'user.name'.
> >> >
> >> > I know for non-bean based parameters CXF supports this as @FormParam("
> >> > user.name") String userName, Is this possible for Bean Based also?
> >> >
> >> > As part of providing solution to team, I wrote a CXF Request Handler,
> >> > which transforms all the request based parmeters to bean based.
> >> > Now the TestObj will looks like,
> >> > class TestObject {
> >> >       @RequestParam("user.name")
> >> >       String userName;
> >> > ...
> >> > }
> >> > Using the @ReuestParam I will be identifying the actual request param.
> >> > The component I wrote supports primitives, nested beans and
> collections
> >> > also.
> >> >
> >> That is interesting, however I think your requirement can already be
> >> handled:
> >>
> >> public class TestObject {
> >>    public User getUser() {
> >>         return new User();
> >>    }
> >>    public void setUser(User user) {}
> >> }
> >>
> >> public class User {
> >>    public String getName() {
> >>         return name;
> >>    }
> >>    public void setName(String name) {}
> >> }
> >>
> >> That is more verbose that your solution but the user who contributed
> >> the patch earlier on did a lot of work for nested beans to work, with
> >> collections supported as well. And no extra annotations is required.
> >>
> >> Another option is just use MultivaluedMap in case of form submissions
> >> or explicit FormParam("user.name")
> >>
> >> What do you think ?
> >>
> >>
> >> Cheers, Sergey
> >>
> >> > *My Suggestion is can you include this feature in next version of CXF?
> >> and
> >>  > Can I contribute my code?*
> >> >
> >> > Biju B
> >> >
> >>
> >>
> >>
> >> --
> >> Sergey Beryozkin
> >>
> >> Application Integration Division of Talend
> >> http://sberyozkin.blogspot.com
> >>
> >
>
>
>
> --
>  Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

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

On Tue, May 10, 2011 at 10:07 PM, Biju Nair <bi...@gmail.com> wrote:
> Thanks for the reply.
>
> But in the first approach the client users has to follow Java naming
> conventions (espc a non-java client) right?
Clients use "user.name" or "user.address.value" if they need to, the
difference between the two approaches
in that with your annotations you can selectively point to a
particular field and say this is what "user.name" has to be mapped to,
while with the default approach one has to make sure nested beans are
available.

>
> Regarding the MultiValueMap, i like the idea, but not for Bean based. Here
> the developers need to convert the map to Bean right?
>
> I still prefer to use *@FormParam("") object*, because this looks like
> standard in CXF for primitive type arguments. *@FormParam("identifier") id.*

I like @FormParam("") too, it's a  CXF extension (using ""), but it
allows for capturing many values while still allowing for some
flexibility re property types  as opposed to using  MultiValuedMap
(which is JAX-RS compliant).

> **
> I think you can ask the same contributer to include the annotation approach
> or some custom way of declaring user-defined names, rather than java
> variables.
>

As I said the problem is how to have "user.a.b.c" mapped to a
particular property. CXF has one solution for it which I think is good
enough. Your solution is also interesting but I'm not sure CXF should
multiple solutions for this particular issue

Thanks, Sergey
> Biju B
>
> On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> Please see comments inline
>>
>> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <bi...@gmail.com> wrote:
>> > Hi Team,
>> >
>> > Currently I was helping a team in building rest based services using CXF.
>> I
>> > noticed that for bean based service arguments (*Ex. String
>> > getData(@FormParam("") TestObj tObj)*)
>> > you have to include @FormParam with empty qualifer name and the request
>> > parameter should follow bean property naming conventions. Say example
>> > if TestObj has a property 'userName' (which is java style) then the
>> request
>> > parameter should be userName=Joe.
>> > But in our requirement (mostly everywhere) the request parameters need
>> not
>> > use the Java Style. Here we were asked to use 'user.name'.
>> >
>> > I know for non-bean based parameters CXF supports this as @FormParam("
>> > user.name") String userName, Is this possible for Bean Based also?
>> >
>> > As part of providing solution to team, I wrote a CXF Request Handler,
>> > which transforms all the request based parmeters to bean based.
>> > Now the TestObj will looks like,
>> > class TestObject {
>> >       @RequestParam("user.name")
>> >       String userName;
>> > ...
>> > }
>> > Using the @ReuestParam I will be identifying the actual request param.
>> > The component I wrote supports primitives, nested beans and collections
>> > also.
>> >
>> That is interesting, however I think your requirement can already be
>> handled:
>>
>> public class TestObject {
>>    public User getUser() {
>>         return new User();
>>    }
>>    public void setUser(User user) {}
>> }
>>
>> public class User {
>>    public String getName() {
>>         return name;
>>    }
>>    public void setName(String name) {}
>> }
>>
>> That is more verbose that your solution but the user who contributed
>> the patch earlier on did a lot of work for nested beans to work, with
>> collections supported as well. And no extra annotations is required.
>>
>> Another option is just use MultivaluedMap in case of form submissions
>> or explicit FormParam("user.name")
>>
>> What do you think ?
>>
>>
>> Cheers, Sergey
>>
>> > *My Suggestion is can you include this feature in next version of CXF?
>> and
>>  > Can I contribute my code?*
>> >
>> > Biju B
>> >
>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Custom Reuqest Param Name for Bean Request Object

Posted by Biju Nair <bi...@gmail.com>.
Thanks for the reply.

But in the first approach the client users has to follow Java naming
conventions (espc a non-java client) right?

Regarding the MultiValueMap, i like the idea, but not for Bean based. Here
the developers need to convert the map to Bean right?

I still prefer to use *@FormParam("") object*, because this looks like
standard in CXF for primitive type arguments. *@FormParam("identifier") id.*
**
I think you can ask the same contributer to include the annotation approach
or some custom way of declaring user-defined names, rather than java
variables.

Biju B

On Tue, May 10, 2011 at 1:22 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> Please see comments inline
>
> On Tue, May 10, 2011 at 8:29 PM, Biju Nair <bi...@gmail.com> wrote:
> > Hi Team,
> >
> > Currently I was helping a team in building rest based services using CXF.
> I
> > noticed that for bean based service arguments (*Ex. String
> > getData(@FormParam("") TestObj tObj)*)
> > you have to include @FormParam with empty qualifer name and the request
> > parameter should follow bean property naming conventions. Say example
> > if TestObj has a property 'userName' (which is java style) then the
> request
> > parameter should be userName=Joe.
> > But in our requirement (mostly everywhere) the request parameters need
> not
> > use the Java Style. Here we were asked to use 'user.name'.
> >
> > I know for non-bean based parameters CXF supports this as @FormParam("
> > user.name") String userName, Is this possible for Bean Based also?
> >
> > As part of providing solution to team, I wrote a CXF Request Handler,
> > which transforms all the request based parmeters to bean based.
> > Now the TestObj will looks like,
> > class TestObject {
> >       @RequestParam("user.name")
> >       String userName;
> > ...
> > }
> > Using the @ReuestParam I will be identifying the actual request param.
> > The component I wrote supports primitives, nested beans and collections
> > also.
> >
> That is interesting, however I think your requirement can already be
> handled:
>
> public class TestObject {
>    public User getUser() {
>         return new User();
>    }
>    public void setUser(User user) {}
> }
>
> public class User {
>    public String getName() {
>         return name;
>    }
>    public void setName(String name) {}
> }
>
> That is more verbose that your solution but the user who contributed
> the patch earlier on did a lot of work for nested beans to work, with
> collections supported as well. And no extra annotations is required.
>
> Another option is just use MultivaluedMap in case of form submissions
> or explicit FormParam("user.name")
>
> What do you think ?
>
>
> Cheers, Sergey
>
> > *My Suggestion is can you include this feature in next version of CXF?
> and
>  > Can I contribute my code?*
> >
> > Biju B
> >
>
>
>
> --
> Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: Custom Reuqest Param Name for Bean Request Object

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

Please see comments inline

On Tue, May 10, 2011 at 8:29 PM, Biju Nair <bi...@gmail.com> wrote:
> Hi Team,
>
> Currently I was helping a team in building rest based services using CXF. I
> noticed that for bean based service arguments (*Ex. String
> getData(@FormParam("") TestObj tObj)*)
> you have to include @FormParam with empty qualifer name and the request
> parameter should follow bean property naming conventions. Say example
> if TestObj has a property 'userName' (which is java style) then the request
> parameter should be userName=Joe.
> But in our requirement (mostly everywhere) the request parameters need not
> use the Java Style. Here we were asked to use 'user.name'.
>
> I know for non-bean based parameters CXF supports this as @FormParam("
> user.name") String userName, Is this possible for Bean Based also?
>
> As part of providing solution to team, I wrote a CXF Request Handler,
> which transforms all the request based parmeters to bean based.
> Now the TestObj will looks like,
> class TestObject {
>       @RequestParam("user.name")
>       String userName;
> ...
> }
> Using the @ReuestParam I will be identifying the actual request param.
> The component I wrote supports primitives, nested beans and collections
> also.
>
That is interesting, however I think your requirement can already be handled:

public class TestObject {
    public User getUser() {
         return new User();
    }
    public void setUser(User user) {}
}

public class User {
    public String getName() {
         return name;
    }
    public void setName(String name) {}
}

That is more verbose that your solution but the user who contributed
the patch earlier on did a lot of work for nested beans to work, with
collections supported as well. And no extra annotations is required.

Another option is just use MultivaluedMap in case of form submissions
or explicit FormParam("user.name")

What do you think ?


Cheers, Sergey

> *My Suggestion is can you include this feature in next version of CXF? and
> Can I contribute my code?*
>
> Biju B
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com