Example usage for org.apache.wicket.resource ResourceUtil readString

List of usage examples for org.apache.wicket.resource ResourceUtil readString

Introduction

In this page you can find the example usage for org.apache.wicket.resource ResourceUtil readString.

Prototype

public static String readString(IResourceStream resourceStream) 

Source Link

Document

read string with platform default encoding from resource stream

Usage

From source file:com.norconex.commons.wicket.markup.html.panel.FilePanel.java

License:Apache License

@Override
protected void onRender() {
    getResponse().write(ResourceUtil.readString(fileStream));
    try {/* w  w w .ja  va2  s. c o m*/
        fileStream.close();
    } catch (IOException e) {
        throw new WicketRuntimeException(e);
    }
}

From source file:com.norconex.commons.wicket.markup.html.panel.VelocityFilePanel.java

License:Apache License

@Override
protected void onRender() {
    VelocityContext context = createVelocityContext(variables);
    VelocityEngine engine = createVelocityEngine();
    StringWriter out = new StringWriter();
    engine.evaluate(context, out, "VelocityFilePanel", ResourceUtil.readString(templateStream));
    getResponse().write(out.toString());
    try {/* w  w  w .jav  a2s.  c o m*/
        templateStream.close();
    } catch (IOException e) {
        throw new WicketRuntimeException(e);
    }
}

From source file:sf.wicklet.wicketext.test.TestMarkupParser01.java

License:Apache License

@Test
public void test01() throws Exception {
    final String input = ResourceUtil.readString(
            new PackageResourceStream(getClass(), "sf/wicklet/wicketext/test/TestMarkupParser01Test01.html"));
    final MarkupParser parser = new MarkupParser(input);
    final IRootMarkup ret = parser.parse();
    final MarkupStat stat = WicketExtrasUtil.dump(System.out, DEBUG, ret);
    assertEquals(17, stat.ctags);//w w w  . j  av  a2 s  .  c  o m
    assertEquals(18, stat.rtags);
    assertEquals(0, stat.others);
}