Search in sources :

Example 1 with GateHandlerWrapper

use of org.wildfly.extension.undertow.deployment.GateHandlerWrapper in project wildfly by wildfly.

the class Host method start.

@Override
public void start(StartContext context) throws StartException {
    ControlledProcessStateService controlledProcessStateService = controlledProcessStateServiceInjectedValue.getValue();
    //may be null for tests
    if (controlledProcessStateService != null && controlledProcessStateService.getCurrentState() == ControlledProcessState.State.STARTING) {
        gateHandlerWrapper = new GateHandlerWrapper();
        controlledProcessStateService.addPropertyChangeListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                controlledProcessStateService.removePropertyChangeListener(this);
                if (gateHandlerWrapper != null) {
                    gateHandlerWrapper.open();
                    gateHandlerWrapper = null;
                }
                rootHandler = null;
            }
        });
    }
    server.getValue().registerHost(this);
    UndertowLogger.ROOT_LOGGER.hostStarting(name);
}
Also used : ControlledProcessStateService(org.jboss.as.controller.ControlledProcessStateService) PropertyChangeEvent(java.beans.PropertyChangeEvent) GateHandlerWrapper(org.wildfly.extension.undertow.deployment.GateHandlerWrapper) PropertyChangeListener(java.beans.PropertyChangeListener)

Example 2 with GateHandlerWrapper

use of org.wildfly.extension.undertow.deployment.GateHandlerWrapper in project wildfly by wildfly.

the class Host method configureRootHandler.

private HttpHandler configureRootHandler() {
    AccessLogService logService = accessLogService;
    HttpHandler rootHandler = pathHandler;
    ArrayList<UndertowFilter> filters = new ArrayList<>(this.filters);
    //handle options * requests
    rootHandler = new OptionsHandler(rootHandler);
    //handle requests that use the Expect: 100-continue header
    rootHandler = Handlers.httpContinueRead(rootHandler);
    rootHandler = LocationService.configureHandlerChain(rootHandler, filters);
    if (logService != null) {
        rootHandler = logService.configureAccessLogHandler(rootHandler);
    }
    GateHandlerWrapper gateHandlerWrapper = this.gateHandlerWrapper;
    if (gateHandlerWrapper != null) {
        rootHandler = gateHandlerWrapper.wrap(rootHandler);
    }
    return rootHandler;
}
Also used : HttpHandler(io.undertow.server.HttpHandler) GateHandlerWrapper(org.wildfly.extension.undertow.deployment.GateHandlerWrapper) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Aggregations

GateHandlerWrapper (org.wildfly.extension.undertow.deployment.GateHandlerWrapper)2 HttpHandler (io.undertow.server.HttpHandler)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ControlledProcessStateService (org.jboss.as.controller.ControlledProcessStateService)1