<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello,<br>
<br>
I am using Undertow to register servlet in the WilfFly service I am
working on. Everything works fine with default values. However, I
need a way to get server, host, and servlet container names in case
user will change them in standalone.xml. Could anybody recommend any
solutions?<br>
<br>
Here is the brief extract of my service code showing how do I
register deployment:<br>
<blockquote>
<blockquote><i>...</i><i><br>
</i><i>private
InjectedValue<org.wildfly.extension.undertow.ServletContainerService>
injectedServletContainerService = new InjectedValue<>();</i><i><br>
</i><i>private
InjectedValue<org.wildfly.extension.undertow.Host>
injectedHost = new InjectedValue<>();</i><i><br>
</i><i>...</i><i><br>
</i><i> private void deployCoordinatorServlet(final
io.undertow.servlet.api.DeploymentInfo deploymentInfo) throws
</i><i>ServletException</i><i> {</i><i><br>
</i><i> io.undertow.servlet.api.DeploymentManager manager
=
injectedServletContainerService.getValue().getServletContainer().addDeployment(deploymentInfo);</i><i><br>
</i><i><br>
</i><i> manager.deploy();</i><i><br>
</i><i><br>
</i><i>
injectedHost.getValue().registerDeployment(deploymentInfo,
manager.start());</i><i><br>
</i><i> }</i><i><br>
</i><i>...</i><br>
</blockquote>
</blockquote>
Service dependencies are registered during subsystem's boot time as
follows:<br>
<blockquote>
<blockquote><i>...<br>
private final ServiceName hostServiceName =
UndertowService.virtualHostName("default-server",
"default-host");<br>
private final ServiceName servletContainerServiceName =
UndertowService.SERVLET_CONTAINER.append("default");<br>
...</i><i><br>
</i><i> @Override<br>
public void performBoottime(OperationContext context,
ModelNode operation, ModelNode model,<br>
ServiceVerificationHandler verificationHandler,
List<ServiceController<?>> newControllers)<br>
throws OperationFailedException {<br>
<br>
final CoordinatorService coordinatorService = new
CoordinatorService();<br>
<br>
final ServiceBuilder<CoordinatorService> builder
=
context.getServiceTarget().addService(RTSSubsystemExtension.COORDINATOR,
coordinatorService)<br>
.addDependency(hostServiceName, Host.class,
coordinatorService.getInjectedHost())<br>
.addDependency(servletContainerServiceName,
ServletContainerService.class,
coordinatorService.getInjectedServletContainerService());<br>
...<br>
}</i><i><br>
</i></blockquote>
</blockquote>
<blockquote>
<blockquote><i>...</i><br>
</blockquote>
</blockquote>
<p><br>
Hope I have explained my problem clear enough.<br>
</p>
<p>Thanks,<br>
Gytis<br>
</p>
</body>
</html>