protected void setUpScript(String scriptname) throws Exception { URL url = this.getClass().getResource(scriptname); if(null == url) { throw new Exception( "Could not find Jelly script: " + scriptname + " in package of class: " + getClass().getName() ); } jelly.setUrl(url); String exturl = url.toExternalForm(); int lastSlash = exturl.lastIndexOf("/"); String extBase = exturl.substring(0,lastSlash+1); URL baseurl = new URL(extBase); context.setCurrentURL(baseurl); }
protected void setUpScript(String scriptname) throws Exception { URL url = this.getClass().getResource(scriptname); if(null == url) { throw new Exception( "Could not find Jelly script: " + scriptname + " in package of class: " + getClass().getName() ); } jelly.setUrl(url); String exturl = url.toExternalForm(); int lastSlash = exturl.lastIndexOf("/"); String extBase = exturl.substring(0,lastSlash+1); URL baseurl = new URL(extBase); context.setCurrentURL(baseurl); }
protected void setUpScript(String scriptname) throws Exception { URL url = this.getClass().getResource(scriptname); if(null == url) { throw new Exception( "Could not find Jelly script: " + scriptname + " in package of class: " + getClass().getName() ); } jelly.setUrl(url); String exturl = url.toExternalForm(); int lastSlash = exturl.lastIndexOf("/"); String extBase = exturl.substring(0,lastSlash+1); URL baseurl = new URL(extBase); context.setCurrentURL(baseurl); }
protected void setUpScript(String scriptname) throws Exception { URL url = this.getClass().getResource(scriptname); if(null == url) { throw new Exception( "Could not find Jelly script: " + scriptname + " in package of class: " + getClass().getName() ); } jelly.setUrl(url); String exturl = url.toExternalForm(); int lastSlash = exturl.lastIndexOf("/"); String extBase = exturl.substring(0,lastSlash+1); URL baseurl = new URL(extBase); context.setCurrentURL(baseurl); }
/** * Set the context's root and current URL if not present * @param context * @throws JellyTagException */ protected void setContextURLs(JellyContext context) throws JellyTagException { if(scriptURL == null) return; if(context.getRootURL()==null) { context.setRootURL(scriptURL); } context.setCurrentURL(scriptURL); }
/** * Set the context's root and current URL if not present * @param context * @throws JellyTagException */ protected void setContextURLs(JellyContext context) throws JellyTagException { if(scriptURL == null) return; if(context.getRootURL()==null) { context.setRootURL(scriptURL); } context.setCurrentURL(scriptURL); }
/** * Set the context's root and current URL if not present * @param context * @throws JellyTagException */ protected void setContextURLs(JellyContext context) throws JellyTagException { if(scriptURL == null) return; if(context.getRootURL()==null) { context.setRootURL(scriptURL); } context.setCurrentURL(scriptURL); }
/** * Run a jelly script. * * @param scriptInputStream Script input stream. * @param systemId the system identifier to help resolve relative URLs * @param rootUrl Root explicit context of the script. * @param context Jelly context. * @param output Output sink. * @throws Exception If an error occurs while locating, compiling or * executing the script. */ public static void runScript( InputStream scriptInputStream, String systemId, URL rootUrl, JellyContext context, XMLOutput output ) throws Exception { URL oldRoot = context.getRootURL(); URL oldCurrent = context.getCurrentURL(); if ( rootUrl != null ) { context.setRootURL( rootUrl ); context.setCurrentURL( rootUrl ); } Script script = compileScript( scriptInputStream, systemId, context ); script.run( context, output ); context.setRootURL( oldRoot ); context.setCurrentURL( oldCurrent ); }
newJellyContext.setCurrentURL( newJellyContextURL ); newJellyContext.setExport( export ); newJellyContext.setInherit( inherit );
newJellyContext.setCurrentURL( newJellyContextURL ); newJellyContext.setExport( export ); newJellyContext.setInherit( inherit );
newJellyContext.setCurrentURL( newJellyContextURL ); newJellyContext.setExport( export ); newJellyContext.setInherit( inherit );
public void setUpFromURL(URL url) throws Exception { context = new CoreTaglibOnlyContext(); xmlOutput = XMLOutput.createDummyXMLOutput(); jelly = new Jelly(); jelly.setUrl(url); String exturl = url.toExternalForm(); int lastSlash = exturl.lastIndexOf("/"); String extBase = exturl.substring(0,lastSlash+1); URL baseurl = new URL(extBase); context.setCurrentURL(baseurl); }
/** * Set the context's root and current URL if not present * @param context * @throws JellyTagException */ protected void setContextURLs(JellyContext context) throws JellyTagException { if ((context.getCurrentURL() == null || context.getRootURL() == null) && scriptURL != null) { if (context.getRootURL() == null) context.setRootURL(scriptURL); if (context.getCurrentURL() == null) context.setCurrentURL(scriptURL); } }
newJellyContext.setCurrentURL( newJellyContextURL ); newJellyContext.setExport( export ); newJellyContext.setInherit( inherit );
} finally { context.setRootURL(rootURL); context.setCurrentURL(currentURL); context.getVariables().put(PARENT_TAG,oldParent);
handleException(e); } finally { context.setCurrentURL(currentURL); context.setRootURL(rootURL);
handleException(e); } finally { context.setCurrentURL(currentURL); context.setRootURL(rootURL);
handleException(e); } finally { context.setCurrentURL(currentURL); context.setRootURL(rootURL);
String extBase = exturl.substring(0,lastSlash+1); URL baseurl = new URL(extBase); jc.setCurrentURL(baseurl);
handleException(e); } finally { context.setCurrentURL(currentURL); context.setRootURL(rootURL);