users@jersey.java.net

Use of _at_HttpMethod and _at_Encoded

From: Rohan Sahgal <rohansahgal_at_gmail.com>
Date: Tue, 10 Jun 2008 17:24:30 -0700

Hi,
I was just seeing the JAX-RS api and its spec.

For @HttpMethod the api reads "A Java method annotated with a runtime
annotation that is itself annotated with this annotation will be used to
handle HTTP requests of the indicated HTTP method".
Does this mean that say I have an annotation MyAnnotation, I can now
@MyAnnotation instead of @GET (or any other http method). Can someone give a
small example of the syntax, I cannot find it used in any of the examples.
Is the purpose of this annotation to somehow extend the functionality of
@GET?

@Encoded is to disable decoding for parameters. Does this mean that say I
have a method that echo's back a string that is sent in the URL, if now I
annotate that method with @Encoded it will no longer decode it, even if I
pass it in the URL?

    @GET
    @ProduceMime("text/plain")
    @Path("echo")
    @Encoded
    public String echo(@DefaultValue("no string sent")
@QueryParam("string")String echoString){
        return echoString;
    }

Then will this method always return "no string sent".

Sorry I am unsure of the annotations to use in my application and wanted to
understand all of them before deciding on the design, I could not find these
two used in any of the samples.

Thanks,
Rohan