You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Chico Charlesworth <ch...@googlemail.com> on 2008/04/04 10:21:24 UTC

How can I use Long instead of String for @PathParam?


When I try to map @PathParam to a Long, I get this exception -
java.lang.IllegalArgumentException: argument type mismatch.

Am I missing something? How can I use Long instead of String for @PathParam?

Cheers
Chico
-- 
View this message in context: http://www.nabble.com/How-can-I-use-Long-instead-of-String-for-%40PathParam--tp16488180p16488180.html
Sent from the cxf-dev mailing list archive at Nabble.com.


Re: How can I use Long instead of String for @PathParam?

Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
On Apr 15, 2008, at 6:56 AM, Daniel Kulp wrote:

> On Tuesday 15 April 2008, Alan D. Cabrera wrote:
>> On Apr 4, 2008, at 9:29 AM, Sergey Beryozkin wrote:
>>> Hi Chico
>>>
>>>> Great, thanks for the update. Is there a page documenting what is
>>>> left to be
>>>> done for the JAX-RS implementation? Or what features are currently
>>>> missing?
>>>
>>> I'll update the CXF docs shortly...
>>
>> Where are these docs?
>>
>>
>> Regards,
>> Alan
>
> I assume:
> http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html

I don't think that I see a TBD section.   Just curious.

BTW, this stuff rocks!


Regards,
Alan


Re: How can I use Long instead of String for @PathParam?

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 15 April 2008, Alan D. Cabrera wrote:
> On Apr 4, 2008, at 9:29 AM, Sergey Beryozkin wrote:
> > Hi Chico
> >
> >> Great, thanks for the update. Is there a page documenting what is
> >> left to be
> >> done for the JAX-RS implementation? Or what features are currently
> >> missing?
> >
> > I'll update the CXF docs shortly...
>
> Where are these docs?
>
>
> Regards,
> Alan

I assume:
http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: How can I use Long instead of String for @PathParam?

Posted by Sergey Beryozkin <se...@iona.com>.
http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html

By the way, the conversion to types like Long (constructors accepting String) is now supported. The annnotation 'inheritance' is also mostly supported, either form superclasses (class or method level) or interfaces (method level), except for parameter annotations like @PathParam. Using Spring AOP should be fine, pending the confirmation from Steve A.

Cheers, Sergey

----- Original Message ----- 
From: "Alan D. Cabrera" <li...@toolazydogs.com>
To: <cx...@incubator.apache.org>
Sent: Tuesday, April 15, 2008 2:51 PM
Subject: Re: How can I use Long instead of String for @PathParam?


> 
> On Apr 4, 2008, at 9:29 AM, Sergey Beryozkin wrote:
> 
>> Hi Chico
>>
>>
>>
>>>
>>> Great, thanks for the update. Is there a page documenting what is  
>>> left to be
>>> done for the JAX-RS implementation? Or what features are currently  
>>> missing?
>>
>> I'll update the CXF docs shortly...
> 
> Where are these docs?
> 
> 
> Regards,
> Alan

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: How can I use Long instead of String for @PathParam?

Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
On Apr 4, 2008, at 9:29 AM, Sergey Beryozkin wrote:

> Hi Chico
>
>
>
>>
>> Great, thanks for the update. Is there a page documenting what is  
>> left to be
>> done for the JAX-RS implementation? Or what features are currently  
>> missing?
>
> I'll update the CXF docs shortly...

Where are these docs?


Regards,
Alan


Re: How can I use Long instead of String for @PathParam?

Posted by Sergey Beryozkin <se...@iona.com>.
Hi Chico


 
> 
> Great, thanks for the update. Is there a page documenting what is left to be
> done for the JAX-RS implementation? Or what features are currently missing?

I'll update the CXF docs shortly...

> - Is there a better approach in returning collections? At the moment, a
> wrapper class which encapsulates the collection is needed so as to annotate
> it with a @XmlRootElement annotation, but would be nice if this wasn't
> necessary.

I've seen a hint from users at a Jersey list on how Collection<YourType> may get serialized.
The problem is that YourType gets erased at compile time so perhaps a solution similar to the one employed by Google Guice may be used. 

I reckon a much simpler option exists. We can update our JAXB provider to check if type is a Collection and if yes then
we can get the type of the first object in it (if any) and then check for a MessageWriters if any. The collection  itself needs to be presented somehow, so I'd sugest us introducing an annotation on the return type (suggesting name, namespace for it. perhaps reusing a JAXB annotation)...Some work will need to be done for it to happen, but it should work in principle

> - Ar the moment, Eclipse is failing to access the xsd schemas (e.g.
> http://cxf.apache.org/schemas/jaxws.xsd) and highlights an error for this. I

Sorry, not sure about this one, I think it's well known problem but I've never come across it myself

Cheers, Sergey


> 
> Also, a couple of other things I've come across:
> - Is there a better approach in returning collections? At the moment, a
> wrapper class which encapsulates the collection is needed so as to annotate
> it with a @XmlRootElement annotation, but would be nice if this wasn't
> necessary.
> - Ar the moment, Eclipse is failing to access the xsd schemas (e.g.
> http://cxf.apache.org/schemas/jaxws.xsd) and highlights an error for this. I
> see that http://cxf.apache.org is actually offline at the moment. Has it
> been replaced with something else?
> 
> Cheers
> Chico
> 
> 
> 
> 
> 
> Sergey Beryozkin wrote:
>> 
>> At the moment PathParams are assumed to be Strings. 
>> It's worth noting that until now the contributions to CXF JAX-RS were
>> focused on making it more functional, that is, for 80% of typical cases to
>> work. 
>> For ex, as far as PathParams are concerned, the spec mandates that if a
>> class (like Long) has valueOf(String) then this method need to be used (or
>> if it has a constructor accepting String). We basically ignored things
>> like that until now as the lack of support for such things would not be a
>> blocker and focused on making sure that Uri Templating works, subresources
>> work, etc. For ex, a simple workaround would be to have String as a type
>> of the path param and then do Long.valueOf in the code. 
>> 
>> At this stage of its lifecycle, CXf JAXRS needs a bit of polishing (for
>> ex, superclasses are not currently checked for @Path, Request impl does
>> not support IfModifiedSince and Variants, UriBuilderImpl is not complete).
>> I'm going to update the documentation and list few tasks which I would
>> encourage CXF JAX-RS users to consider taking on to help to push CXF JAXRS
>> implementation further.
>> 
>> As I promised earlier I'll have a look at at a proxy issue soon (possibly
>> these weekends), and I will probably fix this problem as well, as it's a
>> really simple one to deal with...
>> 
>> Cheers, Sergey
>> 
>>> 
>>> 
>>> When I try to map @PathParam to a Long, I get this exception -
>>> java.lang.IllegalArgumentException: argument type mismatch.
>>> 
>>> Am I missing something? How can I use Long instead of String for
>>> @PathParam?
>>> 
>>> Cheers
>>> Chico
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/How-can-I-use-Long-instead-of-String-for-%40PathParam--tp16488180p16488180.html
>>> Sent from the cxf-dev mailing list archive at Nabble.com.
>> 
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>> 
>> 
> 
> -- 
> View this message in context: http://www.nabble.com/How-can-I-use-Long-instead-of-String-for-%40PathParam--tp16488180p16492746.html
> Sent from the cxf-dev mailing list archive at Nabble.com.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: How can I use Long instead of String for @PathParam?

Posted by Chico Charlesworth <ch...@googlemail.com>.

Great, thanks for the update. Is there a page documenting what is left to be
done for the JAX-RS implementation? Or what features are currently missing?

Also, a couple of other things I've come across:
 - Is there a better approach in returning collections? At the moment, a
wrapper class which encapsulates the collection is needed so as to annotate
it with a @XmlRootElement annotation, but would be nice if this wasn't
necessary.
 - Ar the moment, Eclipse is failing to access the xsd schemas (e.g.
http://cxf.apache.org/schemas/jaxws.xsd) and highlights an error for this. I
see that http://cxf.apache.org is actually offline at the moment. Has it
been replaced with something else?

Cheers
Chico





Sergey Beryozkin wrote:
> 
> At the moment PathParams are assumed to be Strings. 
> It's worth noting that until now the contributions to CXF JAX-RS were
> focused on making it more functional, that is, for 80% of typical cases to
> work. 
> For ex, as far as PathParams are concerned, the spec mandates that if a
> class (like Long) has valueOf(String) then this method need to be used (or
> if it has a constructor accepting String). We basically ignored things
> like that until now as the lack of support for such things would not be a
> blocker and focused on making sure that Uri Templating works, subresources
> work, etc. For ex, a simple workaround would be to have String as a type
> of the path param and then do Long.valueOf in the code. 
> 
> At this stage of its lifecycle, CXf JAXRS needs a bit of polishing (for
> ex, superclasses are not currently checked for @Path, Request impl does
> not support IfModifiedSince and Variants, UriBuilderImpl is not complete).
> I'm going to update the documentation and list few tasks which I would
> encourage CXF JAX-RS users to consider taking on to help to push CXF JAXRS
> implementation further.
> 
> As I promised earlier I'll have a look at at a proxy issue soon (possibly
> these weekends), and I will probably fix this problem as well, as it's a
> really simple one to deal with...
> 
> Cheers, Sergey
> 
>> 
>> 
>> When I try to map @PathParam to a Long, I get this exception -
>> java.lang.IllegalArgumentException: argument type mismatch.
>> 
>> Am I missing something? How can I use Long instead of String for
>> @PathParam?
>> 
>> Cheers
>> Chico
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-can-I-use-Long-instead-of-String-for-%40PathParam--tp16488180p16488180.html
>> Sent from the cxf-dev mailing list archive at Nabble.com.
> 
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> 
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-use-Long-instead-of-String-for-%40PathParam--tp16488180p16492746.html
Sent from the cxf-dev mailing list archive at Nabble.com.


Re: How can I use Long instead of String for @PathParam?

Posted by Sergey Beryozkin <se...@iona.com>.
At the moment PathParams are assumed to be Strings. 
It's worth noting that until now the contributions to CXF JAX-RS were focused on making it more functional, that is, for 80% of typical cases to work. 
For ex, as far as PathParams are concerned, the spec mandates that if a class (like Long) has valueOf(String) then this method need to be used (or if it has a constructor accepting String). We basically ignored things like that until now as the lack of support for such things would not be a blocker and focused on making sure that Uri Templating works, subresources work, etc. For ex, a simple workaround would be to have String as a type of the path param and then do Long.valueOf in the code. 

At this stage of its lifecycle, CXf JAXRS needs a bit of polishing (for ex, superclasses are not currently checked for @Path, Request impl does not support IfModifiedSince and Variants, UriBuilderImpl is not complete). I'm going to update the documentation and list few tasks which I would encourage CXF JAX-RS users to consider taking on to help to push CXF JAXRS implementation further.

As I promised earlier I'll have a look at at a proxy issue soon (possibly these weekends), and I will probably fix this problem as well, as it's a really simple one to deal with...

Cheers, Sergey

> 
> 
> When I try to map @PathParam to a Long, I get this exception -
> java.lang.IllegalArgumentException: argument type mismatch.
> 
> Am I missing something? How can I use Long instead of String for @PathParam?
> 
> Cheers
> Chico
> -- 
> View this message in context: http://www.nabble.com/How-can-I-use-Long-instead-of-String-for-%40PathParam--tp16488180p16488180.html
> Sent from the cxf-dev mailing list archive at Nabble.com.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland