1 16 17 package org.apache.commons.jelly.servlet; 18 19 import org.apache.commons.jelly.JellyContext; 20 21 import javax.servlet.ServletContext ; 22 import java.io.InputStream ; 23 import java.net.MalformedURLException ; 24 import java.net.URL ; 25 26 31 public class JellyServletContext extends JellyContext { 32 33 private ServletContext ctx; 34 35 public JellyServletContext() { 36 } 37 38 public JellyServletContext(ServletContext ctx) { 39 super(); 40 this.ctx = ctx; 41 } 42 43 public JellyServletContext(JellyContext parent, ServletContext ctx) { 44 super(parent); 45 this.ctx = ctx; 46 } 47 48 54 public URL getResource(String s) throws MalformedURLException { 55 return ctx.getResource(s); 56 } 57 58 63 public InputStream getResourceAsStream(String s) { 64 return ctx.getResourceAsStream(s); 65 } 66 67 protected JellyContext createChildContext() 68 { 69 return new JellyServletContext(this, ctx); 70 } 71 } 72 | Popular Tags |