package org.apache.hadoop.dfs;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import org.apache.hadoop.dfs.*;
import org.apache.hadoop.util.*;
import java.text.DateFormat;
import java.net.InetAddress;
import java.net.URLEncoder;
public final class nn_005fbrowsedfscontent_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
FSNamesystem fsn = FSNamesystem.getFSNamesystem();
public void redirectToRandomDataNode(HttpServletResponse resp) throws IOException {
String datanode = fsn.randomDataNode();
String redirectLocation;
String nodeToRedirect;
int redirectPort;
if (datanode != null) {
redirectPort = Integer.parseInt(datanode.substring(datanode.indexOf(':') + 1));
nodeToRedirect = datanode.substring(0, datanode.indexOf(':'));
}
else {
nodeToRedirect = fsn.getDFSNameNodeMachine();
redirectPort = fsn.getNameNodeInfoPort();
}
String fqdn = InetAddress.getByName(nodeToRedirect).getCanonicalHostName();
redirectLocation = "http://" + fqdn + ":" + redirectPort +
"/browseDirectory.jsp?namenodeInfoPort=" +
fsn.getNameNodeInfoPort() +
"&dir=" + URLEncoder.encode("/", "UTF-8");
resp.sendRedirect(redirectLocation);
}
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\n');
out.write("\n\n<html>\n\n<title></title>\n\n<body>\n");
redirectToRandomDataNode(response);
out.write("\n<hr>\n\n<h2>Local logs</h2>\n<a href=\"/logs/\">Log</a> directory\n\n");
out.println(ServletUtil.htmlFooter());
out.write('\n');
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}