Just one more example, assuming the following requirement :
"/patients/{dataSourceType}/{id}/{lastName}/{firstName}"
you can do something like
@GET
@Path("/patients/{dataSourceType}/{id}/{lastName}/{firstName}")
public Patient getPatient(@PathParam("dataSourceType") DataSourceEnum type,
@PathParam("id") long id,
@PathParam("lastName") String
lName, @PathParam("firstName") String fName) {}
You may also want to use @QueryParam, etc. CXF specific extension allows
collapsing all the parameters in a single bean, ex,
@Path("/patients/{dataSourceType}/")
public Patient getPatient(@PathParam("dataSourceType") DataSourceEnum type,
@QueryParam("") PatientBean) {}
where PatientBean has id, lastName & firstName properties
Cheers, Sergey
On Tue, Jan 25, 2011 at 10:01 AM, Sergey Beryozkin <[email protected]>wrote:
> Hi
>
> On Mon, Jan 24, 2011 at 8:10 PM, myerscb <[email protected]> wrote:
>
>>
>> Sergey,
>>
>> Thanks for you help so far.
>>
>> Do you have a link to an example that combines both JAX-WS and JAX-RS? I
>> would like to try and give that a go. (like maybe the restful-http-binding
>> example but done with jax-ws and jax-rs)
>>
>> The Talend-SF distribution has jaxrs_jaxws_java_first and
> jaxrs_jaxws_description_first demos :
> http://www.talend.com/resources/documentation.php#SF
>
> Here is a test interface used in the system tests :
>
>
> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreJaxrsJaxws.java
>
> So you can have a single bean implementing this interface and referenced
> from as many endpoints as you need (jaxrs:server & jaxws:endpoint), these
> endpoints should only have different address values, ex, "/jaxws" &
> "/jaxrs".
> I've been actually thinking of enhancing the CXF code a bit to ensure that
> registering multiple endpoints with the same address can work too and then
> have the requests properly dispatched depending on whether it's a soap
> request or not, did not have time to get to it though.
>
>
>> Going back to the multiple parameter question, i will be needing to pass
>> multiple parameters. with http binding i am just making them part of the
>> path ie: @HttpResource(location =
>> "/patients/{dataSourceType}/{id}/{lastName}/{firstName}")
>>
>> JAX-RS supports it is all, it uses @Path for the uri fragments.
> I was more referring to method parameters. Ex, if you have a schema element
> 'Customer' with id & name string simple elements then having a method like
>
> @POST
> void addCustomer(String name, String address) {}
>
> won't work in JAX-RS.
>
> But you can have
>
> @POST
> void addCustomer(Customer c, @HeaderParam("custom-header") String header)
> {}
>
> etc...
>
> Cheers, Sergey
>
>
>> Thanks again,
>>
>> Chris
>> --
>> View this message in context:
>> http://cxf.547215.n5.nabble.com/IllegalAnnotationExceptions-when-running-Restful-Http-Binding-Demo-tp3349642p3355206.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
>