I am newbie in RESTful jersey. I would like to ask what is the different between @PathParam
and @QueryParam
in jersey?
相关问题
- Design RESTful service with multiple ids
- Axios OPTIONS instead of POST Request. Express Res
- Plain (non-HTML) error pages in REST api
- Laravel 5.1 MethodNotAllowedHttpException on store
- org.glassfish.jersey.server.ContainerException: ja
相关文章
- Cannot use org.jvnet.jax-ws-commons.jaxws-maven-pl
- Got ActiveRecord::AssociationTypeMismatch on model
- Multiple parameters in AngularJS $resource GET
- Global Exception Handling in Jersey & Spring?
- REST search interface and the idempotency of GET
- Getting error detail from WCF REST
- Send a GET request with a body in JavaScript (XMLH
- GuzzleHttp Hangs When Using Localhost
Along with the above clarification provided by @Ruben, I want to add that you can also refer equivalent of the same in Spring RESTFull implementation.
JAX- RS Specification @PathParam - Binds the value of a URI template parameter or a path segment containing the template parameter to a resource method parameter, resource class field, or resource class bean property.
@QueryParam - Binds the value(s) of a HTTP query parameter to a resource method parameter, resource class field, or resource class bean property.
URI : users/query?from=100
To achieve the same using Spring, you can use
@PathVariable(Spring) == @PathParam(Jersey, JAX-RS),
@RequestParam(Spring) == @QueryParam(Jersey, JAX-RS)
Query parameters are added to the url after the
?
mark, while a path parameter is part of the regular URL.In the URL below
tom
could be the value of a path parameter and there is one query parameter with the nameid
and value1
:http://mydomain.com/tom?id=1