Thom Park at [EMAIL PROTECTED] wrote:

> hello,
> 
> I have a requirement where i need to make multiple passes over a resource
> stream
> obtained via ServletContext.getResourceAsStream().
> 
> My problem is that as follows:
> 
> InputStream is = sc.getResourceAsStream("/my_resource_name");
> 
> .... do 1st processing pass
> 
> is.close();
> 
> is = sc.getResourceAsStream("/my_resource_name");
> 
> ... do second processing pass...
> 
> The problem is that, as far as the StandardClassLoader is concerned, the
> cached copy of the input stream is still good (and it isn't I just closed
> it)
> and I get the original (now bad) input stream returned.
> 
> 
> Is there anyway to force tomcat to reload the resource object (without
> unloading the context).
> as, right now I'm reading the whole resource into a byte array and using
> [my] cached copy
> for processing.

Seems to be a bug in the classloader implementation. When the resource
inputstream is closed, and you get another one, you should get a fresh new
working stream...

    Pier

Reply via email to