org.apache.hadoop.hdfs.server.common
Class JspHelper

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.common.JspHelper

@InterfaceAudience.Private
public class JspHelper
extends Object


Field Summary
static String CURRENT_CONF
           
static String DELEGATION_PARAMETER_NAME
           
static String WEB_UGI_PROPERTY_NAME
           
 
Method Summary
static void addTableFooter(javax.servlet.jsp.JspWriter out)
           
static void addTableHeader(javax.servlet.jsp.JspWriter out)
           
static void addTableRow(javax.servlet.jsp.JspWriter out, String[] columns)
           
static void addTableRow(javax.servlet.jsp.JspWriter out, String[] columns, int row)
           
static DatanodeInfo bestNode(DatanodeInfo[] nodes, boolean doRandom)
           
static DatanodeInfo bestNode(LocatedBlock blk)
           
static DatanodeInfo bestNode(LocatedBlocks blks)
           
static void createTitle(javax.servlet.jsp.JspWriter out, javax.servlet.http.HttpServletRequest req, String file)
           
static org.apache.hadoop.security.UserGroupInformation getDefaultWebUser(org.apache.hadoop.conf.Configuration conf)
          If security is turned off, what is the default web user?
static String getDelegationTokenUrlParam(String tokenString)
          Returns the url parameter for the given token string.
static org.apache.hadoop.security.UserGroupInformation getUGI(javax.servlet.http.HttpServletRequest request, org.apache.hadoop.conf.Configuration conf)
          Get UserGroupInformation and possibly the delegation token out of the request.
static String getUrlParam(String name, String val)
          Returns the url parameter for the given string, prefixed with '&'.
static String getUrlParam(String name, String val, boolean firstParam)
          Returns the url parameter for the given string, prefixed with '?' if firstParam is true, prefixed with '&' if firstParam is false.
static String getUrlParam(String name, String val, String paramSeparator)
          Returns the url parameter for the given string, prefixed with paramSeparator.
static String getVersionTable()
          Return a table containing version information.
static void printGotoForm(javax.servlet.jsp.JspWriter out, int namenodeInfoPort, String tokenString, String file)
           
static void printPathWithLinks(String dir, javax.servlet.jsp.JspWriter out, int namenodeInfoPort, String tokenString)
           
static void sortNodeList(ArrayList<DatanodeDescriptor> nodes, String field, String order)
           
static void streamBlockInAscii(InetSocketAddress addr, long blockId, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, long genStamp, long blockSize, long offsetIntoBlock, long chunkSizeToView, javax.servlet.jsp.JspWriter out, org.apache.hadoop.conf.Configuration conf)
           
static int string2ChunkSizeToView(String s, int defaultValue)
          Convert a String to chunk-size-to-view.
static Long validateLong(String value)
          Validate a long value.
static String validatePath(String p)
          Validate filename.
static String validateURL(String value)
          Validate a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_CONF

public static final String CURRENT_CONF
See Also:
Constant Field Values

WEB_UGI_PROPERTY_NAME

public static final String WEB_UGI_PROPERTY_NAME
See Also:
Constant Field Values

DELEGATION_PARAMETER_NAME

public static final String DELEGATION_PARAMETER_NAME
See Also:
Constant Field Values
Method Detail

bestNode

public static DatanodeInfo bestNode(LocatedBlocks blks)
                             throws IOException
Throws:
IOException

bestNode

public static DatanodeInfo bestNode(LocatedBlock blk)
                             throws IOException
Throws:
IOException

bestNode

public static DatanodeInfo bestNode(DatanodeInfo[] nodes,
                                    boolean doRandom)
                             throws IOException
Throws:
IOException

streamBlockInAscii

public static void streamBlockInAscii(InetSocketAddress addr,
                                      long blockId,
                                      org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
                                      long genStamp,
                                      long blockSize,
                                      long offsetIntoBlock,
                                      long chunkSizeToView,
                                      javax.servlet.jsp.JspWriter out,
                                      org.apache.hadoop.conf.Configuration conf)
                               throws IOException
Throws:
IOException

addTableHeader

public static void addTableHeader(javax.servlet.jsp.JspWriter out)
                           throws IOException
Throws:
IOException

addTableRow

public static void addTableRow(javax.servlet.jsp.JspWriter out,
                               String[] columns)
                        throws IOException
Throws:
IOException

addTableRow

public static void addTableRow(javax.servlet.jsp.JspWriter out,
                               String[] columns,
                               int row)
                        throws IOException
Throws:
IOException

addTableFooter

public static void addTableFooter(javax.servlet.jsp.JspWriter out)
                           throws IOException
Throws:
IOException

sortNodeList

public static void sortNodeList(ArrayList<DatanodeDescriptor> nodes,
                                String field,
                                String order)

printPathWithLinks

public static void printPathWithLinks(String dir,
                                      javax.servlet.jsp.JspWriter out,
                                      int namenodeInfoPort,
                                      String tokenString)
                               throws IOException
Throws:
IOException

printGotoForm

public static void printGotoForm(javax.servlet.jsp.JspWriter out,
                                 int namenodeInfoPort,
                                 String tokenString,
                                 String file)
                          throws IOException
Throws:
IOException

createTitle

public static void createTitle(javax.servlet.jsp.JspWriter out,
                               javax.servlet.http.HttpServletRequest req,
                               String file)
                        throws IOException
Throws:
IOException

string2ChunkSizeToView

public static int string2ChunkSizeToView(String s,
                                         int defaultValue)
Convert a String to chunk-size-to-view.


getVersionTable

public static String getVersionTable()
Return a table containing version information.


validatePath

public static String validatePath(String p)
Validate filename.

Returns:
null if the filename is invalid. Otherwise, return the validated filename.

validateLong

public static Long validateLong(String value)
Validate a long value.

Returns:
null if the value is invalid. Otherwise, return the validated Long object.

validateURL

public static String validateURL(String value)
Validate a URL.

Returns:
null if the value is invalid. Otherwise, return the validated URL String.

getDefaultWebUser

public static org.apache.hadoop.security.UserGroupInformation getDefaultWebUser(org.apache.hadoop.conf.Configuration conf)
                                                                         throws IOException
If security is turned off, what is the default web user?

Parameters:
conf - the configuration to look in
Returns:
the remote user that was configuration
Throws:
IOException

getUGI

public static org.apache.hadoop.security.UserGroupInformation getUGI(javax.servlet.http.HttpServletRequest request,
                                                                     org.apache.hadoop.conf.Configuration conf)
                                                              throws IOException
Get UserGroupInformation and possibly the delegation token out of the request.

Parameters:
request - the http request
Returns:
a new user from the request
Throws:
org.apache.hadoop.security.AccessControlException - if the request has no token
IOException

getDelegationTokenUrlParam

public static String getDelegationTokenUrlParam(String tokenString)
Returns the url parameter for the given token string.

Parameters:
tokenString -
Returns:
url parameter

getUrlParam

public static String getUrlParam(String name,
                                 String val,
                                 String paramSeparator)
Returns the url parameter for the given string, prefixed with paramSeparator.

Parameters:
name - parameter name
val - parameter value
paramSeparator - URL parameter prefix, i.e. either '?' or '&'
Returns:
url parameter

getUrlParam

public static String getUrlParam(String name,
                                 String val,
                                 boolean firstParam)
Returns the url parameter for the given string, prefixed with '?' if firstParam is true, prefixed with '&' if firstParam is false.

Parameters:
name - parameter name
val - parameter value
firstParam - true if this is the first parameter in the list, false otherwise
Returns:
url parameter

getUrlParam

public static String getUrlParam(String name,
                                 String val)
Returns the url parameter for the given string, prefixed with '&'.

Parameters:
name - parameter name
val - parameter value
Returns:
url parameter


Copyright © 2009 The Apache Software Foundation