users@jsr311.java.net

Re: PathParam and slashes

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 25 Aug 2008 15:11:22 +0200

Hi Denis,

With the 0.10 API you can do this:

@Path("foo")
public class MyClass {
     @GET
     @Path("{myparam: .+}")
     public String getPath(@PathParam("myparam") String myparam) {
         return myparam;
     }
}

You can declare a regex, as above, which overrides the default regex of
"[^/]+?". In previous versions of the API the @Path.limited parameter
enabled similar functionality.

You can try out the regex functionality in the latest 0.10-ea-SNAPSHOT
of the RI.

Paul.

Denis wrote:
> Hi all,
>
> Is it possible to PathParam annotation to get params which include "/"?
>
> For instance, if I wrote something like that:
>
> @Path(/foo)
> public class MyClass {
> @Path("/{myparam}")
> public void aMethod(@PathParam("myparam") String myparam) {
> System.out.println(myparam);
> }
> }
>
> and I use that url: http://localhost/foo/a/param/with/slashes
> I want to the String myparam set to "a/param/with/slashes"
>
> --
> Denis
>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109