Abstract
| Goal |
Configure connectors, servers, and other features of the web subsystem. |
| Objectives |
|
| Sections |
|
| Lab |
|
Red Hat Enterprise Application Platform 7 (JBoss EAP 7) uses the Undertow open source project to implement the web subsystem. Undertow can act both as a web server and as a Jakarta Enterprise Edition (Jakarta EE) web container. Undertow implements Jakarta EE specifications and features related to web engines, such as:
Jakarta Servlet 4.0 is the last version of the servlets specification that is also the Java Servlet Specification from Java Enterprise Edition 8.
Provides a full-duplex communication between two peers over TCP.
Improves performance and the payload size over HTTP 1.1 by using only one TCP connection between the client and the server.
Undertow uses only one HTTP port for all protocol versions, reducing the HTTP ports that JBoss EAP uses to 9990, for administration, and 8080, for applications.
Undertow supports faster non-blocking I/O technologies provided by the XNIO API. The XNIO API is a library based on the Java New Input/Output (NIO) API.
Undertow can distribute the requests among other JBoss EAP instances with the mod_cluster technology.
The JBoss EAP distribution includes an example of a standalone server configuration that acts only as a load balancer in the $JBOSS_HOME/standalone/configuration/standalone-load-balancer.xml file.
Defines the default web application that displays when the request does not specify a path.
Customizes the session management for HTTP sessions.
The following snippet is an example of the Undertow subsystem definition in a standalone-ha.xml file:
<subsystem xmlns="urn:jboss:domain:undertow:12.0"
default-server="default-server"
default-virtual-host="default-host"
default-servlet-container="default"
default-security-domain="other"
statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajp" socket-binding="ajp"/>
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<http-invoker security-realm="ApplicationRealm"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
</subsystem>Within the Undertow subsystem, there are five main components to configure:
Buffer caches
Server
Servlet container
Handlers
Filters
Buffer caches are responsible for caching static content. You can configure three parameters for each buffer cache:
buffer-size
The size in bytes of each buffer. The default size is 1024 bytes. Ideally, the buffer size must be big enough for your largest static file.
buffers-per-region
Number of buffers in each region, or cache. The default size is 1024.
max-regions
The maximum number of regions, or caches. The default maximum is one region.
You can calculate the total amount of space used by multiplying the buffer-size by the number of buffers-per-region, by the max-regions number.
Thus, the default total amount of space for caching static content is 10 MB.
Servers represent an instance of Undertow.
It is possible to run multiple Undertow instances in a single JBoss EAP instance.
You can cover most of the use cases with just a <server> tag definition.
However, in multi-tenant environments you can use more than one <server> tag to isolate runtimes.
A listener handles a request according to the request protocol. There are three listener types for each server: HTTP, HTTPS, and AJP.
The default and full profiles define the HTTP and the HTTPS listeners.
The ha and full-ha profiles also define the AJP listener to communicate with a frontal load balancer.
The server also contains the <host> tag to define and manage virtual hosts.
You can configure the access log for the web server within each <host>.
You can configure the servlets, JSP, and web-socket technologies by using the servlet container. A JBoss EAP instance can have multiple servlet containers, however most servers only need a single servlet container.
To learn more about servlet containers, see the references section.
There are handlers to serve static content, and handlers to manage reverse-proxy settings.
To learn more about handlers, see the references section.
A filter is functionally equivalent to a global valve used in previous versions of JBoss EAP. A filter allows you to modify the content of a request. Some common use cases for filters include setting headers or doing GZIP compression.
You can define the following types of filters:
custom-filter
error-page
expression-filter
gzip
mod-cluster
request-limit
response-header
rewrite
Filters form an execution chain.
You can control the filter execution order by setting the priority attribute.
To learn more about filters, see the references section.
JBoss Enterprise Application Platform Supported Standards
To learn deeper details about Undertow subsystem attributes and components, refer to the Configuring the Web Server (Undertow) chapter in the Configuration Guide in the Red Hat JBoss EAP documentation at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html-single/configuration_guide/index#configuring_the_web_server_undertow
To learn about tuning the Undertow subsystem performance, refer to the Undertow subsystem tuning chapter in the Performance Tuning Guide in the Red Hat JBoss EAP documentation at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html-single/performance_tuning_guide/index#assembly_undertow-subsystem-tuning_assembly_logging-subsystem-tuning
To learn about the full list of the Undertow subsystem attributes for filters, handlers and the other components to configure, refer to the Undertow Subsystem Attributes section in the Configuration Guide in the Red Hat JBoss EAP documentation at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html-single/configuration_guide/index#undertow-attribute-refs