public void run(JellyContext context, XMLOutput output) throws JellyTagException { Functions.initPageVariables(context); s.run(context,output); } },self,new XMLOutput(new DefaultHandler()));
/** * Evaluate a Jelly script and return output as a String. * * @since 1.267 */ public static String runScript(Script script) throws JellyTagException { StringWriter out = new StringWriter(); script.run(getCurrentJellyContext(), XMLOutput.createXMLOutput(out)); return out.toString(); }
getTagBody().run(context,output); output.endElement(tagName); } catch (SAXException x) {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { try { script.run(context, output); } catch (Exception ex) { ex.printStackTrace(); } } } ); } else { script.run(context, output);
public void run(JellyContext context, XMLOutput output) throws JellyTagException { Functions.initPageVariables(context); s.run(context,output); } },self,new XMLOutput(new DefaultHandler()));
/** * Evaluate a Jelly script and return output as a String. * * @since 1.267 */ public static String runScript(Script script) throws JellyTagException { StringWriter out = new StringWriter(); script.run(getCurrentJellyContext(), XMLOutput.createXMLOutput(out)); return out.toString(); }
public void doTag(XMLOutput output) throws JellyTagException { JellyContext newContext = context.newJellyContext(); getBody().run(newContext, output); } }
/** * Doesn't particularly do anything as the actual processing * happens at {@link DefaultScriptInvoker#invokeScript(StaplerRequest, StaplerResponse, Script, Object)} */ public void doTag(XMLOutput output) throws JellyTagException { getBody().run(getContext(),output); } }
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { HttpServletRequest req = getRequest(); // work around http://jira.codehaus.org/browse/JETTY-234 req.getUserPrincipal(); if(req.isUserInRole(role)) getBody().run(getContext(),output); } }
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(JellyContext context, XMLOutput output) throws JellyTagException { if (getAttribute("test").evaluateAsBoolean(context)) getTagBody().run(context,output); } };
public void testNamespaceDefined() throws Exception { jelly.setDefaultNamespaceURI("jelly:core"); Script script = jelly.compileScript(); script.run(context,xmlOutput); assertTrue("should have set 'usedDefaultNamespace' variable", context.getVariable("usedDefaultNamespace") != null); }
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()); }
public void testMultipleDefaults() throws Exception { setUpScript("testSwitchTag.jelly"); Script script = getJelly().compileScript(); getJellyContext().setVariable("multiple.defaults",new Boolean(true)); try { script.run(getJellyContext(),getXMLOutput()); fail("Expected JellyException"); } catch(JellyException e) { // expected } }
public void testSimpleFileTag() throws Exception { setUpScript("testFileTag.jelly"); Script script = getJelly().compileScript(); script.run(getJellyContext(), getXMLOutput()); String data = (String)getJellyContext().getVariable("testFileTag"); //FIXME This doesn't take into account attribute ordering assertEquals("fully qualified attributes not passed", "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"></html>", data); }
public void testSimpleBreakTag() throws Exception { setUpScript("testBreakTag.jelly"); Script script = getJelly().compileScript(); script.run(getJellyContext(), getXMLOutput()); String simpleResult = (String) getJellyContext().getVariable("simpleResult"); assertEquals("simpleResult", "12345", simpleResult); }
public void testConditionalBreakTag() throws Exception { setUpScript("testBreakTag.jelly"); Script script = getJelly().compileScript(); script.run(getJellyContext(), getXMLOutput()); String simpleResult = (String) getJellyContext().getVariable("conditionalResult"); assertEquals("conditionalResult", "12345", simpleResult); }
public void testSimpleFileTag() throws Exception { setUpScript("testChooseTag.jelly"); Script script = getJelly().compileScript(); script.run(getJellyContext(), getXMLOutput()); String resultTrue = (String) getJellyContext().getVariable("result.true"); String resultFalse = (String) getJellyContext().getVariable("result.false"); assertEquals("result.true", "AC", resultTrue); assertEquals("result.false", "BC", resultFalse); }
public void testNewWithNullArg() throws Exception { setUpScript("testNewTag.jelly"); Script script = getJelly().compileScript(); getJellyContext().setVariable("test.newWithNullArg",Boolean.TRUE); script.run(getJellyContext(),getXMLOutput()); assertNotNull(getJellyContext().getVariable("foo")); assertTrue(getJellyContext().getVariable("foo") instanceof Customer); Customer customer = (Customer)(getJellyContext().getVariable("foo")); assertNull(customer.getName()); }
public void testInvokeWithReturnedValueAsArg() throws Exception { setUpScript("testInvokeTag.jelly"); Script script = getJelly().compileScript(); getJellyContext().setVariable("test.invokeWithReturnedValueAsArg",Boolean.TRUE); script.run(getJellyContext(),getXMLOutput()); assertNotNull(getJellyContext().getVariable("customer")); assertTrue(getJellyContext().getVariable("customer") instanceof Customer); Customer customer = (Customer)(getJellyContext().getVariable("customer")); assertEquals("Jane Doe",customer.getName()); assertEquals("Chicago",customer.getCity()); }