users@jersey.java.net

Re: [Jersey] Re: Including Folder path as a URI variable

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Fri, 12 Mar 2010 11:26:58 +0100

Depends on your case - if both params are really paths and you plan
handle them same way, I don't see a problem with having single method.

If you need to process them differently, you should have additional
method(s), ideally differentiated by path segment - something like this:

@Path("/files/{filename}")
method1(@PathParam("filename") ... ) {
}

@Path("/somethingDifferent/{idOrWhatever}")
method2(@PathParam("idOrWhatever") ... ) {
}

Or you can modify regex for parameters so method can be chosen according
to that without having additional path segment (in your case: one method
accepting only numbers and another accepting everything else)..


Pavel


emile wrote:
> Hi Pavel,
>
> Tried reading up on the links you've provided. Trying to find a solution for
> a problem we have. We are passing a path parameter that may have values such
> as '/Temp/bin' or '3232737'. I'm not sure if its feasible to have a single
> method to capture both scenarios. Any pointers on this?
>
> Thanks & Regards,
> Pavel
>