Jetty Study Notes-jetty global

Source: Internet
Author: User
Jetty global

The server is displayed at the entrance of the previous article. The following describes the structure of the server.

Jetty has several main concepts:

  • Connector: receive connections
  • Handler: Process requests
  • Threadpool: thread pool, unified thread management

Server associates these important concepts. From the inheritance structure, server itself is a handler that can contain other handler (that is, a container), including connenctor and threadpool, these parts are connected internally.

Server. dostart () method:

Step 1: Create a threadpool and add it to the iner for later use

setThreadPool(new QueuedThreadPool());

Step 2: Execute dostart () of handlers ();

super.doStart(); 

Step 3: Execute connector initialization, open the port, and receive the request

_connectors[i].start();

Connector

  • Sslconnector: Secure Sockets Layer, which provides security control methods such as authentication.
  • Blockingchannelconnector: this connector uses efficient NiO buffers with a traditional blocking thread model
  • Selectchannelconnector: this connector uses efficient NiO buffers with a Non Blocking threading model.
  • Ajp13socketconnector: used for AJP Protocol Communication
  • Networktrafficselectchannelconnector: supports networktrafficlistener (networktrafficlistener: A listener for raw network traffic within Jetty .)
  • Inheritedchannelconnector: first, obtain the channel that inherits a process from the self-starting Virtual Machine (VM ).

Handler

Handler in three main categories

  • Simple handler: directly inherits from abstracthandler to implement the handler function.
  • Handlerwrapper: Decorative mode. It acts as a proxy outside handler to do things outside handler.
  • Handlercollection: Handler container

Lifecycle

All components in jetty implement the lifecycle interface. Each action of the component calls the method (start, stop, etc.) corresponding to the lifecycle, and the notification _ listeners executes the corresponding method.

Connector initialization process

Take socketconnect as an example to make it clearer.

Process for receiving requests

Finally, enter the connection handler.

I forgot to list the directory structure.

Directory Name Function
Bin Startup and other scripts
Contexts Hot deployment files
Contexts-available Pre-Context
Lib Jar package
Etc Various configuration files
Javadoc API documentation
Logs Default log directory
Resources Other resource directories
Webapps Store Web Applications
Start. Jar Classes required to start Jetty

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.