How to load an XML/HTML resource in Play Framework 2.0

Go To


I'm working with Play Framework 2.0. In one of my test cases I want to read the content of some XML/HTML files. I've tried with:




But I get a null. The resources are in the same package of my test case.enter image description here

2012-04-04 00:28
by Marlon León


maybe you can try this method:

 * Retrieves a resource stream from the classpath.
 * @param relativePath relative path of the resource to fetch
 * @return InputStream to the resource (may be null)
play.Play.application().resourceAsStream(String resourceName)
2012-04-04 07:30
by ndeverge
For me, works the same as getClass().getResourceAsStream - kolen 2013-02-01 13:20