use of org.glassfish.common.util.admin.RestSessionManager in project Payara by payara.
the class AbstractRestResourceProvider method getResourceConfig.
@Override
public ResourceConfig getResourceConfig(Set<Class<?>> classes, final ServerContext sc, final ServiceLocator habitat, final Set<? extends Binder> additionalBinders) throws EndpointRegistrationException {
final Reloader r = new Reloader();
ResourceConfig rc = new ResourceConfig(classes);
rc.property(ServerProperties.MEDIA_TYPE_MAPPINGS, getMimeMappings());
rc.register(CsrfProtectionFilter.class);
// TODO - JERSEY2
// RestConfig restConf = ResourceUtil.getRestConfig(habitat);
// if (restConf != null) {
// if (restConf.getLogOutput().equalsIgnoreCase("true")) { //enable output logging
// rc.getContainerResponseFilters().add(LoggingFilter.class);
// }
// if (restConf.getLogInput().equalsIgnoreCase("true")) { //enable input logging
// rc.getContainerRequestFilters().add(LoggingFilter.class);
// }
// if (restConf.getWadlGeneration().equalsIgnoreCase("false")) { //disable WADL
// rc.getFeatures().put(ResourceConfig.FEATURE_DISABLE_WADL, Boolean.TRUE);
// }
// }
// else {
// rc.getFeatures().put(ResourceConfig.FEATURE_DISABLE_WADL, Boolean.TRUE);
// }
//
rc.register(r);
rc.register(ReloadResource.class);
rc.register(new MultiPartFeature());
// rc.register(getJsonFeature());
rc.register(new AbstractBinder() {
@Override
protected void configure() {
AbstractActiveDescriptor<Reloader> descriptor = BuilderHelper.createConstantDescriptor(r);
descriptor.addContractType(Reloader.class);
bind(descriptor);
AbstractActiveDescriptor<ServerContext> scDescriptor = BuilderHelper.createConstantDescriptor(sc);
scDescriptor.addContractType(ServerContext.class);
bind(scDescriptor);
LocatorBridge locatorBridge = new LocatorBridge(habitat);
AbstractActiveDescriptor<LocatorBridge> hDescriptor = BuilderHelper.createConstantDescriptor(locatorBridge);
bind(hDescriptor);
RestSessionManager rsm = habitat.getService(RestSessionManager.class);
AbstractActiveDescriptor<RestSessionManager> rmDescriptor = BuilderHelper.createConstantDescriptor(rsm);
bind(rmDescriptor);
}
});
for (Binder b : additionalBinders) {
rc.register(b);
}
rc.property(MessageProperties.LEGACY_WORKERS_ORDERING, true);
return rc;
}
Aggregations