You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Obele, Azubuko" <Az...@morganstanleysmithbarney.com> on 2010/08/02 16:26:32 UTC

RE: Bug in CXF JAXRS Client Proxy

Sergey, 

Can you please create a jira issue for this? I'll try and take a look at it sometime this week and if I have time post a fix and submit it to jira.

Thanks 

-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] 
Sent: Thursday, July 29, 2010 1:49 PM
To: users@cxf.apache.org
Cc: Lo, James (GWMG Risk)
Subject: Re: Bug in CXF JAXRS Client Proxy

Hi

On Thu, Jul 29, 2010 at 2:30 PM, Obele, Azubuko < Azubuko.Obele@morganstanleysmithbarney.com> wrote:

> Sergey,
>
> Could you point me to the client proxy code that does parameter 
> translation for collections? Perhaps we could fix it ourselves?
>
> Cool...

Have a look please at ClientProxyImpl and get to

addParametersToBuilder() method.

there's a branch there

if (!"".equals(paramName)) {
            addToBuilder(ub, paramName, pValue, pt); }

I think it has to be something like :

if (!"".equals(paramName)) {
       if (InjectionUtils.isSupportedCollectionOrArray(pValue.getClass())) {
            // cast pValue to Collection and for every member
            addToBuilder(ub, paramName, pValue, pt);
       } else {
            addToBuilder(ub, paramName, pValue, pt);
       }
}

give it a try please

thanks, Sergey

-----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Wednesday, July 28, 2010 4:47 PM
> To: users@cxf.apache.org
> Subject: Re: Bug in CXF JAXRS Client Proxy
>
> Hi
>
> On Wed, Jul 28, 2010 at 3:31 PM, Obele, Azubuko < 
> Azubuko.Obele@morganstanleysmithbarney.com> wrote:
>
> > Hey all,
> >
> > We seem to have uncovered a strange bug in the CXF JAXRS client. We 
> > have a service method defined as:
> >
> >    @GET
> >    @Path("/test")
> >    @Transactional
> >    public List<Entry> testFind(@QueryParam("tags") List<Long> tag) {
> >        ...
> >    }
> >
> > We can manually invoke this method through the browser by going to 
> > the url 'service?tag=1&tag=2&tag=3' . The CXF JAXRS implementation 
> > will correctly decode this request, construct the List of Longs, and 
> > then invoke our service method.
> >
> > The problem arises when we try to use the JAXRS client proxy. When 
> > we do this"
> >
> >   bel = services.testFind(Arrays.asList(100L, 101L, 102L)); This 
> > generates the HTTP request:
> >
> > /services/blog/test?tag=%5B100%2C+101%2C+102%5D]
> >
> > The JAXRS impl at this point doesn't know how to route this request 
> > and the result is a 404. Any ideas? Is this a bug in the CXF JAXRS 
> > Client
> Proxy?
> >
> >
> Definitely a bug or may be a limitation :-). Proxy does not treat 
> collections as they should be, it just uses toString() so the above 
> encode sequence is most likely representing an encoded list.toString()
>
> cheers, Sergey
>
>
> > Thanks,
> >
> > --------------------------------------------------------------------
> > --
> > ----
> > Important Notice to Recipients:
> >
> > It is important that you do not use e-mail to request, authorize or 
> > effect the purchase or sale of any security or commodity, to send 
> > fund transfer instructions, or to effect any other transactions. Any 
> > such request, orders, or instructions that you send will not be 
> > accepted and will not be processed by Morgan Stanley Smith Barney.
> >
> > The sender of this e-mail is an employee of Morgan Stanley Smith 
> > Barney LLC. If you have received this communication in error, please 
> > destroy all electronic and paper copies and notify the sender 
> > immediately.  Erroneous transmission is not intended to waive 
> > confidentiality or privilege. Morgan Stanley Smith Barney reserves 
> > the right, to the extent permitted under applicable law, to monitor 
> > electronic communications. By e-mailing with Morgan Stanley Smith 
> > Barney
> you consent to the foregoing.
> >
>
> ----------------------------------------------------------------------
> ----
> Important Notice to Recipients:
>
> It is important that you do not use e-mail to request, authorize or 
> effect the purchase or sale of any security or commodity, to send fund 
> transfer instructions, or to effect any other transactions. Any such 
> request, orders, or instructions that you send will not be accepted 
> and will not be processed by Morgan Stanley Smith Barney.
>
> The sender of this e-mail is an employee of Morgan Stanley Smith 
> Barney LLC. If you have received this communication in error, please 
> destroy all electronic and paper copies and notify the sender 
> immediately.  Erroneous transmission is not intended to waive 
> confidentiality or privilege. Morgan Stanley Smith Barney reserves the 
> right, to the extent permitted under applicable law, to monitor 
> electronic communications. By e-mailing with Morgan Stanley Smith Barney you consent to the foregoing.
>

--------------------------------------------------------------------------
Important Notice to Recipients:
 
It is important that you do not use e-mail to request, authorize or effect the purchase or sale of any security or commodity, to send fund transfer instructions, or to effect any other transactions. Any such request, orders, or instructions that you send will not be accepted and will not be processed by Morgan Stanley Smith Barney.
 
The sender of this e-mail is an employee of Morgan Stanley Smith Barney LLC. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately.  Erroneous transmission is not intended to waive confidentiality or privilege. Morgan Stanley Smith Barney reserves the right, to the extent permitted under applicable law, to monitor electronic communications. By e-mailing with Morgan Stanley Smith Barney you consent to the foregoing.

Re: Bug in CXF JAXRS Client Proxy

Posted by Sergey Beryozkin <sb...@gmail.com>.
Sorry for a delay :

https://issues.apache.org/jira/browse/CXF-2958

if you could verify the fix suggested in the JIRA then it would help

cheers, Sergey

On Mon, Aug 2, 2010 at 3:26 PM, Obele, Azubuko <
Azubuko.Obele@morganstanleysmithbarney.com> wrote:

> Sergey,
>
> Can you please create a jira issue for this? I'll try and take a look at it
> sometime this week and if I have time post a fix and submit it to jira.
>
> Thanks
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Thursday, July 29, 2010 1:49 PM
> To: users@cxf.apache.org
> Cc: Lo, James (GWMG Risk)
> Subject: Re: Bug in CXF JAXRS Client Proxy
>
> Hi
>
> On Thu, Jul 29, 2010 at 2:30 PM, Obele, Azubuko <
> Azubuko.Obele@morganstanleysmithbarney.com> wrote:
>
> > Sergey,
> >
> > Could you point me to the client proxy code that does parameter
> > translation for collections? Perhaps we could fix it ourselves?
> >
> > Cool...
>
> Have a look please at ClientProxyImpl and get to
>
> addParametersToBuilder() method.
>
> there's a branch there
>
> if (!"".equals(paramName)) {
>            addToBuilder(ub, paramName, pValue, pt); }
>
> I think it has to be something like :
>
> if (!"".equals(paramName)) {
>       if (InjectionUtils.isSupportedCollectionOrArray(pValue.getClass())) {
>            // cast pValue to Collection and for every member
>            addToBuilder(ub, paramName, pValue, pt);
>       } else {
>            addToBuilder(ub, paramName, pValue, pt);
>       }
> }
>
> give it a try please
>
> thanks, Sergey
>
> -----Original Message-----
> > From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> > Sent: Wednesday, July 28, 2010 4:47 PM
> > To: users@cxf.apache.org
> > Subject: Re: Bug in CXF JAXRS Client Proxy
> >
> > Hi
> >
> > On Wed, Jul 28, 2010 at 3:31 PM, Obele, Azubuko <
> > Azubuko.Obele@morganstanleysmithbarney.com> wrote:
> >
> > > Hey all,
> > >
> > > We seem to have uncovered a strange bug in the CXF JAXRS client. We
> > > have a service method defined as:
> > >
> > >    @GET
> > >    @Path("/test")
> > >    @Transactional
> > >    public List<Entry> testFind(@QueryParam("tags") List<Long> tag) {
> > >        ...
> > >    }
> > >
> > > We can manually invoke this method through the browser by going to
> > > the url 'service?tag=1&tag=2&tag=3' . The CXF JAXRS implementation
> > > will correctly decode this request, construct the List of Longs, and
> > > then invoke our service method.
> > >
> > > The problem arises when we try to use the JAXRS client proxy. When
> > > we do this"
> > >
> > >   bel = services.testFind(Arrays.asList(100L, 101L, 102L)); This
> > > generates the HTTP request:
> > >
> > > /services/blog/test?tag=%5B100%2C+101%2C+102%5D]
> > >
> > > The JAXRS impl at this point doesn't know how to route this request
> > > and the result is a 404. Any ideas? Is this a bug in the CXF JAXRS
> > > Client
> > Proxy?
> > >
> > >
> > Definitely a bug or may be a limitation :-). Proxy does not treat
> > collections as they should be, it just uses toString() so the above
> > encode sequence is most likely representing an encoded list.toString()
> >
> > cheers, Sergey
> >
> >
> > > Thanks,
> > >
> > > --------------------------------------------------------------------
> > > --
> > > ----
> > > Important Notice to Recipients:
> > >
> > > It is important that you do not use e-mail to request, authorize or
> > > effect the purchase or sale of any security or commodity, to send
> > > fund transfer instructions, or to effect any other transactions. Any
> > > such request, orders, or instructions that you send will not be
> > > accepted and will not be processed by Morgan Stanley Smith Barney.
> > >
> > > The sender of this e-mail is an employee of Morgan Stanley Smith
> > > Barney LLC. If you have received this communication in error, please
> > > destroy all electronic and paper copies and notify the sender
> > > immediately.  Erroneous transmission is not intended to waive
> > > confidentiality or privilege. Morgan Stanley Smith Barney reserves
> > > the right, to the extent permitted under applicable law, to monitor
> > > electronic communications. By e-mailing with Morgan Stanley Smith
> > > Barney
> > you consent to the foregoing.
> > >
> >
> > ----------------------------------------------------------------------
> > ----
> > Important Notice to Recipients:
> >
> > It is important that you do not use e-mail to request, authorize or
> > effect the purchase or sale of any security or commodity, to send fund
> > transfer instructions, or to effect any other transactions. Any such
> > request, orders, or instructions that you send will not be accepted
> > and will not be processed by Morgan Stanley Smith Barney.
> >
> > The sender of this e-mail is an employee of Morgan Stanley Smith
> > Barney LLC. If you have received this communication in error, please
> > destroy all electronic and paper copies and notify the sender
> > immediately.  Erroneous transmission is not intended to waive
> > confidentiality or privilege. Morgan Stanley Smith Barney reserves the
> > right, to the extent permitted under applicable law, to monitor
> > electronic communications. By e-mailing with Morgan Stanley Smith Barney
> you consent to the foregoing.
> >
>
> --------------------------------------------------------------------------
> Important Notice to Recipients:
>
> It is important that you do not use e-mail to request, authorize or effect
> the purchase or sale of any security or commodity, to send fund transfer
> instructions, or to effect any other transactions. Any such request, orders,
> or instructions that you send will not be accepted and will not be processed
> by Morgan Stanley Smith Barney.
>
> The sender of this e-mail is an employee of Morgan Stanley Smith Barney
> LLC. If you have received this communication in error, please destroy all
> electronic and paper copies and notify the sender immediately.  Erroneous
> transmission is not intended to waive confidentiality or privilege. Morgan
> Stanley Smith Barney reserves the right, to the extent permitted under
> applicable law, to monitor electronic communications. By e-mailing with
> Morgan Stanley Smith Barney you consent to the foregoing.
>