In Jersey/JAX-RS I hear the terms "Resource classes" and "Providers". I am not clear on what the difference between these two are. Can someone please provide some proper explanation?
相关问题
- 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
Resource classes are your classes annotated with
@Path
and providers are any other classes that we can extend/implement that allow us to tap into/extend the JAX-RS framework, i.e.ContainerRequestFilter
ContainerResponseFilter
MessageBodyReader
MessageBodyWriter
WriterInterceptor
ReaderInterceptor
ContextResolver
ExceptionMapper
ClientRequestFilter
ClientResponseFilter
Aside from the client filters, all of these provider classes can be annotated with
@Provider
and automatically register on the server side when scanning is enabled.You might often hear questions like "What JSON provider are you using?" This refers to the
MessageBodyReader
orMessageBodyWriter
, which is a type of provider, or more precisely an "Entity Provider", as mentioned in the docs. This is really the only provider type with its own prefix type. All others are just generalized as being a "Provider".There may be more provider types, but these are all I can think of off the top of my head right now.