1 package org.sapia.gumby.tags; 2 3 import java.net.URL ; 4 5 import org.sapia.gumby.RenderContext; 6 import org.sapia.gumby.factory.ContextAware; 7 import org.sapia.util.xml.confix.ConfigurationException; 8 import org.sapia.util.xml.confix.ObjectCreationCallback; 9 10 25 public class Resource implements ObjectCreationCallback, ContextAware { 26 27 private String _src; 28 private RenderContext _ctx; 29 30 public void setText(String src) { 31 setSrc(src); 32 } 33 34 public void setSrc(String src) { 35 _src = src; 36 } 37 38 41 public void handleContext(RenderContext context) { 42 _ctx = context; 43 } 44 45 48 public Object onCreate() throws ConfigurationException { 49 if(_src == null) { 50 throw new ConfigurationException("Resource not specified"); 51 } 52 53 URL url = _ctx.getSettings().resolveURL(_src); 54 if(url == null) { 55 throw new ConfigurationException("Could not find resource: " + _src); 56 } 57 return url; 58 } 59 60 } 61 | Popular Tags |