sirius.web.resources.ClasspathCustomizationResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sirius-web Show documentation
Show all versions of sirius-web Show documentation
Provides a modern and scalable web server as SIRIUS module
/*
* Made with all the love in the world
* by scireum in Remshalden, Germany
*
* Copyright by scireum GmbH
* http://www.scireum.de - [email protected]
*/
package sirius.web.resources;
import sirius.kernel.Sirius;
import sirius.kernel.di.std.Register;
import java.net.URL;
/**
* Simple resolver which tries to find the given resource in the classpath of the enabled customizations.
*/
@Register
public class ClasspathCustomizationResolver implements Resolver {
@Override
public Resource resolve(String scopeId, String resource) {
URL effectiveUrl = null;
for (String config : Sirius.getActiveConfigurations()) {
URL url = getClass().getResource("/customizations/" + config + resource);
if (url != null) {
effectiveUrl = url;
}
}
if (effectiveUrl == null) {
return null;
}
return Resource.constantResource(scopeId, resource, effectiveUrl);
}
@Override
public int getPriority() {
return 90;
}
}