@Path and regular expression (Jersey/REST)

Posted by Castanho on Stack Overflow See other posts from Stack Overflow or by Castanho
Published on 2010-05-31T21:02:03Z Indexed on 2010/05/31 21:03 UTC
Read the original article Hit count: 125

Filed under:
|
|
|

Hi there!

I'm using Jersey in a REST project and I'm needing to use regular expression.

Digging about it is simple like:

@Path("/resources)
public class MyResource {

   @GET
   @Path("{subResources:.*}/bar")
   public String get() {...}
}

But, I'm only capable of using regex if in my @Path contains a variable or text value, example:

@Path("{SubResource1}/{subResources:.*}/bar")

Or

@Path("hardCodeString/{subResources:.*}/bar")

Today I could run with this solution of a variable, but is not oK for my perspective.

Question

  • Does anyone have worked with something related?
  • I'm doing something wrong?
  • I think that this could be a bug, when working with more then one @Path, one in the Class and other in the Method.
  • Any tips is appreciated!

Regards

© Stack Overflow or respective owner

Related posts about java

Related posts about regex