Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find javax.ws.rs package in jdk

I'm trying to get into JAX-RS. My project jdk is set to 1.7.03. Does there have to be definitions of annotations for JAX-RS(javax.ws.rs)? If not, where I can find them?

like image 287
narek.gevorgyan Avatar asked Jun 03 '12 11:06

narek.gevorgyan


People also ask

What is javax WS RS package?

Package javax.ws.rsIdentifies the application path that serves as the base URI for all resource URIs provided by Path . Consumes. Defines the media types that the methods of a resource class or MessageBodyReader can accept.

What is javax WS RS core application?

A JAX-RS application or implementation supplies a concrete subclass of this abstract class. The implementation-created instance of an Application subclass may be injected into resource classes and providers using Context . Constructor Summary.

What is @path annotation in Java?

The @Path annotation identifies the URI path template to which the resource responds and is specified at the class or method level of a resource.

What is javax WS Rs core context?

The @Context annotation is an all-purpose annotation that injects instances of the following objects: HttpHeaders -> HTTP header parameters and values. UriInfo -> Captures path variables and query parameters. SecurityContext -> Provides access to security related information for a request.


2 Answers

These classes (JSR 311: JAX-RS: The JavaTM API for RESTful Web Services) are not part of the JDK. You need to include appropriate JAR file to your CLASSPATH. You can find the API e.g. in maven repository.

Also check out apache-cxf, jersey (reference implementation), resteasy from JBoss, restlet and few other JAX-RS implementations.

like image 50
Tomasz Nurkiewicz Avatar answered Sep 20 '22 14:09

Tomasz Nurkiewicz


Try: http://download.oracle.com/otndocs/jcp/jaxrs-2_0_rev_A-mrel-spec/index.html

Download: javax.ws.rs-api-2.0.rev.A.jar

Then add to your Project Properties(YourProjectName)->Libraries->Add JAR/Folder

like image 21
orientchen1978 Avatar answered Sep 17 '22 14:09

orientchen1978