JAX-RS is an annotation-driven Java API that can be used for exposing Java beans as HTTP based services. For example, RESTful web applications are developed using JAX-RS annotations to define the resources exposed by the service. Web applications developed using JAX-RS annotations consist of the following qualities:
- Use of HTTP/S transport protocols for message transfer.
- The content that is transported by a JAX-RS web service can be in any format, e.g., XML, JSON, TEXT etc.
- Security can be enabled for a JAX-RS web application either at the HTTP Header level, or by using TLS protocol.
Info |
---|
Use WSO2 Developer Studio to easily develop your JAX-WS/JAX-RS Application. It will generate the needed Web application structure and you only have to concentrate on annotations and the business logic. |
See the following topics for information on JAX-RS applications in WSO2 AS:
Table of Contents | ||||
---|---|---|---|---|
|
...
JAX-RS annotations are defined in JSR 311. They are also a way of mapping Java with HTTP requests. For example, @GET, @PUT, @POST, @DELETE and @HEAD are JAX-RS annotations that directly map to HTTP requests by the same name. See the official Java documentation, for details about JAX-RS annotations and RESTful web services.
Shown below is an example of a simple web application that uses the following JAX-RS annotations: @Path, @GET, @Consumes and @Produces.
...
JAX-WS and JAX-RS applications can be bundled in a CXF application. Generally, Given below is the general folder structure of a CXF application is as follows. However, this can change depending on your application.
Please see the Webapp ClassLoading page for adding instructions on class loading for web applications, which explains how you can add the webapp-classloading.xml . It's file to your web app. This XML is a custom file implemented by WSO2 to give flexibility in classloading. You must have this file in order to deploy JAX-WS and JAX-RS applications, because the CXF runtime is not visible to the webapps by default.
...