You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Freeman Fang <fr...@iona.com> on 2007/06/01 04:03:56 UTC

Re: Problem matching URI templates with RESTful binding

Hi Adrian,

It's weird, I can't reproduce your problem.
Your code seems correct to me.

What's your Contacts.java and Contact.java looks like.
Please send me your entire testcase if possible.

Thanks very much

Freeman


Trenaman, Adrian wrote:
> Hi there,
>  
> Does anyone know if there's some problems with RESTful bindings in CXF?
> I'm writing an app around the info on the wiki page - it's a RESTful
> addressbook application. Am attaching key classes ContactService and
> GetContact (the bean for the getContact parameters, i.e., the ID) below.
>  
> When I use the following URL
>  
>  http://localhost:9000/xml/contacts
>  
> I get what I expect: an XML file like this: 
>  
>  <ns4:Contacts 
>   xmlns:ns4="http://easyrest/" 
>   xmlns:ns3="http://www.iona.com/demo/contact" 
>   xmlns:ns2="http://www.w3.org/2005/08/addressing/wsdl">
>   <contact />
>  </ns4:Contacts>
>  
> However, when I use  
>  
>  http://localhost:9000/xml/contacts/123
>  
> ... I get the same response as the original URL without the '/123'
> suffix. It's as if the URI template isn't getting matched, and instead
> the whole thing is going to the original URL.
>  
> Anyone got any ideas on this?
>  
> Thanks,
> Ade.
>  
> -----
>  
>  
>
> @WebService
> public interface ContactService {
>  
>  @Get
>  @HttpResource(location="/contacts")
>      @WebResult(name = "Contacts")
>  Contacts getContacts();
>  
>  @Get
>  @HttpResource(location="/contacts/{id}")
>  Contact getContact(GetContact params); 
>  
> }
>  
> public class GetContact {
>  
>  String id;
>  
>  public String getId() {
>   return id;
>  }
>  
>  public void setId(String id) {
>   this.id = id;
>  }
>  
> }
>  
>  
>
>