@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress hostAddress = context.getCurrentAddress().getParent(); final PathAddress serverAddress = hostAddress.getParent(); final String name = context.getCurrentAddressValue(); final String handler = LocationDefinition.HANDLER.resolveModelAttribute(context, model).asString(); final LocationService service = new LocationService(name); final String serverName = serverAddress.getLastElement().getValue(); final String hostName = hostAddress.getLastElement().getValue(); final ServiceName serviceName = UndertowService.locationServiceName(serverName, hostName, name); final ServiceBuilder<LocationService> builder = context.getCapabilityServiceTarget().addCapability(LocationDefinition.LOCATION_CAPABILITY, service) .addCapabilityRequirement(Capabilities.CAPABILITY_HANDLER, HttpHandler.class, service.getHttpHandler(),handler) .addCapabilityRequirement(Capabilities.CAPABILITY_HOST, Host.class, service.getHost(), serverName, hostName); builder.setInitialMode(ServiceController.Mode.ACTIVE) .addAliases(serviceName) .install(); } }
private HttpHandler configureHandler() { ArrayList<UndertowFilter> filters = new ArrayList<>(this.filters); return configureHandlerChain(getHttpHandler().getValue(), filters); }
void registerLocation(LocationService location) { locations.put(location.getLocationPath(), location); registerHandler(location.getLocationPath(), location.getLocationHandler()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStart(location.getLocationPath(), Host.this)); }
LocationService locService = new LocationService(); locService.startService(new Intent());
private static EmbeddedDatabase _db; private static LocationService _svc; @BeforeClass public static void setUp() throws Exception { _db = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL) .setName("myTestDB").build(); assertThat(_db, is(notNullValue())); _svc = new LocationService(); _svc.setDataSource(_db); } @AfterClass public static void tearDown() throws Exception { _db.shutdown(); }
void unregisterLocation(LocationService location) { locations.remove(location.getLocationPath()); unregisterHandler(location.getLocationPath()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStop(location.getLocationPath(), Host.this)); }
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); } // handle .well-known requests from ACME certificate authorities String path = WildFlySecurityManager.getPropertyPrivileged("jboss.home.dir", "."); Path base; try { base = Paths.get(path).normalize().toRealPath(); } catch (IOException e) { throw new RuntimeException(e); } final int cacheBufferSize = 1024; final int cacheBuffers = 1024; PathResourceManager resourceManager = new PathResourceManager(base, cacheBufferSize * cacheBuffers, true, false); rootHandler = new AcmeResourceHandler(resourceManager, rootHandler); GateHandlerWrapper gateHandlerWrapper = this.gateHandlerWrapper; if(gateHandlerWrapper != null) { rootHandler = gateHandlerWrapper.wrap(rootHandler); } return rootHandler; }
void unregisterLocation(LocationService location) { locations.remove(location.getLocationPath()); unregisterHandler(location.getLocationPath()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStop(location.getLocationPath(), Host.this)); }
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); } // handle .well-known requests from ACME certificate authorities String path = WildFlySecurityManager.getPropertyPrivileged("jboss.home.dir", "."); Path base; try { base = Paths.get(path).normalize().toRealPath(); } catch (IOException e) { throw new RuntimeException(e); } final int cacheBufferSize = 1024; final int cacheBuffers = 1024; PathResourceManager resourceManager = new PathResourceManager(base, cacheBufferSize * cacheBuffers, true, false); rootHandler = new AcmeResourceHandler(resourceManager, rootHandler); GateHandlerWrapper gateHandlerWrapper = this.gateHandlerWrapper; if(gateHandlerWrapper != null) { rootHandler = gateHandlerWrapper.wrap(rootHandler); } return rootHandler; }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress hostAddress = context.getCurrentAddress().getParent(); final PathAddress serverAddress = hostAddress.getParent(); final String name = context.getCurrentAddressValue(); final String handler = LocationDefinition.HANDLER.resolveModelAttribute(context, model).asString(); final LocationService service = new LocationService(name); final String serverName = serverAddress.getLastElement().getValue(); final String hostName = hostAddress.getLastElement().getValue(); final ServiceName serviceName = UndertowService.locationServiceName(serverName, hostName, name); final ServiceBuilder<LocationService> builder = context.getCapabilityServiceTarget().addCapability(LocationDefinition.LOCATION_CAPABILITY, service) .addCapabilityRequirement(Capabilities.CAPABILITY_HANDLER, HttpHandler.class, service.getHttpHandler(),handler) .addCapabilityRequirement(Capabilities.CAPABILITY_HOST, Host.class, service.getHost(), serverName, hostName); builder.setInitialMode(ServiceController.Mode.ACTIVE) .addAliases(serviceName) .install(); } }
public void unregisterHandler(String path) { pathHandler.removePrefixPath(path); // if there is registered location for given path, serve it from now on LocationService location = locations.get(path); if (location != null) { pathHandler.addPrefixPath(location.getLocationPath(), location.getLocationHandler()); } // else serve the default response code else if (path.equals("/")) { this.setupDefaultResponseCodeHandler(); } }
private HttpHandler configureHandler() { ArrayList<UndertowFilter> filters = new ArrayList<>(this.filters); return configureHandlerChain(getHttpHandler().getValue(), filters); }
void unregisterLocation(LocationService location) { locations.remove(location.getLocationPath()); unregisterHandler(location.getLocationPath()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStop(location.getLocationPath(), Host.this)); }
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); } // handle .well-known requests from ACME certificate authorities String path = WildFlySecurityManager.getPropertyPrivileged("jboss.home.dir", "."); Path base; try { base = Paths.get(path).normalize().toRealPath(); } catch (IOException e) { throw new RuntimeException(e); } final int cacheBufferSize = 1024; final int cacheBuffers = 1024; PathResourceManager resourceManager = new PathResourceManager(base, cacheBufferSize * cacheBuffers, true, false); rootHandler = new AcmeResourceHandler(resourceManager, rootHandler); GateHandlerWrapper gateHandlerWrapper = this.gateHandlerWrapper; if(gateHandlerWrapper != null) { rootHandler = gateHandlerWrapper.wrap(rootHandler); } return rootHandler; }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress hostAddress = context.getCurrentAddress().getParent(); final PathAddress serverAddress = hostAddress.getParent(); final String name = context.getCurrentAddressValue(); final String handler = LocationDefinition.HANDLER.resolveModelAttribute(context, model).asString(); final LocationService service = new LocationService(name); final String serverName = serverAddress.getLastElement().getValue(); final String hostName = hostAddress.getLastElement().getValue(); final ServiceName serviceName = UndertowService.locationServiceName(serverName, hostName, name); final ServiceBuilder<LocationService> builder = context.getCapabilityServiceTarget().addCapability(LocationDefinition.LOCATION_CAPABILITY, service) .addCapabilityRequirement(Capabilities.CAPABILITY_HANDLER, HttpHandler.class, service.getHttpHandler(),handler) .addCapabilityRequirement(Capabilities.CAPABILITY_HOST, Host.class, service.getHost(), serverName, hostName); builder.setInitialMode(ServiceController.Mode.ACTIVE) .addAliases(serviceName) .install(); } }
void registerLocation(LocationService location) { locations.put(location.getLocationPath(), location); registerHandler(location.getLocationPath(), location.getLocationHandler()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStart(location.getLocationPath(), Host.this)); }
private HttpHandler configureHandler() { ArrayList<UndertowFilter> filters = new ArrayList<>(this.filters); return configureHandlerChain(getHttpHandler().getValue(), filters); }
void registerLocation(LocationService location) { locations.put(location.getLocationPath(), location); registerHandler(location.getLocationPath(), location.getLocationHandler()); undertowService.getValue().fireEvent(listener -> listener.onDeploymentStart(location.getLocationPath(), Host.this)); }
public void unregisterHandler(String path) { pathHandler.removePrefixPath(path); // if there is registered location for given path, serve it from now on LocationService location = locations.get(path); if (location != null) { pathHandler.addPrefixPath(location.getLocationPath(), location.getLocationHandler()); } // else serve the default response code else if (path.equals("/")) { this.setupDefaultResponseCodeHandler(); } }
public void unregisterHandler(String path) { pathHandler.removePrefixPath(path); // if there is registered location for given path, serve it from now on LocationService location = locations.get(path); if (location != null) { pathHandler.addPrefixPath(location.getLocationPath(), location.getLocationHandler()); } // else serve the default response code else if (path.equals("/")) { this.setupDefaultResponseCodeHandler(); } }