*/
private void fixupLogsServletLocation() {
// Must be same as up in hadoop.
final String logsContextPath = "/logs";
// Now, put my logs in place of hadoops... disable old one first.
Context oldLogsContext = null;
for (Map.Entry<Context, Boolean> e : defaultContexts.entrySet()) {
if (e.getKey().getContextPath().equals(logsContextPath)) {
oldLogsContext = e.getKey();
break;
}
}
if (oldLogsContext != null) {
this.defaultContexts.put(oldLogsContext, Boolean.FALSE);
}
// Now do my logs.
// Set up the context for "/logs/" if "hbase.log.dir" property is defined.
String logDir = System.getProperty("hbase.log.dir");
if (logDir != null) {
// This is a little presumptious but seems to work.
Context logContext =
new Context((ContextHandlerCollection)this.webServer.getHandler(),
logsContextPath);
logContext.setResourceBase(logDir);
logContext.addServlet(DefaultServlet.class, "/");
HttpServerUtil.constrainHttpMethods(logContext);
defaultContexts.put(logContext, true);
}
}