@DefaultValue annotation



You can also set a @DefaultValue annotation to provide the default value for a parameter you are expecting. The default value is used if the corresponding parameter is not available in the request.

@Path("/item")
public class ItemRestService {

@GET
public Items getItemsByPrice(@DefaultValue("50") @QueryParam("price") int      
        price) {
 
}

@GET
public Customers getItemsByCity(@DefaultValue("Anand") 
       @MatrixParam("city")  String city) {
 
}
}