Chapter 25. web

Note

The web application is a bundle, so we can use normal bundle:start and bundle:stop commands.

The recommended method is to use WAB bundles, that have the Web-ContextPath: /path manifest header.

WAB bundles can be installed as the type war:

Example

mvn:io.hawt/hawtio-osgi/2.0.0.fuse-7_12_0-00009/war.

25.1. web:context-list

25.1.1. Description

Lists all available web contexts. These may originate from HttpService, Whiteboard or WAB Extender.

25.1.2. Syntax

web:context-list

25.1.3. Options

NameDescription

--help

Display this help message

25.1.4. Additional information

This command is mostly useful for OSGi web application developers.

Table 25.1. Sample web:context-list output

Bundle IDSymbolic NameContext PathContext NameRankService IDTypeScopeRegistration Properties

122

org.apache.cxf.cxf-rt-transports-http

/

default

MAX

0

HttpService

static*

httpContext.id=default httpContext.path=/ osgi.http.whiteboard.context.httpservice=default osgi.http.whiteboard.context.path=/

230

org.ops4j.pax.web.pax-web-extender-whiteboard

/

default

0

0

Whiteboard

static*

osgi.http.whiteboard.context.name=default osgi.http.whiteboard.context.path=/

43

io.hawt.hawtio-osgi

/hawtio

/hawtio

MAX

0

WAB

static*

osgi.http.whiteboard.context.path=/hawtio

25.2. web:launch

25.2.1. Description

Start the web application in a browser of the given bundle ID.

25.2.2. Syntax

web:launch [options] id

25.2.3. Arguments

NameDescription

id

The bundle ID to start the browser with

25.2.4. Options

NameDescription

--base

The base URL to browse to, otherwise default localhost:8181 will be used.

--help

Display this help message

25.3. web:wab-list

25.3.1. Description

Lists all available, deployed Web Application Bundles.

25.3.2. Syntax

web:wab-list

25.3.3. Options

NameDescription

--help

Display this help message

25.4. web:servlet-list

25.4.1. Description

Lists details for available servlets.

25.4.2. Syntax

web:servlet-list [options]

25.4.3. Options

NameDescription

--help

Display this help message

--no-format

Disable table rendered output

25.4.4. Additional information

The web:servlet-list command lists installed servlets, showing additional information, for example the method of servlet registration.

Table 25.2. Sample output for Fuse 7.12

Bundle IDNameClassContext Path(s)URLsType

43

default

org.ops4j.pax.web.service.undertow.internal.web.UndertowResourceServlet

/hawtio

/

WAB

43

jolokia-agent

io.hawt.web.servlets.JolokiaConfiguredAgentServlet

/hawtio

/jolokia/*

WAB

43

jolokia-proxy

io.hawt.web.proxy.ProxyServlet

/hawtio

/proxy/*

WAB

43

jsp

org.ops4j.pax.web.jsp.JspServlet

/hawtio

*.jspx, *.jsp

WAB

43

keycloak

io.hawt.web.auth.keycloak.KeycloakServlet

/hawtio

/keycloak/*

WAB

43

login

io.hawt.web.auth.LoginServlet

/hawtio

/auth/login

WAB

43

logout

io.hawt.web.auth.LogoutServlet

/hawtio

/auth/logout

WAB

43

plugin

io.hawt.web.plugin.PluginServlet

/hawtio

/plugin/*

WAB

43

user

io.hawt.web.auth.keycloak.KeycloakUserServlet

/hawtio

/user/*

WAB

122

cxf-osgi-transport-servlet

org.apache.cxf.transport.servlet.CXFNonSpringServlet

/

/cxf/*

HttpService

25.5. web:start

Deprecated
Use bundle:start with WAB bundles instead.

25.5.1. Description

Start the web context of given bundles.

25.5.2. Syntax

web:start [options] ids

25.5.3. Arguments

NameDescription

ids

The list of bundle IDs separated by whitespaces

25.5.4. Options

NameDescription

--help

Display this help message

25.6. web:stop

Deprecated
Use bundle:stop with WAB bundles instead.

25.6.1. Description

Stop the web context of given bundles.

25.6.2. Syntax

web:stop [options] ids

25.6.3. Arguments

NameDescription

ids

The list of bundle IDs separated by whitespaces

25.6.4. Options

NameDescription

--help

Display this help message

25.7. web:wab-info

25.7.1. Description

Shows information about Web Application Bundle.

25.7.2. Syntax

web:wab-info [options]

25.7.3. Options

NameDescription

--wab

WAB specified by context path or bundle ID

--help

Display this help message

25.7.4. Additional information

The web:wab-info command shows information about the structure of a web application. It displays reachable bundles, WAB classpath and registered ServletContainerInitializers.

Sample output for hawtio web application

hawtio :: OSGi Web Console (43)
-------------------------------
Context Path: /hawtio
Deployment State: Deployed
WAB ClassPath:
 - bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/classes/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/hawtio-core-2.0.0.fuse-7_12_0-00009.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/hawtio-system-2.0.0.fuse-7_12_0-00009.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/jolokia-core-1.7.1.redhat-00001.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/json-simple-1.1.1.redhat-1.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/httpclient-4.5.13.redhat-00002.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/httpcore-4.4.13.redhat-00001.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/commons-logging-1.2.0.redhat-3.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/commons-io-2.11.0.redhat-00001.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/commons-codec-1.15.0.redhat-00001.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/guava-27.1-jre.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/failureaccess-1.0.1.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/jsr305-3.0.2.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/checker-qual-2.5.2.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/error_prone_annotations-2.2.0.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/j2objc-annotations-1.1.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/animal-sniffer-annotations-1.17.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/json-20171018.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/hawtio-util-2.0.0.fuse-7_12_0-00009.jar!/
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/org.apache.aries.blueprint.web-1.1.0.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/org.apache.aries.blueprint.noosgi-1.1.0.jar!/ (scanning skipped)
 - jar:bundle://2469cbea-ac0f-4f79-9760-2186c2e80b94_43.0:0/WEB-INF/lib/slf4j-api-1.7.36.redhat-00002.jar!/ (scanning skipped)
ServletContainerInitializers:
 - org.ops4j.pax.web.jsp.JasperInitializer
 - org.ops4j.pax.web.service.undertow.websocket.internal.WebSocketsInitializer
 - io.undertow.servlet.sse.ServerSentEventSCI
Container web fragments (reachable bundles without /META-INF/web-fragment.xml):
 - (231) org.ops4j.pax.web.pax-web-jsp/8.0.17
 - (237) org.ops4j.pax.web.pax-web-undertow-websocket/8.0.17
 - (193) org.apache.servicemix.specs.javax-el-api-3.0.0/3.0.0.1
 - (50) io.undertow.servlet/2.2.23.SP1-redhat-00001
 - (51) io.undertow.websockets-jsr/2.2.23.SP1-redhat-00001
 - (49) io.undertow.core/2.2.23.SP1-redhat-00001
 - (212) org.jboss.xnio.api/3.8.7.SP1-redhat-00001

25.8. web:wab-list

25.8.1. Description

Lists all available, deployed Web Application Bundles.

25.8.2. Syntax

web:wab-list

25.8.3. Options

NameDescription

--help

Display this help message