Try using assets... (you can inject it or pass it as a parameter)

  ...
  @Asset("context:/myfile")
  public abstract IAsset getFile();

  ...
  {
     BufferedReader reader = new BufferedReader(new InputStreamReader(
                    getFile().getResourceAsStream(cycle)));
     ...

On 20050825, at 220250, Andy Chu wrote:

Eclipse shows me this method is deprecated. Is any more elegant way
available ?

On 8/25/05, Kent Tong <[EMAIL PROTECTED]> wrote:


Andy Chu <andychu <at> gmail.com <http://gmail.com>> writes:



Dear All,

In my self-defined service, an IEngineSerivce, I need to access files

under

${CONTEXT}/myfiles. Would you please tell me how to access them with a
FileInputStream ?


Try:
String path =
cycle.getRequestContext().getServlet().getServletContext().
getRealPath("/myfiles/foo");
FileInputStream stream = new FileInputStream(path);

--
Author of e-book for learning Tapestry (www.agileskills2.org/ EWDT<http://www.agileskills2.org/EWDT>
)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: tapestry-user- [EMAIL PROTECTED]





--
我是天空裡的一片雲
偶爾投影在妳的波心

----偶然.徐志摩



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to