Here is one from the RI.

   @GET
   @ProduceMime("*/*")
   public Response get(@QueryParam("format") String format) {
       return Response.ok("Hello World", format).build();
   }

Arul

Coder One wrote:
Do you have a sample on QueryParam?

Thanks

--- On Thu, 5/29/08, Sergey Beryozkin <[EMAIL PROTECTED]> wrote:

From: Sergey Beryozkin <[EMAIL PROTECTED]>
Subject: Re: Really the Real One -- CXF 2.1 and REST Annotation
To: users@cxf.apache.org, [EMAIL PROTECTED]
Date: Thursday, May 29, 2008, 2:32 AM
Hi

JAX-RS provides a very flexible mechanism for matching URIs
to classes and methods, courtesy of its matching algorithm
and the URiTemplate spec.
The matching starts from the root resource class which
contains the initial Path declaration. So if you say have
an existing JAXWS class then this should work :

@Path("/")
class WebServiceClass {
}

@GET
@Path("getAlertMsg/{areq}")
@ProduceMime("application/json")
public GetMsgRsp getAlertMsg(@PathParam("aReq")
GetMsgReq aReq)
{ .....
}

getAlertMsg will handle requests like /getAlertMsg/1,
/getAlertMsg/2. Here the {areg} template parameter in the
method Path annotation will be matched against a method
parameter annotated with a matching @PathParam  annotation.
You can also use @QueryParam to apply query parameters to
method params, etc.

If you'd like to reuse existing types like GetMsgReq
then the only way for them be used at the moment as holders
of the URI/Query parameters is for type like GetMsgReq to
either have a constructor with String arg or a static
valueOf(String) method.

If you'd like to reuse a type like GetMsgReq aReq to,
say, read from the request input stream (note, no param
annotation) :
public GetMsgRsp getAlertMsg(GetMsgReq aReq) {
}

then either JAXB needs to be involved ot a custom message
reader needs to be created and registered.

You should be be able to use JSON and JAX-RS to relay your
GWT messages to/from a CXF service, some fixes might need
to be applied though to CXF, give it a try and lets see
what happens...

Hope it helps
Sergey


----- Original Message ----- From: "Coder One" <[EMAIL PROTECTED]>
To: <users@cxf.apache.org>
Sent: Thursday, May 29, 2008 1:56 AM
Subject: Really the Real One -- CXF 2.1 and REST Annotation


My apologies...not sure why YHOO EMAIL decided to send out
half a dozen messages...in the wrong encoding...I am now
going with plain old text just to be sure...

So my GetMsgReq class contains multiple properties like id,
name, description, etc...
How do I actually form the URL that I can simply paste into
a browser and try? Thanks...

@GET
@Path("getAlertMsg")
@ProduceMime("application/json")
public GetMsgRsp getAlertMsg(@PathParam("aReq")
GetMsgReq aReq)
{ .....
}

Thanks!!!



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



________________________________
Scanned by MessageLabs for Flux
________________________________

Reply via email to