How Tomcat work Porter Chapter 5:container

Source: Internet
Author: User

The role of Containner is to send the request to the servlet and then generate the response to the client. In Tomcat 4, there are four types of container: Enginer,host,context, and Wrapper. This chapter is mainly about the context and wrapper, where the context and wrapper are simple to customize.

Engine: Represents the entire Catalina servlet engines.

Host: Represents a virtual host that has multiple context.

Context: Represents a Web site, a context that has one or more wrapper

Wrapper: Represents an independent servlet.

Pipelining Tasks


The Invoke method of the variable pipeline. There is a basevalue in the pipeline, which is a must-trigger value, and pipeline can also add

more value, when the Invoke method that calls pipeline is, each value is triggered. And the smooth triggering of value depends on Valuecontext.

Hold.

The Invoke method of Contanier

 Public void throws IOException, servletexception {pipeline.invoke (request, response);}

Pipeline's interface

 Public Valve getbasic ();  Public void setbasic (valve valve);  Public void   public valve[] getvalves ();  Public void throws  Public void removevalve (valve valve);

Valve interface

 Public String getInfo ();  Public void throws IOException, servletexception;

Valvecontext's interface

 Public void throws IOException, servletexception;
Public String getInfo ();

Context and Wrapper

The context has a hash type of children, which is a hash table for wrapper. The context uses the basevalue of his pipeline to find the appropriate wrapper based on the request, and then invokes the wrapper invoke method to process the request. The wrapper invoke also calls the basevalue of pipeline in wrapper to create the servlet and then the service (req,res).

How Tomcat work Porter Chapter 5:container

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.