}
//
final BridgeContext bridgeContext = new AbstractBridgeContext() {
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
final ResourceResolver resolver = new ResourceResolver() {
public URL resolve(String uri) {
try {
return context.getResource(uri);
}
catch (MalformedURLException e) {
return null;
}
}
};
public ReadFileSystem<?> getResourcePath() {
return WarFileSystem.create(context, "/WEB-INF/");
}
public ReadFileSystem<?> getClassPath() {
return WarFileSystem.create(context, "/WEB-INF/classes/");
}
public ClassLoader getClassLoader() {
return classLoader;
}
public String getInitParameter(String name) {
return context.getInitParameter(name);
}
public ResourceResolver getResolver() {
return resolver;
}
public Object getAttribute(String key) {
return context.getAttribute(key);
}
public void setAttribute(String key, Object value) {
context.setAttribute(key, value);
}
};
//
InjectorProvider injectorProvider = bridgeConfig.injectorProvider;
if (injectorProvider == null) {
throw new UnavailableException("No inject implementation selected");
} else {
portletLogger.info("Using inject implementation " + injectorProvider.getValue());
}
//
Injector injector = injectorProvider.get();
if (injector instanceof SpringInjector) {
SpringInjector springInjector = (SpringInjector)injector;
Object parent = context.getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
if (parent != null) {
springInjector.setParent(parent);
}
}
//
ResourceResolver resolver = new ResourceResolver() {
public URL resolve(String uri) {
try {
return context.getResource(uri);
}
catch (MalformedURLException e) {