I would think it should be something like
--- code
private static FileData _myFileData;
public FileData getFileData() {
if (_myFileData == null)
_myFileData = readFile(getRequestCycle());
return _myFileData;
}
private FileData readFileData(IRequestCycle cycle) {
ServletContext sc =
cycle.getRequestContext().getServlet().getServletContext();
InputStream is = sc.getResourceAsStream("WEB-INF/...");
// read using the input stream...
// aso...
}
--- end code
Now this would mean: if you just use your page normally, the static
member _myFileData will be initialized the first time it will be accessed.
If you want, you can also override the initialize method of the servlet
(subclassing ApplicationServlet), so it will read the resource.
If you want the resource to be read on each render, make the member
non-static, and set it to null, overriding the initialize() method.
Cheers,
Ron
.
ציטוט Joerg Bergner:
Thank you for your reply! Could you give me an example?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]