<extension module="org.jboss.as.web" />
The web subsystem configuration basically consists of three parts: The JSP Configuration, connectors and virtual servers. Advanced topics like load balancing and failover are covered on the "High Availability Guide". The default configuration does is suitable for most use cases and provides reasonable performance settings.
Required extension:
<extension module="org.jboss.as.web" />
Basic subsystem configuration example:
<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host"> <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost" /> <alias name="example.com" /> </virtual-server> </subsystem>
Dependencies on other subsystems:
None
The "configuration" subresource covers all aspects that relate to the configuration of the servlet engine itself. For a detailed explanation of each configuration attribute, please consult the JBossWeb documentation (See "Component Reference").
[standalone@localhost:9999 /] /subsystem=web:read-resource { "outcome" => "success", "result" => { "configuration" => { "static-resources" => { "sendfile" => 49152, "max-depth" => 3, "read-only" => true, "webdav" => false, "listings" => false, "disabled" => false }, "jsp-configuration" => { "development" => false, "keep-generated" => true, "recompile-on-fail" => false, "check-interval" => 0, "modification-test-interval" => 4, "display-source-fragment" => true, "error-on-use-bean-invalid-class-attribute" => false, "java-encoding" => "UTF8", "tag-pooling" => true, "generate-strings-as-char-arrays" => false, "target-vm" => "1.5", "dump-smap" => false, "mapped-file" => true, "disabled" => false, "source-vm" => "1.5", "trim-spaces" => false, "smap" => true } }, "connector" => {"http" => undefined}, "virtual-server" => {"localhost" => undefined} } }
(See standalone/configuration/standalone.xml)
The connectors are child resources of the subsystem web. Each connector does reference a particular socket binding:
[standalone@localhost:9999 /] /subsystem=web:read-children-names(child-type=connector) { "outcome" => "success", "result" => ["http"] } [standalone@localhost:9999 /] /subsystem=web/connector=http:read-resource(recursive=true) { "outcome" => "success", "result" => { "protocol" => "HTTP/1.1", "scheme" => "http", "socket-binding" => "http", "ssl" => undefined, "virtual-server" => undefined } }
Creating a new connector requires you to declare a new socket binding first:
[standalone@localhost:9999 /] /socket-binding-group=standard-sockets/socket-binding=custom:add(port=8181)
The newly created, unused socket binding can then be used to create a new connector configuration:
[standalone@localhost:9999 /] /subsystem=web/connector=test-connector:add( socket-binding=custom, scheme=http, protocol="HTTP/1.1", enabled=true )
Statistic information can be displayed from the connectors:
The following attributes can be queried:
value |
description |
bytesSent |
Number of byte sent by the connector |
bytesReceived |
Number of byte received by the connector (POST data). |
processingTime |
Processing time used by the connector. Im milli-seconds. |
errorCount |
Number of error that occurs when processing requests by the connector. |
maxTime |
Max time spent to process a request. |
requestCount |
Number of requests processed by the connector. |
For example:
[standalone@localhost:9999 /] /subsystem=web/connector=http:read-attribute(name=bytesSent, name=requestCount) { "outcome" => "success", "result" => "3" }
There are 3 different connectors available:
This one is the default connector, it runs usually on port 8080. See above how to configure it.
The HTTPS connectors are child resources of the subsystem web. By default they use JSSE. Each connector does reference a particular socket binding:
[standalone@localhost:9999 /] /subsystem=web:read-children-names(child-type=connector) { "outcome" => "success", "result" => [ "ajp", "http", "https" ] } [standalone@localhost:9999 /] /subsystem=web/connector=https:read-resource(recursive=true) { "outcome" => "success", "result" => { "protocol" => "HTTP/1.1", "scheme" => "https", "secure" => true, "socket-binding" => "https", "ssl" => {}, "virtual-server" => undefined } }
Creating a new connector may require you to declare a new socket binding first:
[standalone@localhost:9999 /] /socket-binding-group=standard-sockets/socket-binding=https:add(port=8443)
The newly created, unused socket binding can then be used to create a new connector configuration:
[standalone@localhost:9999 /] /subsystem=web/connector=test-connector:add(socket-binding=https, scheme=https, protocol="HTTP/1.1", enabled=true, ssl = {})
The default for SSL is to use Alias "tomcat" and password "changeit". It is possible to create the corresponding keystore using keytool:
keytool -genkey -alias tomcat -keyalg RSA
Of course specify a password value of "changeit".
The AJP connectors are child resources of the subsystem web. They are used with mod_jk, mod_proxy and mod_cluster of the Apache httpd front-end. Each connector does reference a particular socket binding:
[standalone@localhost:9999 /] /subsystem=web:read-children-names(child-type=connector) { "outcome" => "success", "result" => [ "ajp", "http" ] } [standalone@localhost:9999 /] /subsystem=web/connector=ajp:read-resource(recursive=true) { "outcome" => "success", "result" => { "protocol" => "AJP/1.3", "scheme" => "http", "socket-binding" => "ajp", "ssl" => undefined, "virtual-server" => undefined } }
Creating a new connector requires you to declare a new socket binding first:
[standalone@localhost:9999 /] /socket-binding-group=standard-sockets/socket-binding=ajp:add(port=8009)
The newly created, unused socket binding can then be used to create a new connector configuration:
[standalone@localhost:9999 /] /subsystem=web/connector=ajp:add( socket-binding=ajpm, protocol="AJP/1.3", enabled=true )
Native connectors are high performance connectors based on Tomcat native. They are used if the native modules are installed, a lot of distributions have it included, in case you don't have it try JBoss Web Native.
At a configuration level only the SSL part needs to be configured differently because it use OpenSSL.
[standalone@localhost:9999 /] /subsystem=web/connector=https:read-resource(recursive=true) { "outcome" => "success", "result" => { "protocol" => "HTTP/1.1", "scheme" => "https", "secure" => true, "socket-binding" => "https", "ssl" => { "certificate-file" => "/home/jfclere/CERTS/SERVER/newcert.pem", "certificate-key-file" => "/home/jfclere/CERTS/SERVER/newkey.pem", "password" => "xxxxxxx" }, "virtual-server" => undefined } }
Similar to the connectors, the virtual server declarations are child resources of the web subsystem. They will be referenced by alias names and can optionally refer to a default web application that acts serves the root web context.
[standalone@localhost:9999 /] /subsystem=web:read-children-names(child-type=virtual-server) { "outcome" => "success", "result" => ["localhost"] } [standalone@localhost:9999 /] /subsystem=web/virtual-server=default-host:read-resource { "outcome" => "success", "result" => { "access-log" => undefined, "alias" => ["example.com"], "default-web-module" => undefined, "enable-welcome-root" => true, "rewrite" => undefined } }
Adding a virtual server declaration is can be done through the default :add() operation
[standalone@localhost:9999 /] /subsystem=web/virtual-server=example.com:add [standalone@localhost:9999 /] /subsystem=web/virtual-server=example.com:remove
add/remove operations exists on any node in the configuration tree.
The web subsystem is provided by the JBossWeb project. Fo a detailed description of the available configuration properties, please consult the JBossWeb documentation.
JBoss Web Configuration Reference: http://docs.jboss.org/jbossweb/7.0.x/config/index.html
JBossWeb homepage: http://www.jboss.org/jbossweb
Project Documentation: http://docs.jboss.org/jbossweb/7.0.x/