On Sep 13, 2010, at 4:46 PM, tofferliu wrote:
>
> Hi,
>
> I only skimmed through the javadoc and it doesn't seem to be what I'm
> looking for. Will look at it again later.
>
>
> Basically what I'm looking for is if I'm sending a request:
>
> http://www.foo.com/me/arg12'3
>
> and I have
>
> @Path("me/{arg}")
> @Get
> public String doIt(PathParam("arg") String filtered) {
> return filtered;
> }
>
OK, from what you say the filter approach is not appropriate.
> I want to be able to remove the single quote from the path argument
> before
> it gets passed to filtered. So the method should just return "arg123".
>
The easiest thing to do is create your own type, FilteredString
public class FilteredString {
public final s;
public FilteredString(String s) {
this.s = filter(s);
}
}
@Path("me/{arg}")
@Get
public String doIt(PathParam("arg") FilteredString filtered) {
return filtered;
}
Otherwise if using a DI framework like Guice you can do some AOP
method interception.
Paul.