Hello,
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?
Here is the brief extract of my service code showing how do I register
deployment:
/...//
//private
InjectedValue<org.wildfly.extension.undertow.ServletContainerService>
injectedServletContainerService = new InjectedValue<>();//
//private InjectedValue<org.wildfly.extension.undertow.Host>
injectedHost = new InjectedValue<>();//
//...//
// private void deployCoordinatorServlet(final
io.undertow.servlet.api.DeploymentInfo deploymentInfo) throws
//ServletException//{//
// io.undertow.servlet.api.DeploymentManager manager =
injectedServletContainerService.getValue().getServletContainer().addDeployment(deploymentInfo);//
//
// manager.deploy();//
//
//injectedHost.getValue().registerDeployment(deploymentInfo,
manager.start());//
// }//
//.../
Service dependencies are registered during subsystem's boot time as follows:
/...
private final ServiceName hostServiceName =
UndertowService.virtualHostName("default-server",
"default-host");
private final ServiceName servletContainerServiceName =
UndertowService.SERVLET_CONTAINER.append("default");
...//
// @Override
public void performBoottime(OperationContext context,
ModelNode operation, ModelNode model,
ServiceVerificationHandler verificationHandler,
List<ServiceController<?>> newControllers)
throws OperationFailedException {
final CoordinatorService coordinatorService = new
CoordinatorService();
final ServiceBuilder<CoordinatorService> builder =
context.getServiceTarget().addService(RTSSubsystemExtension.COORDINATOR,
coordinatorService)
.addDependency(hostServiceName, Host.class,
coordinatorService.getInjectedHost())
.addDependency(servletContainerServiceName,
ServletContainerService.class,
coordinatorService.getInjectedServletContainerService());
...
}//
/
/.../
Hope I have explained my problem clear enough.
Thanks,
Gytis
Show replies by date