<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&lt;org.wildfly.extension.undertow.ServletContainerService&gt;
          injectedServletContainerService = new InjectedValue&lt;&gt;();</i><i><br>
        </i><i>private
          InjectedValue&lt;org.wildfly.extension.undertow.Host&gt;
          injectedHost = new InjectedValue&lt;&gt;();</i><i><br>
        </i><i>...</i><i><br>
        </i><i>&nbsp;&nbsp;&nbsp; private void deployCoordinatorServlet(final
          io.undertow.servlet.api.DeploymentInfo deploymentInfo) throws
        </i><i>ServletException</i><i> {</i><i><br>
        </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; io.undertow.servlet.api.DeploymentManager manager
          =
injectedServletContainerService.getValue().getServletContainer().addDeployment(deploymentInfo);</i><i><br>
        </i><i><br>
        </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager.deploy();</i><i><br>
        </i><i><br>
        </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          injectedHost.getValue().registerDeployment(deploymentInfo,
          manager.start());</i><i><br>
        </i><i>&nbsp;&nbsp;&nbsp; }</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>&nbsp;&nbsp;&nbsp; @Override<br>
          &nbsp;&nbsp;&nbsp; public void performBoottime(OperationContext context,
          ModelNode operation, ModelNode model,<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceVerificationHandler verificationHandler,
          List&lt;ServiceController&lt;?&gt;&gt; newControllers)<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throws OperationFailedException {<br>
          <br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final CoordinatorService coordinatorService = new
          CoordinatorService();<br>
          <br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final ServiceBuilder&lt;CoordinatorService&gt; builder
          =
          context.getServiceTarget().addService(RTSSubsystemExtension.COORDINATOR,
          coordinatorService)<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .addDependency(hostServiceName, Host.class,
          coordinatorService.getInjectedHost())<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .addDependency(servletContainerServiceName,
          ServletContainerService.class,
          coordinatorService.getInjectedServletContainerService());<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
          &nbsp;&nbsp;&nbsp; }</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>