Tomcat4Valve execution sequence

Source: Internet
Author: User
3. Valve source code execution steps: invoke () 1 publicvoidinvoke (Requestrequest, Responseresponse) 2 throwsIOException, ServletException {3pipeline. invoke (request, respons... 3. Valve source code execution steps:
3.1 ContainerBase invoke ()
1
Public void invoke (Request request, Response response)
2
Throws IOException, ServletException {
3
Pipeline. invoke (request, response );
4
}
3.2 invoultpipeline invoke ()
1
Public void invoke (Request request, Response response)
2
Throws IOException, ServletException {
3
 
4
// Invoke the first Valve in this pipeline for this request
5
(New StandardPipelineValveContext (). invokeNext (request, response );
6
 
7
}
3.3StandardPipelineValveContext is the internal class of DefaultPipeLine. invokeNext ()
View sourceprint?
01
Protected class StandardPipelineValveContext
02
Implements ValveContext {
03
 
04
// --------------------------------------------------- Instance Variables
05
Protected int stage = 0;
06
 
07
// ----------------------------------------------------------- Properties
08
/**
09
* Return descriptive information about this ValveContext
10
* Implementation.
11
*/
12
Public String getInfo (){
13
Return info;
14
}
15
 
16
// --------------------------------------------------------- Public Methods
17
Public void invokeNext (Request request, Response response)
18
Throws IOException, ServletException {
19
 
20
Int subscript = stage;
21
Stage = stage + 1;
22
 
23
// Invoke the requested Valve for the current request thread
24
If (subscript <valves. length ){
25
Valves [subscript]. invoke (request, response, this );
26
} Else if (subscript = valves. length) & (basic! = Null )){
27
Basic. invoke (request, response, this );
28
} Else {
29
Throw new ServletException
30
(Sm. getString ("standardPipeline. noValve "));
31
}
32
}
33
}
4. Valve call sequence: basicValve is executed first, add is followed by execution
Related Article

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.