Undertow Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 51: Line 51:


The read listener is responsible for parsing the incoming request into a <tt>[[#HttpServerExchange|HttpServerExchange]]</tt> instance.
The read listener is responsible for parsing the incoming request into a <tt>[[#HttpServerExchange|HttpServerExchange]]</tt> instance.
=Request Lifecycle=
* http://undertow.io/undertow-docs/undertow-docs-1.3.0/index.html#request-lifecycle
* http://undertow.io/undertow-docs/undertow-docs-1.3.0/undertow-request-lifecycle.html


=HttpServerExchange=
=HttpServerExchange=


<font color=red>
<font color=red>
Line 67: Line 61:


==Handler Chain==
==Handler Chain==
=Request Lifecycle=
* http://undertow.io/undertow-docs/undertow-docs-1.3.0/index.html#request-lifecycle
* http://undertow.io/undertow-docs/undertow-docs-1.3.0/undertow-request-lifecycle.html

Revision as of 03:04, 19 January 2016

Internal

Overview

Undertow is a web server written in Java. It provides both blocking and non-blocking APIs based on NIO. It has a composition-based architecture that allows assembling a web server combining small single purpose handlers.

Undertow is embeddable, its lifecycle is controlled by the embedding application and its configuration is controlled programmatically via API calls. Undertow is the default web server in WildFly since version 8, and in this case the configuration is exposed via XML in the server configuration file as:

        ...
        <subsystem xmlns="urn:jboss:domain:undertow:3.0">
            ...
        </subsystem>
        ...

It has support for Servlet 3.1.

Artifacts

  • undertow-core
  • undertow-servlet provides support for Servlet 3.1
  • undertow-websockets-jsr provides support for the Java API for Websockets (JSR-356)

Container

There in no Undertow container. Undertow applications are assembled from Undertow handler classes and it is up to the embedding application to manage the lifecycle of all Undertow handlers.

Architecture

An Undertow server consists of one or more XNIO worker instances, one or more connectors and a handler chain.

XNIO Concepts

Connector

A connector (also known as a Listener) is the Undertow part that handles incoming connections and the underlying wire protocol. By default, Undertow ships with 3 listeners: HTTP, HTTPS and AJP.

A connector comprises two XNIO Listeners: an open listener and a read listener:

Open Listener

The open listener is invoked when a connection is first received, and it will do any work necessary to set up the connection. Then, it will pass it to the read listener, setting protocol specific state and passing it to the first handler in the handler chain.

Read Listener

The read listener is responsible for parsing the incoming request into a HttpServerExchange instance.

HttpServerExchange

An exchange can be in blocking or non-blocking mode, and it can be put in blocking mode.

Handler

Handler Chain

Request Lifecycle