XYZ <x.y.zhao.88 <at> gmail.com> writes:

> 
> Try using assets... (you can inject it or pass it as a parameter)
> 
>    ...
>     <at> Asset("context:/myfile")
>    public abstract IAsset getFile();
> 
>    ...
>    {
>       BufferedReader reader = new BufferedReader(new InputStreamReader(
>                      getFile().getResourceAsStream(cycle)));
>       ...

He's trying to do it in a custom service, so he can't just
use @Asset to inject a context asset. In addition, it's
an overkill to use a context asset because he doesn't need
i18n support and doesn't use it in an Image or Shell. If
he is happy to access the file through HTTP as in the case
of an asset, then a simpler way is:

  URL url = new URL(cycle.getAbsoluteURL("/myfile"));
  InputStream s = url.openStream();

--
Author of an e-Book for learning Tapestry (http://www.agileskills2.org/EWDT)


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

Reply via email to