/** Flushes the underlying stream if {@link XMLWriter} * or {@link XMLOutput}. * * @throws IOException */ public void flush() throws IOException { if (contentHandler instanceof XMLWriter) { ((XMLWriter)contentHandler).flush(); } else if (contentHandler instanceof XMLOutput) { ((XMLOutput)contentHandler).flush(); } }
/** Flushes the underlying stream if {@link XMLWriter} * or {@link XMLOutput}. * * @throws IOException */ public void flush() throws IOException { if (contentHandler instanceof XMLWriter) { ((XMLWriter)contentHandler).flush(); } else if (contentHandler instanceof XMLOutput) { ((XMLOutput)contentHandler).flush(); } }
/** Flushes the underlying stream if {@link XMLWriter} * or {@link XMLOutput}. * * @throws IOException */ public void flush() throws IOException { if (contentHandler instanceof XMLWriter) { ((XMLWriter)contentHandler).flush(); } else if (contentHandler instanceof XMLOutput) { ((XMLOutput)contentHandler).flush(); } }
private String compileJelly(JellyContext context, String template) { StringWriter writer = new StringWriter(); try { XMLOutput xmlOutput = XMLOutput.createXMLOutput(writer); String url = this.getClass() .getResource("MasterMailer.class").toString(); url = url.substring(0, url.lastIndexOf(".class")); context.runScript(url + "/" + template, xmlOutput); xmlOutput.flush(); } catch (Exception e) { e.printStackTrace(new PrintWriter(writer)); } return writer.toString(); }
public String getHtml(ProjectConfigInfo projectConfigInfo) throws IOException, ClassNotFoundException, JellyException { String name = getClass().getName().replace('.', '/').replace('$', '/') + "/" + "index.jelly"; URL actionTemplate = getClass().getClassLoader().getResource(name); JellyContext context = new JellyContext(); context.setVariable("p", projectConfigInfo); context.setVariable("it", this); OutputStream outputStream = new ByteArrayOutputStream(); XMLOutput output = XMLOutput.createXMLOutput(outputStream); context.runScript(actionTemplate, output); output.flush(); return "<p>" + outputStream.toString() + " </p>"; }
private String convert(Run<?, ?> build, JellyContext context, Script script) throws JellyTagException, IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(16 * 1024); XMLOutput xmlOutput = XMLOutput.createXMLOutput(output); script.run(context, xmlOutput); xmlOutput.flush(); xmlOutput.close(); output.close(); return output.toString(getCharset(build)); }
public void run() { try { getBody().run(newContext, xmlOutput); if (closeOutput) { xmlOutput.close(); } else { xmlOutput.flush(); } } catch (Exception e) { if (log.isErrorEnabled()) log.error("error running thread tag", e); } } }
public void run() { try { getBody().run(newContext, xmlOutput); if (closeOutput) { xmlOutput.close(); } else { xmlOutput.flush(); } } catch (Exception e) { if (log.isErrorEnabled()) log.error("error running thread tag", e); } } }
public void run() { try { getBody().run(newContext, xmlOutput); if (closeOutput) { xmlOutput.close(); } else { xmlOutput.flush(); } } catch (Exception e) { if (log.isErrorEnabled()) log.error("error running thread tag", e); } } }
public void run() { try { getBody().run(newContext, xmlOutput); if (closeOutput) { xmlOutput.close(); } else { xmlOutput.flush(); } } catch (Exception e) { if (log.isErrorEnabled()) log.error("error running thread tag", e); } } }
m_script.run(m_context, m_output); m_outputStream.close(); m_output.flush();
m_script.run(m_context, m_output); m_outputStream.close(); m_output.flush();
/** * @see org.apache.velocity.servlet.VelocityServlet#mergeTemplate * @param script * @param context * @param req * @param res * @throws IOException * @throws UnsupportedEncodingException * @throws JellyException */ protected void runScript( URL script, JellyContext context, HttpServletRequest req, HttpServletResponse res) throws IOException, UnsupportedEncodingException, JellyException { ServletOutputStream output = res.getOutputStream(); XMLOutput xmlOutput = XMLOutput.createXMLOutput(output); context.runScript(script, xmlOutput); xmlOutput.flush(); xmlOutput.close(); output.flush(); }
/** * @see org.apache.velocity.servlet.VelocityServlet#mergeTemplate * @param script * @param context * @param req * @param res * @throws IOException * @throws UnsupportedEncodingException * @throws JellyException */ protected void runScript( URL script, JellyContext context, HttpServletRequest req, HttpServletResponse res) throws IOException, UnsupportedEncodingException, JellyException { ServletOutputStream output = res.getOutputStream(); XMLOutput xmlOutput = XMLOutput.createXMLOutput(output); context.runScript(script, xmlOutput); xmlOutput.flush(); xmlOutput.close(); output.flush(); }
/** * @see org.apache.velocity.servlet.VelocityServlet#mergeTemplate * @param script * @param context * @param req * @param res * @throws IOException * @throws UnsupportedEncodingException * @throws JellyException */ protected void runScript( URL script, JellyContext context, HttpServletRequest req, HttpServletResponse res) throws IOException, UnsupportedEncodingException, JellyException { ServletOutputStream output = res.getOutputStream(); XMLOutput xmlOutput = XMLOutput.createXMLOutput(output); context.runScript(script, xmlOutput); xmlOutput.flush(); xmlOutput.close(); output.flush(); }
public void invokeScript(StaplerRequest req, StaplerResponse rsp, Script script, Object it) throws IOException, JellyTagException { XMLOutput xmlOutput = createXMLOutput(req, rsp, script, it); invokeScript(req,rsp,script,it,xmlOutput); xmlOutput.flush(); xmlOutput.close(); }
/** * @see org.apache.velocity.servlet.VelocityServlet#mergeTemplate * @param script * @param context * @param req * @param res * @throws IOException * @throws UnsupportedEncodingException * @throws JellyException */ protected void runScript( URL script, JellyContext context, HttpServletRequest req, HttpServletResponse res) throws IOException, UnsupportedEncodingException, JellyException { ServletOutputStream output = res.getOutputStream(); XMLOutput xmlOutput = XMLOutput.createXMLOutput(output); context.runScript(script, xmlOutput); xmlOutput.flush(); xmlOutput.close(); output.flush(); }
public void invokeScript(StaplerRequest req, StaplerResponse rsp, Script script, Object it) throws IOException, JellyTagException { XMLOutput xmlOutput = createXMLOutput(req, rsp, script, it); invokeScript(req,rsp,script,it,xmlOutput); xmlOutput.flush(); xmlOutput.close(); }
public void testOutputData() throws Exception { setUpScript("outputData.jelly"); Script script = getJelly().compileScript(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLOutput ouput = XMLOutput.createXMLOutput(bos); script.run(getJellyContext(),ouput); ouput.flush(); assertEquals("[string]",bos.toString().trim()); } }
public void testOutputBadGood() throws Exception { setUpScript("outputBad.jelly"); Script script = getJelly().compileScript(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLOutput ouput = XMLOutput.createXMLOutput(bos); script.run(getJellyContext(),ouput); ouput.flush(); assertEquals("<html></html>",bos.toString()); }