Hi skippy !
I have tried your suggestion but unfortunately it did not work :(
I changed the java APIs I used this time but the result is the same:
...
try {
File f = new File("xml/users.xml");
FileReader reader = new FileReader(f);
BufferedReader buffer = new BufferedReader(reader);
buffer.readLine();
// Read a line of text
System.out.println(buffer.readLine());
}
....
The generated exception is:
Caused by: java.security.AccessControlException: access denied
(java.io.FilePermission \users.xml read)
also, If I try it like this: /xml/users.xml with the forward slash a
the beginning it goes for the root of the system which is C:/ and it
still does not work, which I find weird because that's outside the
application's context, right ?
Anyways, please help me Skippy.
Sincerely,
Jose.
On Jul 27, 2:13 pm, skippy <[email protected]> wrote:
> If that does not work, ping me again and I will provide a code sample.
>
> On Jul 27, 2:09 pm, skippy <[email protected]> wrote:
>
>
>
> > I would put the file in the WEB-INF/XML/
> > change the path to the file to xml/users.xml or /xml/user.xml
>
> > On Jul 27, 1:57 pm, Jose Luis Estrella Campaña <[email protected]>
> > wrote:
>
> > > Hello dane !
>
> > > You're right in assuming something it's not working. Here's the
> > > thing... I need to read from the xml file so I can perform some
> > > operations on it and then save it again, here's the code I'm trying to
> > > get to work:
>
> > > import ....
>
> > > public class GreetingServiceImpl extends RemoteServiceServlet
> > > implements
> > > GreetingService {
> > > public String greetServer(String input) throws
> > > IllegalArgumentException {
>
> > > FileInputStream fin;
>
> > > try {
> > > fin = new FileInputStream ("users.xml");
> > > System.out.println( new
> > > DataInputStream(fin).readLine() );
> > > fin.close();
> > > } catch (IOException e) {
> > > System.err.println ("Unable to read from file");
> > > System.exit(-1);
> > > }
> > > return "success reading file";
>
> > > }
>
> > > }
>
> > > And here's the exception I'm getting:
>
> > > Unable to read from file
> > > .
> > > .
> > > .
> > > Caused by: java.security.AccessControlException: access denied
> > > (java.lang.RuntimePermission exitVM.-1)
>
> > > ---------------------------------------------------------------------------
> > >
> > > -------------------------------------------------------------------------
> > > ----------
>
> > > This last test was performed putting the file where you suggested.
> > > (src/org/jose/server. )
>
> > > Thank you very much,
>
> > > Jose.
>
> > > On Jul 27, 1:13 pm, "dane.molotok" <[email protected]> wrote:
>
> > > > I guess I'm missing something in the question. Have you tried some
> > > > things and it's not working like you'd expect? I would think you could
> > > > put it in src/org/jose/server.
>
> > > > On Jul 27, 11:21 am, Jose Luis Estrella Campaña <[email protected]>
> > > > wrote:
>
> > > > > Good day everybody,
>
> > > > > I have this particular need, where I need to have a file (xml) within
> > > > > my GWT app. I have some data in this xml I must read, change, and then
> > > > > write (update)
> > > > > The file must be delivered or included within the Gwt App. Can anybody
> > > > > please tell me where can I place this file, so I can read/write it
> > > > > using java's file APi from an RPC Servlet.
>
> > > > > Here's a brief description of how my App's directory structure looks
> > > > > like:
>
> > > > > GwtApp
> > > > > |__ src
> > > > > | |__org
> > > > > | | |__jose
> > > > > | | |__client
> > > > > | | |__server
> > > > > | | |__shared
> > > > > | |
> > > > > | |__META-INF
> > > > > |
> > > > > |__ war
> > > > > |__gwtapp
> > > > > |__WEB-INF
>
> > > > > For my current needs, where would you suggest placing the file ?
>
> > > > > Thank you very much in advance,
>
> > > > > Have a nice day,
>
> > > > > Jose- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" 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-web-toolkit?hl=en.