use of org.infinispan.rest.resources.ServerResource in project infinispan by infinispan.
the class RestServer method startInternal.
@Override
protected void startInternal() {
this.maxContentLength = configuration.maxContentLength() + MAX_INITIAL_LINE_SIZE + MAX_HEADER_SIZE;
AuthenticationConfiguration auth = configuration.authentication();
if (auth.enabled()) {
auth.authenticator().init(this);
}
super.startInternal();
restCacheManager = new RestCacheManager<>(cacheManager, this::isCacheIgnored);
invocationHelper = new InvocationHelper(this, restCacheManager, (EmbeddedCounterManager) EmbeddedCounterManagerFactory.asCounterManager(cacheManager), configuration, server, getExecutor());
String restContext = configuration.contextPath();
String rootContext = "/";
ResourceManager resourceManager = new ResourceManagerImpl();
resourceManager.registerResource(restContext, new CacheResourceV2(invocationHelper));
resourceManager.registerResource(restContext, new CounterResource(invocationHelper));
resourceManager.registerResource(restContext, new ContainerResource(invocationHelper));
resourceManager.registerResource(restContext, new XSiteResource(invocationHelper));
resourceManager.registerResource(restContext, new SearchAdminResource(invocationHelper));
resourceManager.registerResource(restContext, new TasksResource(invocationHelper));
resourceManager.registerResource(restContext, new ProtobufResource(invocationHelper));
resourceManager.registerResource(rootContext, new MetricsResource(auth.metricsAuth(), invocationHelper));
Path staticResources = configuration.staticResources();
if (staticResources != null) {
Path console = configuration.staticResources().resolve("console");
resourceManager.registerResource(rootContext, new StaticContentResource(staticResources, "static"));
resourceManager.registerResource(rootContext, new StaticContentResource(console, "console", (path, resource) -> {
if (!path.contains("."))
return StaticContentResource.DEFAULT_RESOURCE;
return path;
}));
resourceManager.registerResource(rootContext, new RedirectResource(rootContext, rootContext + "console/welcome", true));
}
if (adminEndpoint) {
resourceManager.registerResource(restContext, new ServerResource(invocationHelper));
resourceManager.registerResource(restContext, new ClusterResource(invocationHelper));
resourceManager.registerResource(restContext, new SecurityResource(invocationHelper, rootContext + "console/", rootContext + "console/forbidden.html"));
registerLoggingResource(resourceManager, restContext);
}
this.restDispatcher = new RestDispatcherImpl(resourceManager, restCacheManager.getAuthorizer());
}
Aggregations