cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: Custom Reuqest Param Name for Bean Request Object
Date Tue, 10 May 2011 20:22:58 GMT

Please see comments inline

On Tue, May 10, 2011 at 8:29 PM, Biju Nair <> 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 ''.
> I know for non-bean based parameters CXF supports this as @FormParam("
>") 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("")
>       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("")

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

View raw message