List of usage examples for javax.servlet.jsp JspWriter print
abstract public void print(Object obj) throws IOException;
From source file:org.apache.hadoop.hdfs.server.namenode.JspHelper.java
public static void printGotoForm(JspWriter out, int namenodeInfoPort, String tokenString, String file) throws IOException { out.print("<form action=\"browseDirectory.jsp\" method=\"get\" name=\"goto\">"); out.print("Goto : "); out.print("<input name=\"dir\" type=\"text\" width=\"50\" id\"dir\" value=\"" + file + "\">"); out.print("<input name=\"go\" type=\"submit\" value=\"go\">"); out.print("<input name=\"namenodeInfoPort\" type=\"hidden\" " + "value=\"" + namenodeInfoPort + "\">"); if (UserGroupInformation.isSecurityEnabled()) { out.print("<input name=\"" + DELEGATION_PARAMETER_NAME + "\" type=\"hidden\" value=\"" + tokenString + "\">"); }// w w w. j av a2 s . co m out.print("</form>"); }
From source file:org.apache.hadoop.mapred.JSPUtil.java
/** * Nicely print the Job-ACLs//ww w. ja va 2 s. co m * @param tracker * @param jobAcls * @param out * @throws IOException */ static void printJobACLs(JobTracker tracker, Map<JobACL, AccessControlList> jobAcls, JspWriter out) throws IOException { if (tracker.areACLsEnabled()) { printJobACLsInternal(jobAcls, out); } else { out.print("<b>Job-ACLs: " + new AccessControlList("*").toString() + "</b><br>"); } }
From source file:dk.netarkivet.archive.webinterface.BitpreserveFileState.java
/** * Print a checkbox that on click will turn a number of checkboxes of a certain type on or off. * * @param out The stream to print the checkbox to. * @param command The type of checkbox.//from w ww.j a v a 2s . co m * @param numberOfCheckboxes The total number of checksboxes possible to turn on or off. * @param label The I18N label for the describing text. An input box with the number to change will be added as * parameter {0} in this label. * @param locale The locale for the checkbox. * @throws IOException On trouble printing the checkbox. */ private static void printMultipleToggler(JspWriter out, String command, int numberOfCheckboxes, String label, Locale locale) throws IOException { out.print("<input type=\"checkbox\" id=\"toggle" + command + "\" onclick=\"toggleCheckboxes('" + command + "')\"/>"); out.print(I18N.getString(locale, label, "<input id=\"toggleAmount" + command + "\" value=\"" + Math.min(numberOfCheckboxes, Constants.MAX_TOGGLE_AMOUNT) + "\" />")); out.println("<br/> "); }
From source file:org.apache.hadoop.mapred.JSPUtil.java
static void printJobACLs(JobConf conf, Map<JobACL, AccessControlList> jobAcls, JspWriter out) throws IOException { if (conf.getBoolean(JobConf.MR_ACLS_ENABLED, false)) { printJobACLsInternal(jobAcls, out); } else {// w w w.j ava 2 s . c om out.print("<b>Job-ACLs: " + new AccessControlList("*").toString() + "</b><br>"); } }
From source file:dk.netarkivet.archive.webinterface.BitpreserveFileState.java
/** * Print a table row with current state of a file in a given bitarchive. * * @param out The stream to print state to. * @param baReplica The replica of the files. * @param fs The file preservation state for that file. * @param locale Locale of the labels.//from ww w . ja v a 2 s . com * @throws IOException If an problem occurs when writing to the JspWriter. */ private static void printFileStateForBitarchive(JspWriter out, Replica baReplica, PreservationState fs, Locale locale) throws IOException { log.debug("Printing filestate for bitarchive '" + baReplica.getName() + "'"); out.print(HTMLUtils.makeTableRow(HTMLUtils.makeTableElement(baReplica.getName()), HTMLUtils.makeTableElement(fs.getAdminReplicaState(baReplica)), HTMLUtils.makeTableElement(presentChecksum(fs.getReplicaChecksum(baReplica), locale)))); }
From source file:org.apache.hadoop.hdfs.server.namenode.JspHelper.java
public static void printPathWithLinks(String dir, JspWriter out, int namenodeInfoPort, String tokenString) throws IOException { try {/* ww w .j a v a 2 s. co m*/ String[] parts = dir.split(Path.SEPARATOR); StringBuilder tempPath = new StringBuilder(dir.length()); out.print("<a href=\"browseDirectory.jsp" + "?dir=" + Path.SEPARATOR + "&namenodeInfoPort=" + namenodeInfoPort + getDelegationTokenUrlParam(tokenString) + "\">" + Path.SEPARATOR + "</a>"); tempPath.append(Path.SEPARATOR); for (int i = 0; i < parts.length - 1; i++) { if (!parts[i].equals("")) { tempPath.append(parts[i]); out.print("<a href=\"browseDirectory.jsp" + "?dir=" + tempPath.toString() + "&namenodeInfoPort=" + namenodeInfoPort + getDelegationTokenUrlParam(tokenString)); out.print("\">" + parts[i] + "</a>" + Path.SEPARATOR); tempPath.append(Path.SEPARATOR); } } if (parts.length > 0) { out.print(parts[parts.length - 1]); } } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } }
From source file:org.apache.hadoop.hdfs.server.namenode.JspHelper.java
public static void createTitle(JspWriter out, HttpServletRequest req, String file) throws IOException { if (file == null) file = ""; int start = Math.max(0, file.length() - 100); if (start != 0) file = "..." + file.substring(start, file.length()); out.print("<title>HDFS:" + file + "</title>"); }
From source file:dk.netarkivet.archive.webinterface.BitpreserveFileState.java
/** * Print a file state table for a file. This will present the state of the file in admin data and all bitarchives. * * @param out The stream to print to./*from w w w . j a v a 2s . com*/ * @param fs The file state for the file. * @param locale The locale to print labels in. * @throws IOException On trouble printing to a stream. */ public static void printFileState(JspWriter out, PreservationState fs, Locale locale) throws IOException { ArgumentNotValid.checkNotNull(out, "JspWriter out"); ArgumentNotValid.checkNotNull(fs, "FilePreservationState fs"); ArgumentNotValid.checkNotNull(locale, "Locale locale"); // Table headers for info table out.println("<table>"); out.print(HTMLUtils.makeTableRow(HTMLUtils.makeTableHeader(I18N.getString(locale, "replica")), HTMLUtils.makeTableHeader(I18N.getString(locale, "admin.state")), HTMLUtils.makeTableHeader(I18N.getString(locale, "checksum")))); // Admin data info printFileStateForAdminData(out, fs, locale); // Info for all bitarchives for (Replica l : Replica.getKnown()) { printFileStateForBitarchive(out, l, fs, locale); } out.println("</table>"); }
From source file:dk.netarkivet.common.webinterface.HTMLUtils.java
/** * Prints out links to change languages. Will read locales and names of languages from settings, and write them as * links to the page "lang.jsp". The locale will be given to this page as a parameter, the name will be shown as the * text of the link//from w w w . j av a 2 s .co m * * @param out the writer to which the links are written. * @throws IOException if an error occurs during writing of output. */ private static void generateLanguageLinks(JspWriter out) throws IOException { out.print("<div class=\"languagelinks\">"); StringTree<String> webinterfaceSettings = Settings.getTree(CommonSettings.WEBINTERFACE_SETTINGS); for (StringTree<String> language : webinterfaceSettings.getSubTrees(CommonSettings.WEBINTERFACE_LANGUAGE)) { out.print(String.format("<a href=\"lang.jsp?locale=%s&name=%s\">%s</a> ", escapeHtmlValues(encode(language.getValue(CommonSettings.WEBINTERFACE_LANGUAGE_LOCALE))), escapeHtmlValues(encode(language.getValue(CommonSettings.WEBINTERFACE_LANGUAGE_NAME))), escapeHtmlValues(language.getValue(CommonSettings.WEBINTERFACE_LANGUAGE_NAME)))); } out.print("</div>"); }
From source file:dk.netarkivet.common.webinterface.HTMLUtils.java
/** * Prints out the navigation tree appearing as a <td>in the left column of the "main_table" table. Subpages are * shown only for the currently-active main-heading of the sections defined in settings. * * @param out the writer to which the output must be written. * @param url the url of the page.// ww w . j av a 2 s . co m * @param locale The locale selecting the language. * @throws IOException if the output cannot be written. */ private static void generateNavigationTree(JspWriter out, String url, Locale locale) throws IOException { out.print("<td valign=\"top\" id=\"menu\">\n"); // The list of menu items is presented as a 1-column table out.print("<table id=\"menu_table\">\n"); String s = I18N.getString(locale, "sidebar.title.menu"); out.print("<tr><td><a class=\"sidebarHeader\" href=\"index.jsp\">" + "<img src=\"transparent_menu_logo.png\" alt=\"" + s + "\"/> " + s + "</a></td></tr>\n"); for (SiteSection section : SiteSection.getSections()) { section.generateNavigationTree(out, url, locale); } out.print("</table>\n"); out.print("</td>\n"); }