Julian, The short answer to your question is to create separate projects that depend on one another.
So, you can put all your business logic in a module and package it up as a "JAR" file (this is the basic unit of packaging for JVM-based applications). Then you can build a a web based application and/or a command line application that accesses the business logic (the library). On Fri, Nov 13, 2009 at 6:44 AM, Julian Backes <julianbac...@googlemail.com>wrote: > > Hi Lift Community, > > I'm pretty new to the Scala/Lift world. My idea is to port a web > application written by me in PHP to Scala/Lift. Unfortunately, the PHP > version also has some functions which are used by some cronjob, i.e. > from the command line. > > So my first question is: Is there any possibility to access functions > in a Lift webapp from the command line? > See above. > > My idea in a more general version is: I want to write some application > which can be accessed in multiple ways: for example from the command > line (as just described), from the web using "normal" xhtml pages, > from the web using json requests etc. > Of course, I want to write as less functionality as possible twice so > there should be some core which has the "logic" (and probably some > model/database in the background) and several interfaces (one command > line interface, one webinterface, one json interface...) which should > only act as translators. > For example the web interface gets some (let's say POST) request, > "extracts" the data needed to process the request and passes these > date to the core. The core does something and returns the data needed > for an answer. The webinterface takes these data and creates some > xhtml page out of it. > In contrast to that, the json interface "only" gets a request in json > format, extracts the data, passes them to the core, gets the result > and sends back a *json* answer. > The command line interface will just take some command line arguments, > extract data, pass them and answer with *some plain text*. > > So my second question is: How does this idea fit into the lift world? > Just fine. > > One reason for my questions: As I understood it, Lift is heavily bound > to the webinterface part I described above. For example the snippets > which seem to be one very important part of Lift can only work with > xml/xhtml data. > Yes, but the snippet is meant to bridge between business logic and XHTML presentation. > > I hope you understand my ideas and questions, I'm still learning > English ;-) > You speak it very well. Thanks, David > > Thanks in advance for all answers!! > > Julian > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---