On May 6, 2009, at 11:07 PM, Rabick, Mark A (IS) wrote:
> I would like to specify in the pattern of a path fragment
> declaration 3 possible literal values. Ie. (ALPHA, BRAVO, or CHARLIE)
>
> @GET @Path("{segment: <What do I put here?>}")
> @Produces("application/xml")
> Public Item getItemBySegment(@PathParam("segment") String segment) {
> /*
> * stuff
> */
> }
>
> Only the values above are legitimate. Is it possible to use the
> Path pattern to allow only those string values as opposed to doing
> it inside the method?
>
You can specify a regex, i think the following will work:
@Path("{segment: (ALPHA|BRAVO|CHARLIE)}")
The above is hard to see but the path fragments are separated by a '|'
character.
Paul.
> --mark
> _______________________________________________
> Mark A. Rabick
> Software Engineer
> Northrop Grumman - Integrated Mission Systems (IS/DSD/IMS)
> 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
>
>