use of org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration in project jphp by jphp-compiler.
the class PWebServer method _makeHandlers.
protected WebServerConfig.Handlers _makeHandlers() {
return new WebServerConfig.Handlers() {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
for (ArrayMemory handler : staticHandlers) {
Memory path = handler.valueOfIndex("path");
ResourceHandlerRegistration registration;
if (path.isArray()) {
registration = registry.addResourceHandler(path.toValue(ArrayMemory.class).toStringArray());
} else {
registration = registry.addResourceHandler(path.toString());
}
Memory cachePeriod = handler.valueOfIndex("cachePeriod");
registration.setCachePeriod(cachePeriod.isNull() ? null : cachePeriod.toInteger());
Memory location = handler.valueOfIndex("location");
if (location.isArray()) {
registration.addResourceLocations(location.toValue(ArrayMemory.class).toStringArray());
} else {
registration.addResourceLocations(location.toString());
}
ResourceChainRegistration chain = registration.resourceChain(handler.valueOfIndex("cache").toBoolean());
if (handler.valueOfIndex("gzip").toBoolean()) {
chain.addResolver(new GzipResourceResolver());
}
chain.addResolver(new PathResourceResolver());
}
}
};
}
use of org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration in project wombat by PLOS.
the class SpringMvcConfiguration method addResourceHandlers.
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
ResourceHandlerRegistration registration = registry.addResourceHandler(AssetService.AssetUrls.RESOURCE_TEMPLATE);
registration.addResourceLocations("/" + AssetService.AssetUrls.RESOURCE_NAMESPACE + "/");
}
Aggregations