More generally, I would like to know how to access Application
environment for a service class.
So, Is there somewhere in Tapestry a Static method that could return
some global Application information ?
For example, from a Service (Business) Class I would like to:
- get the Application Web Root to read a file
- get a key from a property file which stand in WEB-INF/
Any idea ?
Thanks
Cyrille
Cyrille37 a écrit :
Hello,
Sure it is a beginner question, but I'm a beginner :o)
I would like to read a file which is located in the web root folder,
and put it in a String.
I had a look around the Internet and found some tricks :
A la "Servlet" :
ServletContext theApplicationsServletContext = (ServletContext)
this.getExternalContext().getContext();
String realPath =
theApplicationsServletContext.getRealPath("/resources/images");
File file = new File(realPath + File.separatorChar + justFileName);
A la "Rife" :
import com.uwyn.rife.tools.FileUtils;
URL resource =
getClass().getClassLoader().getResource("model/WordList.txt");
final String wordlist = FileUtils.readString(resource);
Please could you tell me what are methods and usages with Tapestry ?
Thanks
cyrille
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]