// Injected by Felix DM...
private volatile HttpService m_http;
private volatile BundleContext m_bundleContext;
public void start() throws Exception {
final HttpContext context = m_http.createDefaultHttpContext();
m_http.registerResources(RESOURCE_PATH, RESOURCE_PATH, new HttpContext() {
public String getMimeType(String name) {
return context.getMimeType(name);
}
/**
* ACE uses a slightly modified version of the 'reindeer' theme. To avoid having to copy all resources in
* the Vaadin jar, we only override the files we changed and do replace the theme name 'ace' with 'reindeer'
* before we go looking for the original files.
*
* When updating to a new Vaadin version, usually you need to copy the styles.css file from the original
* archive again and append the ACE changes to the end, as this file tends to change considerably between
* versions.
*/
public URL getResource(String name) {
URL resource = null;
// fix for ACE-156
if (!name.startsWith("/")) {
name = "/".concat(name);
}
String prefix = RESOURCE_PATH.concat("/");
if (name.startsWith(prefix)) {
String originalName = name.replace("/ace/", "/reindeer/");
resource = m_bundleContext.getBundle().getEntry(originalName);
if (resource == null) {
// try to find the resource in the Vaadin bundle instead
resource = com.vaadin.Application.class.getResource(originalName);
}
}
return resource;
}
public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
return context.handleSecurity(request, response);
}
});
}