Undertow doesn’t support the older JBoss Web valves, however most of them can be easily migrated to Undertow handlers. Here is a list of those valves and their corresponding Undertow handler:
Valve | Handler |
org.apache.catalina.valves.AccessLogValve | io.undertow.server.handlers.accesslog.AccessLogHandler |
org.apache.catalina.valves.ExtendedAccessLogValve | io.undertow.server.handlers.accesslog.AccessLogHandler |
org.apache.catalina.valves.RequestDumperValve | io.undertow.server.handlers.RequestDumpingHandler |
org.apache.catalina.valves.RewriteValve | io.undertow.server.handlers.SetAttributeHandler |
org.apache.catalina.valves.RemoteHostValve | io.undertow.server.handlers.AccessControlListHandler |
org.apache.catalina.valves.RemoteAddrValve | io.undertow.server.handlers.IPAddressAccessControlHandler |
org.apache.catalina.valves.RemoteIpValve | io.undertow.server.handlers.ProxyPeerAddressHandler |
org.apache.catalina.valves.StuckThreadDetectionValve | io.undertow.server.handlers.StuckThreadDetectionHandler |
org.apache.catalina.valves.CrawlerSessionManagerValve | io.undertow.servlet.handlers.CrawlerSessionManagerHandler |
It is possible to do a migration of the older web legacy subsystem configuration and related persisted data by invoking the legacy subsystem’s migrate
operation, using the management CLI:
/subsystem=web:migrate
An example: using a Request Dumping Handler
Supposing you want to migrate the old RequestDumperValve. The equivalent class in undertow is io.undertow.server.handlers.RequestDumpingHandler.
You can install it using WildFly CLI as follows:
batch /subsystem=undertow/configuration=filter/custom-filter=request-logging-filter:add(class-name=io.undertow.server.handlers.RequestDumpingHandler, module=io.undertow.core) /subsystem=undertow/server=default-server/host=default-host/filter-ref=request-logging-filter:add run-batch
That will result in the following configuration:
<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}}"> ... <server name="default-server"> ... <host name="default-host" alias="localhost"> ... <filter-ref name="request-dumper"/> </host> </server> ... <filters> ... <filter name="request-dumper" module="io.undertow.core" class-name="io.undertow.server.handlers.RequestDumpingHandler"/> </filters> </subsystem>