<chapter id="_NewParam">
<title>Improved <code>@…Param</code> annotations</title>

<para>
    The &REST-API; specification defines annotations <code>@PathParam</code>, <code>@QueryParam</code>,
    <code>@FormParam</code>, <code>@CookieParam</code>, <code>@HeaderParam</code> and <code>@MatrixParam</code>.  Each annontation
    requires a parameter name.  RESTEasy provides a parallel set of annotations,
    <link linkend="_PathParam"><code>@PathParam</code></link>,
    <link linkend="_QueryParam"><code>@QueryParam</code></link>,
    <link linkend="_FormParam"><code>@FormParam</code></link>,
    <link linkend="_CookieParam"><code>@CookieParam</code></link>,
    <link linkend="_HeaderParam"><code>@HeaderParam</code></link>
    and <link linkend="_MatrixParam"><code>@MatrixParam</code></link>
    which do not require a parameter name.   To use this RESTEasy feature, replace the
    annotation's package name, <code>jakarta.ws.rs</code> with,
    <code>org.jboss.resteasy.annotations.jaxrs</code>.
</para>
<para>
Note that you can omit the annotation name for annotated method parameters as well as annotated fields or JavaBean properties.
</para>

<para>Usage:</para>
<programlisting>
import org.jboss.resteasy.annotations.jaxrs.*;

@Path("/library")
public class Library {

   @GET
   @Path("/book/{isbn}")
   public String getBook(@PathParam String isbn) {
      // search my database and get a string representation and return it
   }
}
</programlisting>

<para>If an annotated variable does not have the same name as the path parameter, the name can still
be specified:</para>
<programlisting>
import org.jboss.resteasy.annotations.jaxrs.*;

@Path("/library")
public class Library {

   @GET
   @Path("/book/{isbn}")
   public String getBook(@PathParam("isbn") String id) {
      // search my database and get a string representation and return it
   }
}
</programlisting>
</chapter>
