/** * Escapes for use in a (X)HTML document and writes to the provided <code>Appendable</code>. * In addition to the standard XML Body encoding, it turns newlines into <br />, tabs to &#x9;, and spaces to &#160; * * @param value the object to be escaped. If value is <code>null</code>, nothing is written. * * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see TextInXhtmlEncoder */ @Deprecated public static void encodeHtml(Object value, Appendable out) throws IOException { encodeHtml(value, true, true, out); }
/** * Converts an object to a string. */ public static String toString(Object value) { return EncodingUtils.toString(value); /* Code will move here once encodingutils no longer used // If A is a string, then the result is A. if(value instanceof String) return (String)value; // Otherwise, if A is null, then the result is "". if(value == null) return ""; // Otherwise, if is a DOM node, serialize the output // Get implemention from other EncodingUtils // Otherwise, if A.toString() throws an exception, then raise an error String str = value.toString(); // Otherwise, the result is A.toString(); return str; */ }
/** * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see TextInXhtmlEncoder */ @Deprecated public static void encodeHtml(Object value, boolean make_br, boolean make_nbsp, Appendable out) throws IOException { if(value!=null) { String str = toString(value); BundleLookupMarkup lookupMarkup; BundleLookupThreadContext threadContext = BundleLookupThreadContext.getThreadContext(false); if(threadContext!=null) { lookupMarkup = threadContext.getLookupMarkup(str); } else { lookupMarkup = null; } if(lookupMarkup!=null) lookupMarkup.appendPrefixTo(MarkupType.XHTML, out); encodeHtml(str, 0, str.length(), make_br, make_nbsp, out); if(lookupMarkup!=null) lookupMarkup.appendSuffixTo(MarkupType.XHTML, out); } }
/** * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see TextInXhtmlEncoder */ @Deprecated public static void encodeHtml(char ch, Appendable out) throws IOException { encodeHtml(ch, true, true, out); }
/** * Escapes for use in a (X)HTML document and writes to the provided <code>Appendable</code>. * In addition to the standard XML Body encoding, it turns newlines into <br /> and spaces to &#160; * * @param S the string to be escaped. If S is <code>null</code>, nothing is written. * * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see TextInXhtmlEncoder */ @Deprecated public static void encodeHtml(CharSequence S, int start, int end, Appendable out) throws IOException { encodeHtml(S, start, end, true, true, out); }
/** * Escapes HTML for displaying in browsers and writes to the internal <code>PrintWriter</code>. * Has makeBr and makeNbsp enabled. * * @param S the string to be escaped. * * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see #encodeXhtml(java.lang.Object) */ @Deprecated public ChainWriter encodeHtml(Object value) throws IOException { com.aoindustries.util.EncodingUtils.encodeHtml(value, true, true, out); return this; }
/** * Escapes HTML for displaying in browsers and writes to the internal <code>PrintWriter</code>. * * @param S the string to be escaped. * @param make_br will write <BR> tags for every newline character * * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see #encodeXhtml(java.lang.Object) */ @Deprecated public ChainWriter encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException { com.aoindustries.util.EncodingUtils.encodeHtml(value, make_br, make_nbsp, out); return this; }
/** * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see TextInXhtmlEncoder */ @Deprecated public static String encodeHtml(Object value) throws IOException { if(value==null) return null; StringBuilder result = new StringBuilder(); encodeHtml(value, result); return result.toString(); }
/** * @param value the string to be escaped. * * @return if value is null then null otherwise value escaped * * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see TextInXhtmlEncoder */ @Deprecated public static String encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException { if(value==null) return null; StringBuilder result = new StringBuilder(); encodeHtml(value, make_br, make_nbsp, result); return result.toString(); }
@SuppressWarnings("deprecation") @Override protected void printConnectionStats(Appendable out) throws IOException { out.append(" <tr><th colspan='2'><span style='font-size:large;'>JDBC Driver</span></th></tr>\n" + " <tr><td>Driver:</td><td>"); com.aoindustries.util.EncodingUtils.encodeHtml(driver, false, false, out); out.append("</td></tr>\n" + " <tr><td>URL:</td><td>"); com.aoindustries.util.EncodingUtils.encodeHtml(url, false, false, out); out.append("</td></tr>\n" + " <tr><td>User:</td><td>"); com.aoindustries.util.EncodingUtils.encodeHtml(user, false, false, out); out.append("</td></tr>\n" + " <tr><td>Password:</td><td>"); int len=password.length(); for(int c=0;c<len;c++) { out.append('*'); } out.append("</td></tr>\n"); }
/** * Prints the results in HTML format. */ public static void printResultsHtml(List<Result> results, Appendable out) throws IOException { out.append(" <table style='border:0px;' cellspacing='0' cellpadding='4'>\n"); for(Result result : results) { out.append(" <tr><td style='white-space:nowrap'>"); EncodingUtils.encodeHtml(result.getCategory(), out); out.append(":</td><td style='white-space:nowrap'>"); EncodingUtils.encodeHtml(result.getResult(), out); out.append("</td></tr>\n"); } out.append(" </table>\n"); }
if(title!=null) { out.append(" <tr><th colspan='").append(Integer.toString(columnCount)).append("'>"); com.aoindustries.util.EncodingUtils.encodeHtml(title, out); out.append("</th></tr>\n"); for(int c=0;c<columnCount;c++) { out.append(" <th>"); com.aoindustries.util.EncodingUtils.encodeHtml(metaData.getColumnLabel(c+1), out); out.append("</th>\n"); out.append(wordWrap?" <td>":" <td style='white-space:nowrap'>"); if(S!=null) { com.aoindustries.util.EncodingUtils.encodeHtml(S, out);
out.append(" <tr><td>Max Connection Pool Size:</td><td>").append(Integer.toString(poolSize)).append("</td></tr>\n" + " <tr><td>Connection Clean Interval:</td><td>"); com.aoindustries.util.EncodingUtils.encodeHtml(StringUtility.getDecimalTimeLengthString(delayTime), out); out.append("</td></tr>\n" + " <tr><td>Max Idle Time:</td><td>"); com.aoindustries.util.EncodingUtils.encodeHtml(StringUtility.getDecimalTimeLengthString(maxIdleTime), out); out.append("</td></tr>\n" + " <tr><td>Max Connection Age:</td><td>"); com.aoindustries.util.EncodingUtils.encodeHtml(maxConnectionAge==UNLIMITED_MAX_CONNECTION_AGE?"Unlimited":StringUtility.getDecimalTimeLengthString(maxConnectionAge), out); out.append("</td></tr>\n" + " <tr><td>Is Closed:</td><td>").append(Boolean.toString(myIsClosed)).append("</td></tr>\n" + " <td>").append(isConnected?"Yes":"No").append("</td>\n" + " <td>"); if(isConnected) com.aoindustries.util.EncodingUtils.encodeHtml(StringUtility.getDecimalTimeLengthString(time-createTimes[c]), out); else out.append(" "); out.append(" <td>").append(Long.toString(connCount)).append("</td>\n" + " <td>").append(Long.toString(useCount)).append("</td>\n" + " <td>"); com.aoindustries.util.EncodingUtils.encodeHtml(StringUtility.getDecimalTimeLengthString(totalTime), out); out.append("</td>\n" + " <td>").append(Float.toString(totalTime*100/(float)timeLen)).append("%</td>\n" + " <td>").append(isBusy?"In Use":isConnected?"Idle":"Closed").append("</td>\n" + " <td>"); com.aoindustries.util.EncodingUtils.encodeHtml(StringUtility.getDecimalTimeLengthString(stateTime), out); out.append("</td>\n" + " <td>").append(Long.toString(totalTime*1000/useCount)).append("µs</td>\n" + " <td>").append(Long.toString(totalUses)).append("</td>\n"
+ " <tr><th colspan='2'><span style='font-size:large;'>TCP Connection Pool</span></th></tr>\n" + " <tr><td>Host:</td><td>"); EncodingUtils.encodeHtml(connector.hostname, out); out.append("</td></tr>\n" + " <tr><td>Port:</td><td>").append(Integer.toString(connector.port.getPort())).append("</td></tr>\n" + " <tr><td>Connected As:</td><td>"); EncodingUtils.encodeHtml(connector.connectAs, out); out.append("</td></tr>\n" + " <tr><td>Authenticated As:</td><td>"); EncodingUtils.encodeHtml(connector.authenticateAs, out); out.append("</td></tr>\n" + " <tr><td>Password:</td><td>");