4243444546474849505152
VelocityPanel velocityPanel = new VelocityPanel("velocityPanel", new Model(values)) { protected IStringResourceStream getTemplateResource() { return new UrlResourceStream(this.getClass().getResource( "testWithMarkup.html")); } public boolean parseGeneratedMarkup() {
38394041424344
public VelocityPage() { HashMap values = new HashMap(); values.put("message", TEST_STRING); add(VelocityPanel.forTemplateResource("velocityPanel", new Model(values), new UrlResourceStream(this.getClass().getResource("test.html")))); }
167168169170171172173174175
// Try loading path using classloader final URL url = classLoader.getResource(path); if (url != null) { return new UrlResourceStream(url); } return null; }
110111112113114115116117118119120
try { final URL url = servletContext.getResource(path + pathname); if (url != null) { return new UrlResourceStream(url); } } catch (Exception ex) { // ignore, file couldn't be found
8182838485868788899091
{ // try to load the resource from the web context url = getServletContext().getResource(location); if (url != null) { return new UrlResourceStream(url); } } catch (MalformedURLException e) { throw new WicketRuntimeException(e);
6667686970717273747576
// load a template with a totally different name from this package using // this component's class loader final URL url = PageWithCustomLoading.class.getResource("CustomLoadedTemplate.html"); if (url != null) { return new UrlResourceStream(url); } // no resource was not found return null; }
8081828384858687888990
252253254255256257258259260
* the url * @return the imported contents */ private final String importUrl(URL url) { UrlResourceStream resourceStream = new UrlResourceStream(url); String content = resourceStream.asString(); return content; }