org.apache.hadoop.util
Class ServletUtil

java.lang.Object
  extended by org.apache.hadoop.util.ServletUtil

public class ServletUtil
extends Object


Field Summary
static String HTML_TAIL
           
 
Constructor Summary
ServletUtil()
           
 
Method Summary
static String encodePath(String path)
          Escape and encode a string regarded as the path component of an URI.
static String encodeQueryValue(String value)
          Escape and encode a string regarded as within the query component of an URI.
static String getDecodedPath(javax.servlet.http.HttpServletRequest request, String servletName)
          Parse and decode the path component from the given request.
static String getParameter(javax.servlet.ServletRequest request, String name)
          Get a parameter from a ServletRequest.
static String getRawPath(javax.servlet.http.HttpServletRequest request, String servletName)
          Parse the path component from the given request and return w/o decoding.
static String htmlFooter()
          HTML footer to be added in the jsps.
static PrintWriter initHTML(javax.servlet.ServletResponse response, String title)
          Initial HTML header
static String percentageGraph(float perc, int width)
          Generate the percentage graph and returns HTML representation string of the same.
static String percentageGraph(int perc, int width)
          Generate the percentage graph and returns HTML representation string of the same.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML_TAIL

public static final String HTML_TAIL
Constructor Detail

ServletUtil

public ServletUtil()
Method Detail

initHTML

public static PrintWriter initHTML(javax.servlet.ServletResponse response,
                                   String title)
                            throws IOException
Initial HTML header

Throws:
IOException

getParameter

public static String getParameter(javax.servlet.ServletRequest request,
                                  String name)
Get a parameter from a ServletRequest. Return null if the parameter contains only white spaces.


htmlFooter

public static String htmlFooter()
HTML footer to be added in the jsps.

Returns:
the HTML footer.

percentageGraph

public static String percentageGraph(int perc,
                                     int width)
                              throws IOException
Generate the percentage graph and returns HTML representation string of the same.

Parameters:
perc - The percentage value for which graph is to be generated
width - The width of the display table
Returns:
HTML String representation of the percentage graph
Throws:
IOException

percentageGraph

public static String percentageGraph(float perc,
                                     int width)
                              throws IOException
Generate the percentage graph and returns HTML representation string of the same.

Parameters:
perc - The percentage value for which graph is to be generated
width - The width of the display table
Returns:
HTML String representation of the percentage graph
Throws:
IOException

encodeQueryValue

public static String encodeQueryValue(String value)
Escape and encode a string regarded as within the query component of an URI.

Parameters:
value - the value to encode
Returns:
encoded query, null if UTF-8 is not supported

encodePath

public static String encodePath(String path)
Escape and encode a string regarded as the path component of an URI.

Parameters:
path - the path component to encode
Returns:
encoded path, null if UTF-8 is not supported

getDecodedPath

public static String getDecodedPath(javax.servlet.http.HttpServletRequest request,
                                    String servletName)
Parse and decode the path component from the given request.

Parameters:
request - Http request to parse
servletName - the name of servlet that precedes the path
Returns:
decoded path component, null if UTF-8 is not supported

getRawPath

public static String getRawPath(javax.servlet.http.HttpServletRequest request,
                                String servletName)
Parse the path component from the given request and return w/o decoding.

Parameters:
request - Http request to parse
servletName - the name of servlet that precedes the path
Returns:
path component, null if the default charset is not supported


Copyright © 2009 The Apache Software Foundation