users@jersey.java.net

_at_Path regex? URI fragment validation?

From: Rabick, Mark A (MS) <"Rabick,>
Date: Tue, 24 Feb 2009 18:01:07 -0600

I was just looking at the article referenced from the Jersey Wiki

http://www.javarants.com/2008/12/25/using-jax-rs-jersey-to-build-a-jpaja
xb-backed-json-rest-api/

    @GET
    @Produces("application/json")
    @Path("/network/{id: [0-9]+}/{nid}")
    public User getUserByNetworkId(@PathParam("id") int id,
                                   @PathParam("nid") String networkId)
    {
        Query q = em.createQuery("SELECT u FROM User u WHERE
                                 u.networkId = :id AND u.networkUserId =
:nid");
        q.setParameter("id", id);
        q.setParameter("nid", networkId);
        return (User) q.getSingleResult();
    }

Is the {id: [0-9]+} notation in the @Path statement a regex? Will it
only 'accept' or bind the resource if the id parameter is all digits?
What happens if the uri requested is /network/99AAAA/someNid?
Will it cause an error in the URI parser because the @PathParam id is an
'int'?

Is there some documentation that describes the available filtering at
the URI fragment or
Query parameter level?

--mark
_______________________________________________
Mark A. Rabick
Software Engineer
Northrop Grumman - C2 Systems (MS/C2SD/IIS)
3200 Samson Way
Bellevue, NE 68123
Ph: (402) 293-7091
Em: mark.rabick_at_ngc.com
Remember PFC Ross A. McGinnis...
  http://www.army.mil/medalofhonor/McGinnis/index.html
... MA2 Michael A. Monsoor, Lt. Michael P. Murphy, Cpl. Jason Dunham,
SFC Paul Ray Smith and the rest...
  http://www.cmohs.org/recipients/most_recent.htm