Structure and Function Analysis of restlet help

Source: Internet
Author: User

Previously talked about the relationship between restlet components and help, see http://blog.csdn.net/teamlet/article/details/7726308

Here we will describe in detail the content of the help branch.

1. Help is the top-level class of restlet help.

Help is an abstract class without any implementation methods.

2. restlethelper is the help corresponding to restlet

Restlethelper <t> is a subclass of help and an abstract class.

Restlethelper mainly defines two attributes: Map <string, Object> attributes and t helped:

Attributes is the attribute to be exchanged between the engine and restlet API.
Helped is used to save the corresponding restlet component.

In addition to providing some methods through helped, handle (request, response) is also an important method)
This method is similar to handle (request, response) in restlet. The difference is that the start method is not required here,
Because every restlet needs to be started when handle is called, and help does not need to be started in handle.

Restlethelper also defines the START (), stop (), and update () Abstract methods for subclass implementation.

3. compositehelper


Compositehelper is a subclass of restlethelper. Because it does not implement abstract methods such as start () declared in restlethelper, compositehelper is also an abstract class.

Compositehelper defines the pointer to the filter operation, including firstinboundfilter, firstoutboundfilter, lastinboundfilter, and lastoutboundfilter.
And the restlet component inboundnext at the entry and the restlet component outboundnext at the exit.

In addition, like the call relationship between the restlet class and its subclass implementation, compositehelper overwrites the handle (request, response) method of restlethelper,
The method first calls the handle method of the parent class -- Super. Handle (request, response), and then calls the firstinboundfilter. Handle () method to process the filter queue;

Iv. componenthelper


Componenthelper is a subclass of compositehelper and its corresponding restlet component is component.

Componenthelper implements the START () Stop () Update () method defined by restlethelper.

In the START () method, a very important method Boolean checkvirtualhost (virtualhost host) is called. This method is also implemented in the componenthelper class.

First, the START () method first calls the checkvirtualhost () method to check defaulthost and hosts in compoennt.
If defaulthost and hosts are not empty and the next component is application, parse and assemble the application, and then start the application.
After the application is started, create inboundfilter and outboundfilter, and set the serverrouter instance containing component to outboundnext.

When a component class instance calls the START () method, the starthelper () method is used to call the START () of componenthelper ().

Note: componenthelper starts the application by executing the START () method.

Componenthelper. Start () ---> checkvirtualhost (virtualhost host) ----> application. Start ()

Pending

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.