org.apache.hadoop.hdfs.server.namenode
Class FileDataServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.hadoop.hdfs.server.namenode.FileDataServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

@InterfaceAudience.Private
public class FileDataServlet
extends javax.servlet.http.HttpServlet

Redirect queries about the hosted filesystem to an appropriate datanode.

See Also:
HftpFileSystem, Serialized Form

Constructor Summary
FileDataServlet()
           
 
Method Summary
protected  ClientProtocol createNameNodeProxy()
          Create a NameNode proxy from the current ServletContext.
protected  URI createRedirectUri(String servletpath, org.apache.hadoop.security.UserGroupInformation ugi, DatanodeID host, javax.servlet.http.HttpServletRequest request, NameNode nn)
          Create a URI for redirecting request
protected  URI createUri(String parent, HdfsFileStatus i, org.apache.hadoop.security.UserGroupInformation ugi, ClientProtocol nnproxy, javax.servlet.http.HttpServletRequest request, String dt)
          Create a redirection URI
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Service a GET request as described below.
protected  String getFilename(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get filename from the request
protected  org.apache.hadoop.security.UserGroupInformation getUGI(javax.servlet.http.HttpServletRequest request, org.apache.hadoop.conf.Configuration conf)
           
protected  void writeXml(Exception except, String path, org.znerd.xmlenc.XMLOutputter doc)
          Write the object to XML format
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDataServlet

public FileDataServlet()
Method Detail

createUri

protected URI createUri(String parent,
                        HdfsFileStatus i,
                        org.apache.hadoop.security.UserGroupInformation ugi,
                        ClientProtocol nnproxy,
                        javax.servlet.http.HttpServletRequest request,
                        String dt)
                 throws IOException,
                        URISyntaxException
Create a redirection URI

Throws:
IOException
URISyntaxException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws IOException
Service a GET request as described below. Request: GET http://<nn>:<port>/data[/<path>] HTTP/1.1

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
IOException

writeXml

protected void writeXml(Exception except,
                        String path,
                        org.znerd.xmlenc.XMLOutputter doc)
                 throws IOException
Write the object to XML format

Throws:
IOException

createNameNodeProxy

protected ClientProtocol createNameNodeProxy()
                                      throws IOException
Create a NameNode proxy from the current ServletContext.

Throws:
IOException

createRedirectUri

protected URI createRedirectUri(String servletpath,
                                org.apache.hadoop.security.UserGroupInformation ugi,
                                DatanodeID host,
                                javax.servlet.http.HttpServletRequest request,
                                NameNode nn)
                         throws IOException,
                                URISyntaxException
Create a URI for redirecting request

Throws:
IOException
URISyntaxException

getFilename

protected String getFilename(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws IOException
Get filename from the request

Throws:
IOException

getUGI

protected org.apache.hadoop.security.UserGroupInformation getUGI(javax.servlet.http.HttpServletRequest request,
                                                                 org.apache.hadoop.conf.Configuration conf)
                                                          throws IOException
Throws:
IOException


Copyright © 2009 The Apache Software Foundation