Writing to an XML file
Hello everyone, I'm new in GWT, and I can not solve a problem. I can not write to an XML file. I tried to look at the documentation but I did not understand much. Someone can give me a hand? Thank you for your cooperation! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Reading/Writing a public XML file at the server side
I'm working on a GWT application and previously I was simply reading and writing to the file data.xml, which worked fine at that point. However now I want to have the file available publicly (i.e. by replacing mymodule.html with data.xml in the URL), and I'm now having difficulty with reading/writing the file whilst using the hosted mode browser. I achieved making the file public by adding the file to my Eclipse project under the public directory and then adding public path=public/ / to my module.gwt.xml file, so now I can change the URL in the hosted mode browser and view the contents of the file. Now, however, I would also like to read and write the same file that is public. I tried using getServletContext().getRealPath(data.xml) but the returned path doesn't exist. Any ideas? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Reading/Writing a public XML file at the server side
Hey, In GWT 1.6, you don't need to put files into your app's source folder; instead, put it directly into the war folder. In this way, the HostedMode server will know to update when the file changes, as opposed to having to manually recompile the file every time you write to it. Consider using a static String to point to your local harddrive location of the war folder, and just change this string to your external server's filestructure when you compile a production build. If you like, you could even use a deferred binding property, isLocalHost to automatically change this string... define-property name=isLocalHost values=yes,no/ property-provider name=isLocalHost![CDATA[ if (window.location.indexOf('localhost')==-1)return 'no'; return 'yes'; ]]/property-provider Then, just do deferred binding on this property to replace your file pointer......Oh wait, you need this server side. Just use String fileHome = request.getDecodedRequestURI().contains (localhost)? /home/localuname/workspace/proj/war/ : /home/ serveruname/public_html/; Or likewise. Who knows, maybe using war instead of src folders will make getRealPath work too... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---