/** * Emit the supplied object to the specified writer, escaping characters if needed. * * @param src the object to write * @param escapeXml if true, escape unsafe characters before writing * @param out the JspWriter to emit to * @throws IOException if there was a problem emitting the content */ public static void emit(Object src, boolean escapeXml, JspWriter out) throws IOException { if (src instanceof Reader) { emit((Reader) src, escapeXml, out); } else { emit(String.valueOf(src), escapeXml, out); } }
/** * Emit the supplied object to the specified writer, escaping characters if needed. * * @param src the object to write * @param escapeXml if true, escape unsafe characters before writing * @param out the JspWriter to emit to * @throws IOException if there was a problem emitting the content */ public static void emit(Object src, boolean escapeXml, JspWriter out) throws IOException { if (src instanceof Reader) { emit((Reader) src, escapeXml, out); } else { emit(String.valueOf(src), escapeXml, out); } }
/** * Emit the supplied String to the specified writer, escaping characters if needed. * * @param src the String to write * @param escapeXml if true, escape unsafe characters before writing * @param out the JspWriter to emit to * @throws IOException if there was a problem emitting the content */ public static void emit(String src, boolean escapeXml, JspWriter out) throws IOException { if (escapeXml) { emit(src, out); } else { out.write(src); } }
/** * Emit the supplied String to the specified writer, escaping characters if needed. * * @param src the String to write * @param escapeXml if true, escape unsafe characters before writing * @param out the JspWriter to emit to * @throws IOException if there was a problem emitting the content */ public static void emit(String src, boolean escapeXml, JspWriter out) throws IOException { if (escapeXml) { emit(src, out); } else { out.write(src); } }
@Override public int doEndTag() throws JspException { try { boolean escapeXml = evalEscapeXml(); EscapeXML.emit(output, escapeXml, pageContext.getOut()); } catch (IOException e) { throw new JspTagException(e); } finally { output = null; } return EVAL_PAGE; } }
@Override public int doEndTag() throws JspException { try { boolean escapeXml = evalEscapeXml(); EscapeXML.emit(output, escapeXml, pageContext.getOut()); } catch (IOException e) { throw new JspTagException(e); } finally { output = null; } return EVAL_PAGE; } }
/** * Copy the content of a Reader into the specified JSPWriter escaping characters if needed. * * @param src the Reader to read from * @param escapeXml if true, escape characters * @param out the JspWriter to emit to * @throws IOException if there was a problem emitting the content */ public static void emit(Reader src, boolean escapeXml, JspWriter out) throws IOException { int bufferSize = out.getBufferSize(); if (bufferSize == 0) { bufferSize = 4096; } char[] buffer = new char[bufferSize]; int count; while ((count = src.read(buffer)) > 0) { if (escapeXml) { emit(buffer, 0, count, out); } else { out.write(buffer, 0, count); } } }
/** * Copy the content of a Reader into the specified JSPWriter escaping characters if needed. * * @param src the Reader to read from * @param escapeXml if true, escape characters * @param out the JspWriter to emit to * @throws IOException if there was a problem emitting the content */ public static void emit(Reader src, boolean escapeXml, JspWriter out) throws IOException { int bufferSize = out.getBufferSize(); if (bufferSize == 0) { bufferSize = 4096; } char[] buffer = new char[bufferSize]; int count; while ((count = src.read(buffer)) > 0) { if (escapeXml) { emit(buffer, 0, count, out); } else { out.write(buffer, 0, count); } } }
@Override public int doStartTag() throws JspException { try { XPathContext context = XalanUtil.getContext(this, pageContext); String result = select.execute(context, context.getCurrentNode(), null).str(); EscapeXML.emit(result, escapeXml, pageContext.getOut()); return SKIP_BODY; } catch (IOException ex) { throw new JspTagException(ex.toString(), ex); } catch (TransformerException e) { throw new JspTagException(e); } }
@Override public int doStartTag() throws JspException { try { XPathContext context = XalanUtil.getContext(this, pageContext); String result = select.execute(context, context.getCurrentNode(), null).str(); EscapeXML.emit(result, escapeXml, pageContext.getOut()); return SKIP_BODY; } catch (IOException ex) { throw new JspTagException(ex.toString(), ex); } catch (TransformerException e) { throw new JspTagException(e); } }