Hi,
You need to open the file in the servlet (using java.io.File API), and
then stream/write the file on the response *after setting appropriate
headers* (using Servlet API). In particular you need to take a look at
HttpServletResponse methods.
-cheers,
Manish
> Hi,
>
[quoted text clipped - 9 lines]
> I found info on GetFile() here:
> http://www.slamd.com/slamd-1.8.2-javadoc/com/sun/slamd/misc/GetFile.html
You don't need this. See java.net.URL.openStream().
Simply open the stream, schlurp the contents either into memory or a local
file, or simply print it directly to the output stream. For example:
/**
* read the value at this URL and return it as a string
*
* @param source where to read from
*
* @return a string representation of the data fetched from the URL
*
* @since Jacquard 1.9
*/
protected String readStringFromURL( URL source ) throws IOException
{
BufferedReader in =
new BufferedReader( new InputStreamReader( source.openStream( ) ) );
StringBuffer buf = new StringBuffer( );
for ( String line = in.readLine( ); line != null;
line = in.readLine( ) )
{
buf.append( line );
buf.append( '\n' );
}
return buf.toString( );
}

Signature
simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
;; I'll have a proper rant later, when I get the time.
jonesy <3 - 24 Oct 2006 02:32 GMT
Thanks for your help. I tried the ideas that you both gave me, but I
don't think I properly explained what I was looking for before.. sorry
We want the servlet to open a file that is not publicly accessible via
a URL. The file is stored in a separate directory on the UNIX box, at
the same level as the public_html directory.
When I tried both your ideas they seemed to access the file from a URL
location (i.e. somewhere in public_html). It is important that users
cannot simply type the full file URL and access the spreadsheet,
without using the servlet (so that their level of access permission is
checked by the servlet).
Thanks for any further help or ideas