Thank you. SlingRequestProcessor and mock up http Request and Response objects worked well.
On Thu, Feb 24, 2011 at 3:34 PM, Bertrand Delacretaz <[email protected] > wrote: > Hi, > > On Thu, Feb 24, 2011 at 9:20 PM, sam lee <[email protected]> wrote: > > ...since all html pages that I want to crawl are served within Sling, > > is there an API that "resolves" (or "renders") paths like > /content/foo.html, > > /content/bar.json ... etc? > > You can use the SlingRequestProcessor to make requests directly > without going through http. > > For an example see the TestAllPaths class [1] which uses it. Don't be > scared by the use of static member variables, that class is a somewhat > tricky bridge with JUnit to run server-side tests. > > You will have to provide a ResourceResolver to use it, and that's > built from a Session, login happens when that session is created. > > -Bertrand > > [1] > http://svn.apache.org/repos/asf/sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java >
