There is a service, but it isn't exposed to the Mailet API. James uses it, itself, as you can see from all of the file:// references.
Are you asking for the equivalent of ServletContext.getRealPath(String), e.g., MailetContext.getRealPath(String)? I don't have a problem with it. I've been mulling it over for a while, since I have written several matchers and mailets that also need data from the file system. I don't think that I'd expose the whole selector-based approach that James uses. --- Noel -----Original Message----- From: Mitchell Morris [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 17:50 To: [EMAIL PROTECTED] Subject: Reading resources within a mailet My question: how do I refer to plain ol' file resources from within a mailet without hard-coding the full pathname? Failing that, is there an interpolation service available to a mailet? I have written a simple mailet to wrap an existing external service. The service object originally expected to fetch all of its configuration information from a resource (via getClass().getClassLoader().getResourceAsStream()). This didn't work, but in an unusual fashion: the InputStream was either null or empty, depending on whether or not the resource was found. That is, it didn't seem to read the resource file, but returned end-of-file immediately. After changing the service to fetch its configuration via reading a file, I now have to configure the mailet with a path to the service configuration file like so: <mailet match="[EMAIL PROTECTED]" class="GatewayServiceMailet"> <configuration> /jakarta/james-2.1.3/apps/james/SAR-INF/gateway-config.xml </configuration> </mailet> The problem here is that the full path is hard-coded. I tried various interpolated bits, like "${app.base}/SAR-INF/gateway-config.xml", but there doesn't seem to be any interpolation performed when the config.xml file is parsed. The frustrating bit is that various repositories use URLs like "file://var/mail" to refer to relative locations but I can't spelunk fast enough to figure out how to implement the same feature in my mailet. So now what do I do? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]