cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Howard <coc...@leverageweb.com>
Subject Re: source resolving help
Date Mon, 19 May 2003 12:04:05 GMT
At 06:16 PM 5/18/2003, you wrote:
>Geoff Howard wrote:
>...
>
>>Here's my situation: in a sitemap component (a file upload handler
>>which will move a PartOnDisk, or write out the stream of a FileInMemory), 
>>I want to: 1) resolve a directory path relative to the current sitemap, 
>>2) create a file in that directory, 3) write to the file one time, and 
>>close/release it as necessary.
>>
>>so, I could do (?) FileSource fs = 
>>(FileSource)resolver.resolveURI("directory/filename.ext");
>
>ClassCastException!
>
>Why do you think you will get FileSource? :)
>Of course, sometimes, you *will* get FileSource. But in many ligitimate 
>situations you won't.

Yes, if I think I might get something else, I'll do an instanceof before 
the cast.  That's part of what's opaque to me though - what determines what 
kind of source I get?  Is it simply the prefix? (file:, http:, etc)?  Now 
that I know I'm on the right track, I can dig in the source if you think 
it'll be unraveled there.

I am handling file uploads and simply moving a file (or writing an 
InputSource to a file).  I'm using Source for the destination.  In this 
case, I'd usually if not always expect a FileSource, no?  But part of the 
reason for delving into using Source is that I might expect to get support 
for other places to put a file semi-automagically.  But I'm not sure what 
other end sources would make sense as a destination besides FileSource.

Geoff 


Mime
View raw message