use of org.springframework.web.context.support.ServletContextResource in project grails-core by grails.
the class GrailsWebApplicationContext method prepareBeanFactory.
@Override
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
if (configLocations.length > 0) {
for (String configLocation : configLocations) {
BeanBuilder beanBuilder = new BeanBuilder(getParent(), getClassLoader());
final ServletContextResource resource = new ServletContextResource(getServletContext(), configLocation);
beanBuilder.loadBeans(resource);
beanBuilder.registerBeans(this);
}
}
super.prepareBeanFactory(beanFactory);
}
use of org.springframework.web.context.support.ServletContextResource in project spring-framework by spring-projects.
the class PathResourceResolverTests method checkServletContextResource.
// SPR-12432
@Test
public void checkServletContextResource() throws Exception {
Resource classpathLocation = new ClassPathResource("test/", PathResourceResolver.class);
MockServletContext context = new MockServletContext();
ServletContextResource servletContextLocation = new ServletContextResource(context, "/webjars/");
ServletContextResource resource = new ServletContextResource(context, "/webjars/webjar-foo/1.0/foo.js");
assertFalse(this.resolver.checkResource(resource, classpathLocation));
assertTrue(this.resolver.checkResource(resource, servletContextLocation));
}
use of org.springframework.web.context.support.ServletContextResource in project OpenClinica by OpenClinica.
the class SpringServletAccess method getPropertiesDir.
public static String getPropertiesDir(ServletContext servletContext) {
String resource = "properties/placeholder.properties";
ServletContextResource scr = (ServletContextResource) getApplicationContext(servletContext).getResource(resource);
String absolutePath = null;
try {
absolutePath = scr.getFile().getAbsolutePath();
} catch (IOException e) {
throw new OpenClinicaSystemException(e.getMessage(), e.fillInStackTrace());
}
absolutePath = absolutePath.replaceAll("placeholder.properties", "");
return absolutePath;
}
use of org.springframework.web.context.support.ServletContextResource in project OpenClinica by OpenClinica.
the class SpringServletAccess method getPropertiesDir.
public static String getPropertiesDir(ServletContext servletContext) {
String resource = "properties/placeholder.properties";
ServletContextResource scr = (ServletContextResource) getApplicationContext(servletContext).getResource(resource);
String absolutePath = null;
try {
absolutePath = scr.getFile().getAbsolutePath();
} catch (IOException e) {
throw new OpenClinicaSystemException(e.getMessage(), e.fillInStackTrace());
}
absolutePath = absolutePath.replaceAll("placeholder.properties", "");
return absolutePath;
}
Aggregations