RESTful Web Service Combat Summary 1

Source: Internet
Author: User
Tags representational state transfer uri flag

1 The basic implementation form of rest is http+uri+xml, but not the only form. XML was later replaced by JSON format. Rest is an architectural style (representational state Transfer, representational states transfer) rather than a specific implementation form.

2 RESTful Web Services is a RESTful Web service that adheres to the rest style. is a roa (resource-oriented Architecture, resource-oriented architecture) application.

The main feature is that the method information exists in the HTTP method (for example, Get/put), and the scope exists in the URI. Scope information is a URI that contains conditions for filtering, paging, and sorting of device resources.

3 Jax-rs is a RESTful Web Services standard specification for the Java world.

4 JAX-RS 2.0 Target

1) Use Pojo to publish Web resources

2) with HTTP as the center, use clear HTTP and Uniform Resource location (URI) elements to map related API classes and annotations.

3) Container independence, JAX-RS 2.0 applications can be deployed in a variety of servlet containers, such as Tomcat/jetty

5 Jax-rs elements

1) Resource classes, Java classes that use Jax-rs annotations to implement related Web resources. Used to receive requests and return responses. Three-layer Package definition form: Resource-service-dao.

2) Root resource class, using @path annotations, provides access to the resource class tree's root resource and its child resources. The resource class is divided into the root resource class and the child resource class.

3) Request the method identifier and use the run-time annotation @httpmethod to label the HTTP request method that handles the resource. The method will be processed by the corresponding method of the resource class, including Delete/get/head/options/post/put.

4) Resource method, the method defined in the resource class, uses the request method identifier to handle the request for the related resource.

5) Child Resource Identifier

6) Providers: An implementation class for the Jax-rs extension interface.

8) filter, a provider for filtering requests and responses.

9) Entity Interceptor, which is used to handle the provider of interception message reading and writing.

Invocation, which configures the client API object for publishing HTTP requests.

One) Webtarget, the invocation container object used for the URI flag.

Link, the URI that carries the metadata, including the media type, relationship, and title

Jersey is the reference implementation of the JAX-RS standard.

6 Rest applications need to consider two things,

1) How to define a resource, including how to publish a request, what the input and output are

2) How to deploy a RESTful WEB service application that matches the existing rest service type.

RESTful Web Service Combat Summary 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.