JAX-RS (REST)No Comments

In JAX-RS, you can use @PathParam to inject the value of URI parameter that defined in @Path expression, into Java method.

  • @PathParam – Single Parameter

A simple and normal way to use @PathParam.

In above example, the value of {id} from “/users/{id}” will match to “@PathParam(“id”) String var“.

URI Pattern : “/users/22667788

  • @PathParam – Multiple Parameters

Example to inject multiple parameters into Java method.

URI Pattern : “/users/2011/06/30

Be the first to post a comment.

Add a comment