static public void writeAttribute(Writer out, boolean escapeUnicode, boolean escapeIsocode, char[] buffer, char[] text) throws IOException { writeAttribute(out, escapeUnicode, escapeIsocode, buffer, text, 0, text.length, WebConfiguration.BooleanWebContextInitParameter.EnableScriptInAttributeValue.getDefaultValue()); }
/** * Write String text. */ static public void writeText(Writer out, boolean escapeUnicode, boolean escapeIsocode, char[] buff, String text, char[] textBuff) throws IOException { int length = text.length(); if (length >= 16) { text.getChars(0, length, textBuff, 0); writeText(out, escapeUnicode, escapeIsocode, buff, textBuff, 0, length); } else { int buffLength = buff.length; int buffIndex = 0; for (int i = 0; i < length; i++) { char ch = text.charAt(i); buffIndex = writeTextChar(out, escapeUnicode, escapeIsocode, ch, buffIndex, buff, buffLength); } flushBuffer(out, buff, buffIndex); } }
public FacesResponseWriter(Writer writer, String contentType, String encoding, boolean scriptInAttributes, boolean isPartial) throws FacesException { this.writer = writer; this.contentType = contentType; this.encoding = encoding; this.isPartial = isPartial; this.scriptInAttributes = scriptInAttributes; String charsetName = encoding.toUpperCase(); escapeUnicode = !HtmlUtils.isUTFencoding(charsetName); escapeIso = !HtmlUtils.isISO8859_1encoding(charsetName) && !HtmlUtils.isUTFencoding(charsetName); }
/** * Write char array text. */ static public void writeText(Writer out, boolean escapeUnicode, boolean escapeIsocode, char[] buff, char[] text, int start, int length) throws IOException { int buffLength = buff.length; int buffIndex = 0; int end = start + length; for (int i = start; i < end; i++) { buffIndex = writeTextChar(out, escapeUnicode, escapeIsocode, text[i], buffIndex, buff, buffLength); } flushBuffer(out, buff, buffIndex); }
char ch = text[i]; if (ch <= 0x1f) { if (!isPrintableControlChar(ch)) { continue; buffIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); } else if (ch >= 0x27) { // If above "'"... if (ch < 0x3c) { buffIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); } else if (ch == '<') { buffIndex = addToBuffer(out, buff, buffIndex, LT_CHARS); } else if (ch == '>') { buffIndex = addToBuffer(out, buff, buffIndex, GT_CHARS); } else { buffIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); buffIndex = addToBuffer(out,
if (!HtmlUtils.validateEncoding(encoding)) { throw new IllegalArgumentException(MessageUtils.getExceptionMessageString( MessageUtils.ENCODING_ERROR_MESSAGE_ID)); case Auto: escapeUnicode = !HtmlUtils.isUTFencoding(charsetName); escapeIso = !HtmlUtils.isISO8859_1encoding(charsetName) && !HtmlUtils.isUTFencoding(charsetName); break;
static public void writeText(Writer out, boolean escapeUnicode, boolean escapeIsocode, char[] buffer, char[] text) throws IOException { writeText(out, escapeUnicode, escapeIsocode, buffer, text, 0, text.length); }
HtmlUtils.writeAttribute(writer, buffer, stringValue); } else { HtmlUtils.writeURL(writer, stringValue, encoding, null);
int nextIndex; if (ch <= 0x1f) { if (!isPrintableControlChar(ch)) { return buffIndex; nextIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); } else if (ch >= 0x27) { // If above "'"... nextIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); } else if (ch == '<') { nextIndex = addToBuffer(out, buff, buffIndex, LT_CHARS); } else if (ch == '>') { nextIndex = addToBuffer(out, buff, buffIndex, GT_CHARS); } else { nextIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); nextIndex = addToBuffer(out, buff,
if (length >= 16) { text.getChars(0, length, textBuff, 0); writeURL(out, textBuff, 0, length, queryEncoding); } else { for (int i = 0; i < length; i++) { writeURIDoubleHex(out, ch); encodeURIString(out, text, queryEncoding,
if (length >= 16) { text.getChars(0, length, textBuff, 0); writeURL(out, textBuff, 0, length, queryEncoding); } else { for (int i = 0; i < length; i++) { } else { textBuff[i] = ch; encodeURIString(out, textBuff, "UTF-8", i, i + 1); encodeURIString(out, text, queryEncoding,
public void endElement(String name) throws IOException { boolean emptyNode = HtmlUtils.isEmptyElement(name);
writeURIDoubleHex(out, ch); encodeURIString(out, textBuff, queryEncoding,
char ch) throws IOException { if (ch == '\u20ac') { bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 10000)))); i = i % 10000; bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 1000)))); i = i % 1000; bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 100)))); i = i % 100; bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 10)))); i = i % 10; bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + i))); } else if (i > 1000) { bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 1000)))); i = i % 1000; bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 100)))); i = i % 100; bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 10)))); i = i % 10; bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + i))); } else { bufferIndex = addToBuffer(out, buffer, bufferIndex, bufferLength, ((char) ('0' + (i / 100))));
/** Convert the given path to a URL: encode spaces to %20's, use * only forward slashes, etc. * @todo Find a better home for this method */ public static String toURL(String path) { // The URL encoder doesn't seem to do this - surprising path = path.replace('\\','/'); // This was also surprising - it makes spaces into +'es instead path = path.replaceAll(" ", "%20"); StringWriter sw = new StringWriter(); try { // WriteURL signature changed in JSF1.2-02-b04 com.sun.faces.util.HtmlUtils.writeURL(sw, path, null, null); } catch (java.io.IOException ex) { ErrorManager.getDefault().notify(ex); return path; } return sw.toString(); }
encodeURIString(out, textBuff, "UTF-8", i, i + 1); encodeURIString(out, textBuff, queryEncoding,
if (!isPrintableControlChar(ch)) { continue; buffIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); } else if (ch >= 0x27) { // If above "'"... if (ch < 0x3c) { buffIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); } else if (ch == '<') { buffIndex = addToBuffer(out, buff, buffIndex, LT_CHARS); } else if (ch == '>') { buffIndex = addToBuffer(out, buff, buffIndex, GT_CHARS); } else { buffIndex = addToBuffer(out, buff, buffIndex, buffLength, ch); buffIndex = addToBuffer(out, buff, buffIndex,
if (!HtmlUtils.validateEncoding(encoding)) { throw new IllegalArgumentException(MessageUtils.getExceptionMessageString( MessageUtils.ENCODING_ERROR_MESSAGE_ID)); case Auto: escapeUnicode = !HtmlUtils.isUTFencoding(charsetName); escapeIso = !HtmlUtils.isISO8859_1encoding(charsetName) && !HtmlUtils.isUTFencoding(charsetName); break;
static public void writeText(Writer out, boolean escapeUnicode, boolean escapeIsocode, char[] buffer, char[] text) throws IOException { writeText(out, escapeUnicode, escapeIsocode, buffer, text, 0, text.length); }
HtmlUtils.writeAttribute(attributesBuffer, escapeUnicode, escapeIso, isScriptInAttributeValueEnabled); } else { HtmlUtils.writeURL(attributesBuffer, stringValue, textBuffer,