You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Vombach <an...@psi.ch> on 2004/11/03 12:07:59 UTC

resource file loading

Is it possible to load a file within a web application, in the 
pageBeginRender method?
The BasePage does not inherit from javax.servlet, and I would like to do 
a getServletContext().getRealPath("file.txt") or 
getServletContext.getResource("file.txt").
Any way to do it in the BasePage?

Thanks Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: resource file loading

Posted by Andreas Vombach <an...@psi.ch>.
I think I found it ... it works like this:

RequestContext context = event.getRequestCycle().getRequestContext();
ApplicationServlet servlet = context.getServlet();
System.out.println("Resource: " + 
servlet.getServletContext().getRealPath("Home.html"));

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org