Thanks all for your comments on this issue. Based on what you've
written,
it seems that normal file io works fine in Lift as long as you don't
try to
affect the exploded war file in the process. In my case, I just simply
used XML.loadFile and XML.saveFull from scala directly, pointing to
a directory outside the war.

Thanks again for the help.



On Jul 5, 9:08 pm, David Pollak <[email protected]> wrote:
> The broader issue is that how a WAR file is exploded (converted from WAR/Zip
> format to an on-disk representation) is a servlet-container specific issue.
>
> Putting an XML file in your WAR and reading from it is totally cool.  The
> abstraction that Marius pointed to is the correct one... and more generally,
> using Class.getResource is the way to find something in the WAR or JAR.
>
> Writing to something in your WAR is going to present all manner of problems
> including the above-mentioned servlet-container related issues as well as
> issues about being over-written on re-deployment.
>
> If you're looking to have an XML-based persistence mechanism, I'd suggest
> putting the full path to the XML store in your props file (there's a props
> file per user, per host, and per run-mode, so there's lots of possibilities)
> and use that to look for props.  Alternatively, put something in a "dot"
> directory that lives in the launching user's home directory (like Maven's
> .m2 directory) so it's in a well known location.
>
> On Sun, Jul 5, 2009 at 2:01 PM, Naftoli Gugenhem <[email protected]>wrote:
>
>
>
>
>
> > My point was to help him diagnose his file not found, not to know where the
> > server is storing his app. I assume he is using relative paths and they may
> > not be relative to where they should be.
>
> > -------------------------------------
> > Timothy Perrett<[email protected]> wrote:
>
> > If you need to get the absolute path where the exploded war is living,
> > you can get that via ServletContext I do believe. Generally speaking,
> > Lift provides no mechanism for writing stuff to the filesystem and
> > does not interfere with file i/o.
>
> > Cheers, Tim
>
> > On Jul 5, 9:15 pm, Naftoli Gugenhem <[email protected]> wrote:
> > > Why would lift interfere with file io? Resource server is probably for
> > static http. If you're getting file not found I can't imagine it's lift's
> > fault. Try dumping new java.io.File(".").listFiles() or .getAbsolutePath
> > etc. to see what directory is the default. What kind of server are you
> > using?
>
> > > -------------------------------------
>
> > > glenn<[email protected]> wrote:
>
> > > Thanks, Marius.
>
> > > Now, is there something similar for writing XML to a file. I saw
> > > nothing on LiftRules that
> > > seems to apply.
>
> > > Glenn...
>
> > > On Jul 4, 12:36 am, "marius d." <[email protected]> wrote:
>
> > > > Try LiftRules.loadResourceAsXml
>
> > > > Br's,
> > > > Marius
>
> > > > On Jul 4, 1:11 am, glenn <[email protected]> wrote:
>
> > > > > I've searched this group and combed through the lift book for an
> > > > > answer, but found none - how to use file-based storage for data
> > within
> > > > > Lift.
>
> > > > > For example, how would I call something like:
>
> > > > > def xml = XML.loadFile(<fileName>)
>
> > > > > without getting a java.io.FileNotFoundException?
>
> > > > > I tried storing the files in a directory under webapp, and even
> > > > > included the directory in the resource path in Boot.scala, like so:
>
> > > > > ResourceServer.allow({
> > > > >       case "contents" :: _ => true
>
> > > > >     })
>
> > > > > But that doesn't work.
>
> > > > > Any help would be appreciated.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" 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/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to