HBASE-785 Remove InfoServer, use HADOOP-3824 StatusHttpServer; fix broken build

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@709350 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-10-31 05:12:18 +00:00
parent 9dbddf3da4
commit ea06419301
1 changed files with 18 additions and 7 deletions

View File

@ -56,10 +56,6 @@ public class InfoServer extends HttpServer{
logContext.addHandler(new ResourceHandler());
webServer.addContext(logContext);
}
if (name.equals("master")) {
// Put up the rest webapp.
this.webServer.addWebApplication("/api", getWebAppDir("rest"));
}
}
/**
@ -67,10 +63,25 @@ public class InfoServer extends HttpServer{
* @param path Path to find.
* @return the pathname as a URL
*/
private static String getWebAppsPath(final String path) throws IOException {
protected String getWebAppsPath() throws IOException {
// Hack: webapps is not a unique enough element to find in CLASSPATH
// We'll more than likely find the hadoop webapps dir. So, instead
// look for the 'master' webapp in the webapps subdir. That should
// get us the hbase context. Presumption is that place where the
// master webapp resides is where we want this InfoServer picking up
// web applications.
final String master = "master";
String p = getWebAppDir(master);
// Now strip master + the separator off the end of our context
return p.substring(0, p.length() - (master.length() + 1/* The separator*/));
}
private static String getWebAppsPath(final String path)
throws IOException {
URL url = InfoServer.class.getClassLoader().getResource(path);
if (url == null)
throw new IOException("webapps not found in CLASSPATH: " + path);
System.out.println("URL " + url);
return url.toString();
}
@ -80,7 +91,8 @@ public class InfoServer extends HttpServer{
* @return path
* @throws IOException
*/
public static String getWebAppDir(final String webappName) throws IOException {
public static String getWebAppDir(final String webappName)
throws IOException {
String webappDir = null;
try {
webappDir = getWebAppsPath("webapps" + File.separator + webappName);
@ -90,5 +102,4 @@ public class InfoServer extends HttpServer{
}
return webappDir;
}
}