Better way is to use  getClass().getResourceAsStream for accessing
files packed in jars
or for acccessing files located directly in the war you can use the
following (in a servlet):
    ServletContext ctx = getServletContext();
    InputStream is = ctx.getResourceAsStream( resourceName );

Do not forget to declare the data file as the resource file in
appengine-web.xml
(if it is located outside of the WEB-INF directory):
<resource-files>
  <include path="/resources/data-file.csv" />
</resource-files>

Vaclav


On Apr 18, 4:00 am, Philip Tucker <[email protected]> wrote:
> I have a data file I need to access on the server. If I include it in
> my source path on the client I can load it via
> ClassLoader.getSystemResourceAsStream. But this breaks on the server
> (I'm not sure if the eclipse plugin is even deploying it). What's the
> best way to do this? I don't want to incur a DB hit if I can avoid it,
> and it's too much data to embed in a class (~4MB).
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to