Thursday, 16 May 2013

JAX-RS @Path URI Matching Example - RESTful web service

JAX-RS @Path URI Matching Example - RESTful web service

JAX-RS @Path URI Matching Example - RESTful web service


In JAX-RS you can use the @Path annotation to bind the URI pattern to java method
First We see the simple URL Pattern matching with @Path annotation
Simple URI Matching Pattern

URI Matching and Request Parameter
The value within open brace "{" and close brace "}" represent a parameter and can be
acessed using @PathParam annotation for example.

URI Matching and Regular Expression
@Path support complex URI matching with regular expression, via following expression
{" variable-name [ ":" regular-expression ] "}

@PathParam with multiple parameters
This example show how to inject multiple parameters into a java method

No comments:

Post a Comment