users@jersey.java.net

RE: [Jersey] Multiple HTTP methods per resource method

From: Jeremy Whitlock <jwhitlock_at_collab.net>
Date: Fri, 14 Nov 2008 11:28:29 -0800

> Its more philosophical than technical. The semantics of HTTP methods
> differ and servicing multiple HTTP methods via a single Java method
> could lead to their conflation. The JAX-RS spec disallows multiple
> method designators on a single Java method.

Good point.

> As a general rule of thumb try to avoid verbs in URIs (create in the
> above) otherwise you can find yourself following an RPC-oriented
design.

Thanks for the tip.

> A common pattern is to use POST to create resources when the server is
> in charge of the URI space and PUT to create resources when the client
> is in charge of the URI space (within reason). So, e.g., you could
> POST /person to create a new person resource, the server assigns the
> new resource an identifier and then returns a "see other" status with
> the URI of the newly created resource in the Location header.

So would this mean that I need to have a PUT and a POST method that
basically do the same thing?