[google-appengine] Reading a file in GAE Java

2010-03-22 Thread Iain Flynn
Hi there. I have an application that requires me to read in and
transform an XSLT stylesheet, which I keep in the directory /xml in /
war.

I've read the tutorials, and I've included it as a resource file (more
specifically, set that all xsl files are included as resource files),
but when I try to read it in my Java servlet (using the URI /xml/
file.xsl), I get the FilePermission error. I presume I'm getting this
error because it can't find the file (I know that writing files is not
allowed, but I'm opening it in read-mode).

I've looked through all the tutorials and I can't see where I'm going
wrong here. I can use files with my HTML, but getting Java on them
seems to elude me.

I get the feeling I've made a very elementary mistake, but can't for
the life of me figure it out.

Thanks for your time, and sorry if this is the wrong place for this.

- Iain

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Reading a file in GAE Java

2010-03-22 Thread Patrick Twohig
I use

Class.getResourceAsStream("/xml/myschema.xsd");

Cheers!

On Mon, Mar 22, 2010 at 10:57 AM, Iain Flynn wrote:

> Hi there. I have an application that requires me to read in and
> transform an XSLT stylesheet, which I keep in the directory /xml in /
> war.
>
> I've read the tutorials, and I've included it as a resource file (more
> specifically, set that all xsl files are included as resource files),
> but when I try to read it in my Java servlet (using the URI /xml/
> file.xsl), I get the FilePermission error. I presume I'm getting this
> error because it can't find the file (I know that writing files is not
> allowed, but I'm opening it in read-mode).
>
> I've looked through all the tutorials and I can't see where I'm going
> wrong here. I can use files with my HTML, but getting Java on them
> seems to elude me.
>
> I get the feeling I've made a very elementary mistake, but can't for
> the life of me figure it out.
>
> Thanks for your time, and sorry if this is the wrong place for this.
>
> - Iain
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>


-- 
Patrick H. Twohig.

Namazu Studios
P.O. Box 34161
San Diego, CA 92163-4161

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.