Java Code Examples for org.apache.hadoop.util.ServletUtil#getParameter()
The following examples show how to use
org.apache.hadoop.util.ServletUtil#getParameter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageServlet.java From hadoop with Apache License 2.0 | 5 votes |
/** * @param request the object from which this servlet reads the url contents * @param response the object into which this servlet writes the url contents * @throws IOException if the request is bad */ public GetImageParams(HttpServletRequest request, HttpServletResponse response ) throws IOException { @SuppressWarnings("unchecked") Map<String, String[]> pmap = request.getParameterMap(); isGetImage = isGetEdit = fetchLatest = false; for (Map.Entry<String, String[]> entry : pmap.entrySet()) { String key = entry.getKey(); String[] val = entry.getValue(); if (key.equals("getimage")) { isGetImage = true; try { txId = ServletUtil.parseLongParam(request, TXID_PARAM); String imageType = ServletUtil.getParameter(request, IMAGE_FILE_TYPE); nnf = imageType == null ? NameNodeFile.IMAGE : NameNodeFile .valueOf(imageType); } catch (NumberFormatException nfe) { if (request.getParameter(TXID_PARAM).equals(LATEST_FSIMAGE_VALUE)) { fetchLatest = true; } else { throw nfe; } } } else if (key.equals("getedit")) { isGetEdit = true; startTxId = ServletUtil.parseLongParam(request, START_TXID_PARAM); endTxId = ServletUtil.parseLongParam(request, END_TXID_PARAM); } else if (key.equals(STORAGEINFO_PARAM)) { storageInfoString = val[0]; } } int numGets = (isGetImage?1:0) + (isGetEdit?1:0); if ((numGets > 1) || (numGets == 0)) { throw new IOException("Illegal parameters to TransferFsImage"); } }
Example 2
Source File: ImageServlet.java From hadoop with Apache License 2.0 | 5 votes |
public PutImageParams(HttpServletRequest request, HttpServletResponse response, Configuration conf) throws IOException { txId = ServletUtil.parseLongParam(request, TXID_PARAM); storageInfoString = ServletUtil.getParameter(request, STORAGEINFO_PARAM); fileSize = ServletUtil.parseLongParam(request, TransferFsImage.FILE_LENGTH); String imageType = ServletUtil.getParameter(request, IMAGE_FILE_TYPE); nnf = imageType == null ? NameNodeFile.IMAGE : NameNodeFile .valueOf(imageType); if (fileSize == 0 || txId == -1 || storageInfoString == null || storageInfoString.isEmpty()) { throw new IOException("Illegal parameters to TransferFsImage"); } }
Example 3
Source File: LogLevel.java From hadoop with Apache License 2.0 | 5 votes |
@Override public void doGet(HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { // Do the authorization if (!HttpServer2.hasAdministratorAccess(getServletContext(), request, response)) { return; } PrintWriter out = ServletUtil.initHTML(response, "Log Level"); String logName = ServletUtil.getParameter(request, "log"); String level = ServletUtil.getParameter(request, "level"); if (logName != null) { out.println("<br /><hr /><h3>Results</h3>"); out.println(MARKER + "Submitted Log Name: <b>" + logName + "</b><br />"); Log log = LogFactory.getLog(logName); out.println(MARKER + "Log Class: <b>" + log.getClass().getName() +"</b><br />"); if (level != null) { out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />"); } if (log instanceof Log4JLogger) { process(((Log4JLogger)log).getLogger(), level, out); } else if (log instanceof Jdk14Logger) { process(((Jdk14Logger)log).getLogger(), level, out); } else { out.println("Sorry, " + log.getClass() + " not supported.<br />"); } } out.println(FORMS); out.println(ServletUtil.HTML_TAIL); }
Example 4
Source File: ImageServlet.java From big-c with Apache License 2.0 | 5 votes |
/** * @param request the object from which this servlet reads the url contents * @param response the object into which this servlet writes the url contents * @throws IOException if the request is bad */ public GetImageParams(HttpServletRequest request, HttpServletResponse response ) throws IOException { @SuppressWarnings("unchecked") Map<String, String[]> pmap = request.getParameterMap(); isGetImage = isGetEdit = fetchLatest = false; for (Map.Entry<String, String[]> entry : pmap.entrySet()) { String key = entry.getKey(); String[] val = entry.getValue(); if (key.equals("getimage")) { isGetImage = true; try { txId = ServletUtil.parseLongParam(request, TXID_PARAM); String imageType = ServletUtil.getParameter(request, IMAGE_FILE_TYPE); nnf = imageType == null ? NameNodeFile.IMAGE : NameNodeFile .valueOf(imageType); } catch (NumberFormatException nfe) { if (request.getParameter(TXID_PARAM).equals(LATEST_FSIMAGE_VALUE)) { fetchLatest = true; } else { throw nfe; } } } else if (key.equals("getedit")) { isGetEdit = true; startTxId = ServletUtil.parseLongParam(request, START_TXID_PARAM); endTxId = ServletUtil.parseLongParam(request, END_TXID_PARAM); } else if (key.equals(STORAGEINFO_PARAM)) { storageInfoString = val[0]; } } int numGets = (isGetImage?1:0) + (isGetEdit?1:0); if ((numGets > 1) || (numGets == 0)) { throw new IOException("Illegal parameters to TransferFsImage"); } }
Example 5
Source File: ImageServlet.java From big-c with Apache License 2.0 | 5 votes |
public PutImageParams(HttpServletRequest request, HttpServletResponse response, Configuration conf) throws IOException { txId = ServletUtil.parseLongParam(request, TXID_PARAM); storageInfoString = ServletUtil.getParameter(request, STORAGEINFO_PARAM); fileSize = ServletUtil.parseLongParam(request, TransferFsImage.FILE_LENGTH); String imageType = ServletUtil.getParameter(request, IMAGE_FILE_TYPE); nnf = imageType == null ? NameNodeFile.IMAGE : NameNodeFile .valueOf(imageType); if (fileSize == 0 || txId == -1 || storageInfoString == null || storageInfoString.isEmpty()) { throw new IOException("Illegal parameters to TransferFsImage"); } }
Example 6
Source File: LogLevel.java From big-c with Apache License 2.0 | 5 votes |
@Override public void doGet(HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { // Do the authorization if (!HttpServer2.hasAdministratorAccess(getServletContext(), request, response)) { return; } PrintWriter out = ServletUtil.initHTML(response, "Log Level"); String logName = ServletUtil.getParameter(request, "log"); String level = ServletUtil.getParameter(request, "level"); if (logName != null) { out.println("<br /><hr /><h3>Results</h3>"); out.println(MARKER + "Submitted Log Name: <b>" + logName + "</b><br />"); Log log = LogFactory.getLog(logName); out.println(MARKER + "Log Class: <b>" + log.getClass().getName() +"</b><br />"); if (level != null) { out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />"); } if (log instanceof Log4JLogger) { process(((Log4JLogger)log).getLogger(), level, out); } else if (log instanceof Jdk14Logger) { process(((Jdk14Logger)log).getLogger(), level, out); } else { out.println("Sorry, " + log.getClass() + " not supported.<br />"); } } out.println(FORMS); out.println(ServletUtil.HTML_TAIL); }
Example 7
Source File: LogLevel.java From RDFS with Apache License 2.0 | 5 votes |
public void doGet(HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { PrintWriter out = ServletUtil.initHTML(response, "Log Level"); String logName = ServletUtil.getParameter(request, "log"); String level = ServletUtil.getParameter(request, "level"); if (logName != null) { out.println("<br /><hr /><h3>Results</h3>"); out.println(MARKER + "Submitted Log Name: <b>" + logName + "</b><br />"); Log log = LogFactory.getLog(logName); out.println(MARKER + "Log Class: <b>" + log.getClass().getName() +"</b><br />"); if (level != null) { out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />"); } if (log instanceof Log4JLogger) { process(((Log4JLogger)log).getLogger(), level, out); } else if (log instanceof Jdk14Logger) { process(((Jdk14Logger)log).getLogger(), level, out); } else { out.println("Sorry, " + log.getClass() + " not supported.<br />"); } } out.println(FORMS); out.println(ServletUtil.HTML_TAIL); }
Example 8
Source File: LogLevel.java From hadoop-gpu with Apache License 2.0 | 5 votes |
public void doGet(HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { PrintWriter out = ServletUtil.initHTML(response, "Log Level"); String logName = ServletUtil.getParameter(request, "log"); String level = ServletUtil.getParameter(request, "level"); if (logName != null) { out.println("<br /><hr /><h3>Results</h3>"); out.println(MARKER + "Submitted Log Name: <b>" + logName + "</b><br />"); Log log = LogFactory.getLog(logName); out.println(MARKER + "Log Class: <b>" + log.getClass().getName() +"</b><br />"); if (level != null) { out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />"); } if (log instanceof Log4JLogger) { process(((Log4JLogger)log).getLogger(), level, out); } else if (log instanceof Jdk14Logger) { process(((Jdk14Logger)log).getLogger(), level, out); } else { out.println("Sorry, " + log.getClass() + " not supported.<br />"); } } out.println(FORMS); out.println(ServletUtil.HTML_TAIL); }