[Lift] Re: Jetty question

2009-12-02 Thread jhonig
Hi Alex,

> Which page(s) asked you for registration?

Several of the configuration file pages.   I will have a better look
later today.

Job

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: Jetty question

2009-12-02 Thread jhonig
Hi Tim,

> Lift is not yet compatible with Jetty 7 continuations... if you want to use 
> comet, please use Jetty 6 for the moment.

I don't use comet.  But is this dependency mentioned anywhere in the
Lift docs?  Can't remember
having seen any such information!

Job

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Jetty question

2009-12-02 Thread jhonig
Can anybody point me to the proper documentation for Jetty 7?

I found that http://docs.codehaus.org/display/JETTY/Static+Content
is outdated, the classes referred to do not exist anymore in Jetty 7.
Just replacing mortbay by eclipse in the class names didn't help...

Then Google gave me: http://wiki.eclipse.org/Jetty, but many of the
of the documentation links require me to be a member of some
unspecified entity...  One would think though that this wiki is the
proper source for Jetty documentation...

Job H.



--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to get the servlet context

2009-12-02 Thread jhonig

> Lift has a properties mechanism (see net.liftweb.util.Props).  You can
> define properties based on user name, machine name, and runmode.  This
> allows you to have different temporary directories depending on the
> developer/machine/run mode.

OK, I'll have a look.  For now I am trying to serve the images as
static
content.  In that context, I will post a new question.

Job H.

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to get the servlet context

2009-12-02 Thread jhonig
David,

> I'm all for putting stuff in a well-know location in the filesystem... and
> defining that well known location in the props file.

OK, then this is what I want.   But you refer to "THE" props file.  Do
you mean
a Jetty props file, a general Lift props file, a user defined props
file?

I tried to use a symbolic link from the WAR to an absolute fs
location, but that
was not allowed...

> Messing around with trying to figure out where the app server has exploded
> your WAR file (if it even has which is not AFAIK guaranteed) and putting
> files in there is a failure waiting to happen.

OK, I see.

Job

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to get the servlet context

2009-12-02 Thread jhonig
David,

> Storing files inside the exploded WAR file is a tremendously bad idea.  I
> don't think we should be helping a user do something that is going to
> continue to cause him pain.
>
> If he needs to upload images, etc. and then subsequently present them to the
> user, it's two tables in the RDBMS and a single stateless dispatch.  All in
> all < 40 lines of code and no pain.

I don't need to upload images.  They are created by a snippet and
should
be served right away.  They will be cleaned up after some 10 minutes
or so.
It's all about scaling images to the browser size and discarding them
after
the user hasn't accessed them for a while.  So it's really all about
accessing
a SCRATCH directory from the app and serving content from that
location.

I've never served images from a database and wonder if that is the
best
way to solve this problem, given the overhead of a db.  And I don't
think
it will be easy to make JAI (Advanced Imaging) write or read to/from
a
db, there's nothing whatsoever in the JAI documentation about that.

Best,  Job H.


>
> On Mon, Nov 30, 2009 at 2:08 PM, Marius  wrote:
> > Ahh so you want direct links to those files. Still you can do
> > something else. Point your URI's from your page to a specific uri such
> > as /myapp/serve/myimage.jpg. You intercept requests to
>
> > myapp :: serve :: _ using a DispatchPF. The dispatch PF knows about
> > your folder location (presumably from a config file) and reads
> > myimage.jpg from that path on the file system. Hence you can read the
> > File and send it to the client. I think you can use Lift's
> > StreamResponse or you can build your own LiftResponse that returns a
> > file using proper Content-Type.
>
> > Another approach would be to use a reverse proxy server in front of
> > your Lift application (this is a common production deployment model
> > that server static content from frontend server not app servers), your
> > Lift application could simply write files in the document-root folder
> > hence would be seen by the proxy server and served to the client.
>
> > I used in the past both options with no problem at all for use cases
> > not so different than yours.
>
> > Brs,
> > Marius
>
> > On Nov 30, 11:36 pm, jhonig  wrote:
> > > Marius,
>
> > > I tried to create a link from the webapp dir to another location with
> > > rw-access, but that was not allowed...  My conclusion was that you
> > > can't have symbolic links to locations outside the war.
>
> > > My problem is that there are three different locations that could all
> > > be interpreted as a "root" for looking up resources.  I've found
> > > nothing
> > > suggesting one over the other, and none of them works.  I assume
> > > there are more variables involved that I don't even know of.
>
> > > Job
>
> > > On Nov 30, 10:27 pm, Marius  wrote:
>
> > > > Ok I may be missing something essential from all this thread but why
> > > > not use a folder from the user's home directory? If your app runs say
> > > > under "jetty" OS user should heve read/write rights to write on the
> > > > home user file-system. Even if not (although I haven't encountered the
> > > > case) those rights can be granted by an admin. So why do you need
> > > > "special" container allocated locations to write files?
>
> > > > Br's,
> > > > Marius
>
> > > > On Nov 30, 11:18 pm, jhonig  wrote:
>
> > > > > Hi Tim, Jeppe, and others who have replied...
>
> > > > > I have spent a few more hours, but there are just too many variables
> > > > > and I haven't been able to figure them out.
> > > > > I logged the various locations (running under a standalone jetty, not
> > > > > mvn jetty:run, and got this:
>
> > > > >   INFO - TEMP = /tmp/Jetty_0_0_0_0_8080_tent.
> > > > > 0.1.SNAPSHOT.warvtra6b
> > > > >   INFO - REAL = /tmp/Jetty_0_0_0_0_8080_tent.
> > > > > 0.1.SNAPSHOT.warvtra6b/webapp
> > > > >   INFO - URL = file:/tmp/Jetty_0_0_0_0_8080_tent.
> > > > > 0.1.SNAPSHOT.warvtra6b/webapp/WEB-INF/classes/
>
> > > > > I tried to access images, both from the HTML served to my browser and
> > > > > from Scala snippets.   I used the
> > > > > following paths:
>
> > > > >   Images/testimage.jpg
> > > > >   work/Images/testimage.jpg
> > > > >   clas

[Lift] Re: How to get the servlet context

2009-12-02 Thread jhonig

Marius,

Thanks, I will have a look at it.  But I'll have to dive even deeper
into Lift, and don't know if it's worth it compared to using another
framework.  I'll try to make up my mind.

Job

On Nov 30, 11:08 pm, Marius  wrote:
> Ahh so you want direct links to those files. Still you can do
> something else. Point your URI's from your page to a specific uri such
> as /myapp/serve/myimage.jpg. You intercept requests to
>
> myapp :: serve :: _ using a DispatchPF. The dispatch PF knows about
> your folder location (presumably from a config file) and reads
> myimage.jpg from that path on the file system. Hence you can read the
> File and send it to the client. I think you can use Lift's
> StreamResponse or you can build your own LiftResponse that returns a
> file using proper Content-Type.
>
> Another approach would be to use a reverse proxy server in front of
> your Lift application (this is a common production deployment model
> that server static content from frontend server not app servers), your
> Lift application could simply write files in the document-root folder
> hence would be seen by the proxy server and served to the client.
>
> I used in the past both options with no problem at all for use cases
> not so different than yours.
>
> Brs,
> Marius
>
> On Nov 30, 11:36 pm, jhonig  wrote:
>
> > Marius,
>
> > I tried to create a link from the webapp dir to another location with
> > rw-access, but that was not allowed...  My conclusion was that you
> > can't have symbolic links to locations outside the war.
>
> > My problem is that there are three different locations that could all
> > be interpreted as a "root" for looking up resources.  I've found
> > nothing
> > suggesting one over the other, and none of them works.  I assume
> > there are more variables involved that I don't even know of.
>
> > Job
>
> > On Nov 30, 10:27 pm, Marius  wrote:
>
> > > Ok I may be missing something essential from all this thread but why
> > > not use a folder from the user's home directory? If your app runs say
> > > under "jetty" OS user should heve read/write rights to write on the
> > > home user file-system. Even if not (although I haven't encountered the
> > > case) those rights can be granted by an admin. So why do you need
> > > "special" container allocated locations to write files?
>
> > > Br's,
> > > Marius
>
> > > On Nov 30, 11:18 pm, jhonig  wrote:
>
> > > > Hi Tim, Jeppe, and others who have replied...
>
> > > > I have spent a few more hours, but there are just too many variables
> > > > and I haven't been able to figure them out.
> > > > I logged the various locations (running under a standalone jetty, not
> > > > mvn jetty:run, and got this:
>
> > > >   INFO - TEMP = /tmp/Jetty_0_0_0_0_8080_tent.
> > > > 0.1.SNAPSHOT.warvtra6b
> > > >   INFO - REAL = /tmp/Jetty_0_0_0_0_8080_tent.
> > > > 0.1.SNAPSHOT.warvtra6b/webapp
> > > >   INFO - URL = file:/tmp/Jetty_0_0_0_0_8080_tent.
> > > > 0.1.SNAPSHOT.warvtra6b/webapp/WEB-INF/classes/
>
> > > > I tried to access images, both from the HTML served to my browser and
> > > > from Scala snippets.   I used the
> > > > following paths:
>
> > > >   Images/testimage.jpg
> > > >   work/Images/testimage.jpg
> > > >   classes/work/Images/testimage.jpg
> > > >   WEB-INF/classes/work/Images/testimage.jpg.
>
> > > > The latter path is what I see in my .war file...   I have no special
> > > > filters.  I tried to add entries to my site map,
> > > > but none of them worked.  About to give up.  Hope somebody will help
> > > > me.
>
> > > > Job H.
>
> > > > On Nov 28, 3:14 pm, jhonig  wrote:
>
> > > > > Dear Tim and Heiko,
>
> > > > > I tested a few things under mvn jetty:run...:
>
> > > > >   getRealPath gives me "./src/main/webapp"
> > > > >   the temp attribute is set to "./target/work"
> > > > >   and the location is "./target/classes"
>
> > > > > While the war contains "classes/work" which is again different...   I
> > > > > didn't manage to get jetty to serve contents from any other directory
> > > > > than the first one.
>
> > > > > Didn't try to run it on the standalone jetty, since I still don't know

[Lift] Re: How to get the servlet context

2009-11-30 Thread jhonig
Marius,

I tried to create a link from the webapp dir to another location with
rw-access, but that was not allowed...  My conclusion was that you
can't have symbolic links to locations outside the war.

My problem is that there are three different locations that could all
be interpreted as a "root" for looking up resources.  I've found
nothing
suggesting one over the other, and none of them works.  I assume
there are more variables involved that I don't even know of.

Job

On Nov 30, 10:27 pm, Marius  wrote:
> Ok I may be missing something essential from all this thread but why
> not use a folder from the user's home directory? If your app runs say
> under "jetty" OS user should heve read/write rights to write on the
> home user file-system. Even if not (although I haven't encountered the
> case) those rights can be granted by an admin. So why do you need
> "special" container allocated locations to write files?
>
> Br's,
> Marius
>
> On Nov 30, 11:18 pm, jhonig  wrote:
>
> > Hi Tim, Jeppe, and others who have replied...
>
> > I have spent a few more hours, but there are just too many variables
> > and I haven't been able to figure them out.
> > I logged the various locations (running under a standalone jetty, not
> > mvn jetty:run, and got this:
>
> >   INFO - TEMP = /tmp/Jetty_0_0_0_0_8080_tent.
> > 0.1.SNAPSHOT.warvtra6b
> >   INFO - REAL = /tmp/Jetty_0_0_0_0_8080_tent.
> > 0.1.SNAPSHOT.warvtra6b/webapp
> >   INFO - URL = file:/tmp/Jetty_0_0_0_0_8080_tent.
> > 0.1.SNAPSHOT.warvtra6b/webapp/WEB-INF/classes/
>
> > I tried to access images, both from the HTML served to my browser and
> > from Scala snippets.   I used the
> > following paths:
>
> >   Images/testimage.jpg
> >   work/Images/testimage.jpg
> >   classes/work/Images/testimage.jpg
> >   WEB-INF/classes/work/Images/testimage.jpg.
>
> > The latter path is what I see in my .war file...   I have no special
> > filters.  I tried to add entries to my site map,
> > but none of them worked.  About to give up.  Hope somebody will help
> > me.
>
> > Job H.
>
> > On Nov 28, 3:14 pm, jhonig  wrote:
>
> > > Dear Tim and Heiko,
>
> > > I tested a few things under mvn jetty:run...:
>
> > >   getRealPath gives me "./src/main/webapp"
> > >   the temp attribute is set to "./target/work"
> > >   and the location is "./target/classes"
>
> > > While the war contains "classes/work" which is again different...   I
> > > didn't manage to get jetty to serve contents from any other directory
> > > than the first one.
>
> > > Didn't try to run it on the standalone jetty, since I still don't know
> > > how
> > > to tell jetty to serve contents that is not under the webapp
> > > directory.
> > > Probably have to do something with the site map which I don't fully
> > > understand.
>
> > > Guess my main problem is that I don't have any experience in this
> > > field (jetty/lift) and thought it wouldn't be to difficult to port my
> > > website
> > > to lift and enhance it a little on the fly.
>
> > > To be continued...
>
> > > Job Honig
>
> > > On Nov 28, 12:52 am, Timothy Perrett  wrote:
>
> > > > Here's a nugget of information for you that will help (as I do 
> > > > something similar to what you want in one of my applications):
>
> > > >   val protectionDomain: ProtectionDomain = 
> > > > classOf[bootstrap.liftweb.Boot].getProtectionDomain()
> > > >   val location: URL = protectionDomain.getCodeSource().getLocation()
>
> > > > Print the value of location, and that will get you headed in the right 
> > > > direction ;-) Moreover, if your using jetty, if there is a "work" 
> > > > directory next to where the war file is, jetty will automatically 
> > > > expand the war into that work folder... if not, it makes a temp 
> > > > directory in the relevant OS temp directory (/var/tmp on *nix OS)
>
> > > > Godspeed.
>
> > > > Tim.
>
> > > > On 27 Nov 2009, at 21:49, Heiko Seeberger wrote:
>
> > > > > Job,
>
> > > > > This directory is managed by the servlet container and as far as I 
> > > > > know there is little you can do to configure the location. If you use 
> > > > > Tomcat you are able to specify CATALINA_BASE and it will be somewhere 
> > > &

[Lift] Re: How to get the servlet context

2009-11-30 Thread jhonig
Hi Tim, Jeppe, and others who have replied...

I have spent a few more hours, but there are just too many variables
and I haven't been able to figure them out.
I logged the various locations (running under a standalone jetty, not
mvn jetty:run, and got this:

  INFO - TEMP = /tmp/Jetty_0_0_0_0_8080_tent.
0.1.SNAPSHOT.warvtra6b
  INFO - REAL = /tmp/Jetty_0_0_0_0_8080_tent.
0.1.SNAPSHOT.warvtra6b/webapp
  INFO - URL = file:/tmp/Jetty_0_0_0_0_8080_tent.
0.1.SNAPSHOT.warvtra6b/webapp/WEB-INF/classes/

I tried to access images, both from the HTML served to my browser and
from Scala snippets.   I used the
following paths:

  Images/testimage.jpg
  work/Images/testimage.jpg
  classes/work/Images/testimage.jpg
  WEB-INF/classes/work/Images/testimage.jpg.

The latter path is what I see in my .war file...   I have no special
filters.  I tried to add entries to my site map,
but none of them worked.  About to give up.  Hope somebody will help
me.

Job H.


On Nov 28, 3:14 pm, jhonig  wrote:
> Dear Tim and Heiko,
>
> I tested a few things under mvn jetty:run...:
>
>   getRealPath gives me "./src/main/webapp"
>   the temp attribute is set to "./target/work"
>   and the location is "./target/classes"
>
> While the war contains "classes/work" which is again different...   I
> didn't manage to get jetty to serve contents from any other directory
> than the first one.
>
> Didn't try to run it on the standalone jetty, since I still don't know
> how
> to tell jetty to serve contents that is not under the webapp
> directory.
> Probably have to do something with the site map which I don't fully
> understand.
>
> Guess my main problem is that I don't have any experience in this
> field (jetty/lift) and thought it wouldn't be to difficult to port my
> website
> to lift and enhance it a little on the fly.
>
> To be continued...
>
> Job Honig
>
> On Nov 28, 12:52 am, Timothy Perrett  wrote:
>
> > Here's a nugget of information for you that will help (as I do something 
> > similar to what you want in one of my applications):
>
> >   val protectionDomain: ProtectionDomain = 
> > classOf[bootstrap.liftweb.Boot].getProtectionDomain()
> >   val location: URL = protectionDomain.getCodeSource().getLocation()
>
> > Print the value of location, and that will get you headed in the right 
> > direction ;-) Moreover, if your using jetty, if there is a "work" directory 
> > next to where the war file is, jetty will automatically expand the war into 
> > that work folder... if not, it makes a temp directory in the relevant OS 
> > temp directory (/var/tmp on *nix OS)
>
> > Godspeed.
>
> > Tim.
>
> > On 27 Nov 2009, at 21:49, Heiko Seeberger wrote:
>
> > > Job,
>
> > > This directory is managed by the servlet container and as far as I know 
> > > there is little you can do to configure the location. If you use Tomcat 
> > > you are able to specify CATALINA_BASE and it will be somewhere beneath 
> > > that directory, I believe it is work/Catalina/localhost/.
>
> > > Regarding serving images from there: Depending on the configuration of 
> > > the servlet container WARs are not unpacked, hence there is no standard 
> > > way to bring these images "into" your webapp. I think you will not be 
> > > able to have the servlet container serve these images directly. But it 
> > > should be easy to write a ServletFilter or something that will do it for 
> > > you.
>
> > > Heiko
>
> > > 2009/11/27 jhonig 
> > > Heiko,
>
> > > In the meantime, I found that solution as well...   I tried it, and
> > > the default seems to
> > > be a "work" directory in "target".  I guess I can set another value
> > > for the attribute
> > > if I manage to convince jetty to do that for me.   What I forgot to
> > > mention is that
> > > the directory is to contain images that are to be served by jetty...
> > > So it means
> > > the directory should be logically under webapp, but not in the war (of
> > > course).
>
> > > If I use a link from inside the war to some regular file system
> > > location, I'll
> > > probably run into the same problem as before.  Any idea how to do
> > > this?
>
> > > Job H.
>
> > > On Nov 27, 6:56 pm, Heiko Seeberger 
> > > wrote:
> > > > File tempdir = (File)
> > > > config.getServletContext().getAttribute("javax.servlet.context.tempdir")
>
> > > > 2009/11/27 jhonig 
>
&g

[Lift] Re: How to get the servlet context

2009-11-28 Thread jhonig

> Use explicitly imports, thus avoiding these problems:

But the problem is knowing what to import :-)   When there's no IDE
support, all one
has are the scaladocs...   And *none* of the lift examples I found
uses explicit imports,
so you're on your own...

Job

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to get the servlet context

2009-11-28 Thread jhonig
Hi Jeppe,

I'm not using a front-end or any other kind of programming
environment.

I always avoided Eclipse because it usually got into my way, but with
the
lift habit of using wildcard imports I lose a lot of time tracing all
kinds of
definitions, so in this case I'm reconsidering...

As for a web-app front-end: making this website is a one-shot exercise
for me, as I'm not a web developer at all...  (Just a researcher/
software
engineer/photographer wanting to have a nice website, in case you
wonder.)  I'm going to look into more detail wrt Jetty and URL
mapping...

Thanks,

Job

On Nov 28, 3:47 pm, Jeppe Nejsum Madsen  wrote:
> jhonig  writes:
> > Dear Tim and Heiko,
>
> > I tested a few things under mvn jetty:run...:
>
> >   getRealPath gives me "./src/main/webapp"
> >   the temp attribute is set to "./target/work"
> >   and the location is "./target/classes"
>
> > While the war contains "classes/work" which is again different...   I
> > didn't manage to get jetty to serve contents from any other directory
> > than the first one.
>
> > Didn't try to run it on the standalone jetty, since I still don't know
> > how
> > to tell jetty to serve contents that is not under the webapp
> > directory.
> > Probably have to do something with the site map which I don't fully
> > understand.
>
> I think you need to figure out how your URLs map to resources in 1) your
> app and 2) the tmp files you generate.
>
> If the files in 2) is outside your app context, you configure jetty to
> serve the files like thishttp://docs.codehaus.org/display/JETTY/Static+Content
>
> If the files in 2) is inside your app context, you need to make your
> Lift app handle the urls with sitemap and some code that can send the
> correct files based on the urls.
>
> I think these are the only two options if you are not using a frontend
> such as nginx (highly recommended). If you do use a frontend, you can
> configure all kind of url mappings there
>
> So perhaps a few more details on the required mappings could help...
>
> /Jeppe

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to get the servlet context

2009-11-28 Thread jhonig
Dear Tim and Heiko,

I tested a few things under mvn jetty:run...:

  getRealPath gives me "./src/main/webapp"
  the temp attribute is set to "./target/work"
  and the location is "./target/classes"

While the war contains "classes/work" which is again different...   I
didn't manage to get jetty to serve contents from any other directory
than the first one.

Didn't try to run it on the standalone jetty, since I still don't know
how
to tell jetty to serve contents that is not under the webapp
directory.
Probably have to do something with the site map which I don't fully
understand.

Guess my main problem is that I don't have any experience in this
field (jetty/lift) and thought it wouldn't be to difficult to port my
website
to lift and enhance it a little on the fly.

To be continued...

Job Honig




On Nov 28, 12:52 am, Timothy Perrett  wrote:
> Here's a nugget of information for you that will help (as I do something 
> similar to what you want in one of my applications):
>
>   val protectionDomain: ProtectionDomain = 
> classOf[bootstrap.liftweb.Boot].getProtectionDomain()
>   val location: URL = protectionDomain.getCodeSource().getLocation()
>
> Print the value of location, and that will get you headed in the right 
> direction ;-) Moreover, if your using jetty, if there is a "work" directory 
> next to where the war file is, jetty will automatically expand the war into 
> that work folder... if not, it makes a temp directory in the relevant OS temp 
> directory (/var/tmp on *nix OS)
>
> Godspeed.
>
> Tim.
>
> On 27 Nov 2009, at 21:49, Heiko Seeberger wrote:
>
> > Job,
>
> > This directory is managed by the servlet container and as far as I know 
> > there is little you can do to configure the location. If you use Tomcat you 
> > are able to specify CATALINA_BASE and it will be somewhere beneath that 
> > directory, I believe it is work/Catalina/localhost/.
>
> > Regarding serving images from there: Depending on the configuration of the 
> > servlet container WARs are not unpacked, hence there is no standard way to 
> > bring these images "into" your webapp. I think you will not be able to have 
> > the servlet container serve these images directly. But it should be easy to 
> > write a ServletFilter or something that will do it for you.
>
> > Heiko
>
> > 2009/11/27 jhonig 
> > Heiko,
>
> > In the meantime, I found that solution as well...   I tried it, and
> > the default seems to
> > be a "work" directory in "target".  I guess I can set another value
> > for the attribute
> > if I manage to convince jetty to do that for me.   What I forgot to
> > mention is that
> > the directory is to contain images that are to be served by jetty...
> > So it means
> > the directory should be logically under webapp, but not in the war (of
> > course).
>
> > If I use a link from inside the war to some regular file system
> > location, I'll
> > probably run into the same problem as before.  Any idea how to do
> > this?
>
> > Job H.
>
> > On Nov 27, 6:56 pm, Heiko Seeberger 
> > wrote:
> > > File tempdir = (File)
> > > config.getServletContext().getAttribute("javax.servlet.context.tempdir")
>
> > > 2009/11/27 jhonig 
>
> > > > Dear Heiko,
>
> > > > > According to the Servlet spec each webapp has got a private temporary
> > > > > directory. I cannot remember exactly how to get this, maybe
> > > > > ServletContext.getTmpDir(). Please take a look at the spec.
>
> > > > I started reading the spec, but didn't find it yet.  ServletContext
> > > > doesn't
> > > > have any obvious way to get to a temporary dir, but I assumed I could
> > > > create one.  Would probably need to tweak a security policy to be able
> > > > to write to it, but that would be the next step.
>
> > > > Job H.
>
> > > > --
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Lift" group.
> > > > To post to this group, send email to lift...@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.
>
> > > --
> > > Heiko Seeberger
>
> > > My job: weiglewilczek.com
> > > My blog: heikoseeberger

[Lift] Re: How to get the servlet context

2009-11-27 Thread jhonig
Heiko,

In the meantime, I found that solution as well...   I tried it, and
the default seems to
be a "work" directory in "target".  I guess I can set another value
for the attribute
if I manage to convince jetty to do that for me.   What I forgot to
mention is that
the directory is to contain images that are to be served by jetty...
So it means
the directory should be logically under webapp, but not in the war (of
course).

If I use a link from inside the war to some regular file system
location, I'll
probably run into the same problem as before.  Any idea how to do
this?

Job H.

On Nov 27, 6:56 pm, Heiko Seeberger 
wrote:
> File tempdir = (File)
> config.getServletContext().getAttribute("javax.servlet.context.tempdir")
>
> 2009/11/27 jhonig 
>
>
>
> > Dear Heiko,
>
> > > According to the Servlet spec each webapp has got a private temporary
> > > directory. I cannot remember exactly how to get this, maybe
> > > ServletContext.getTmpDir(). Please take a look at the spec.
>
> > I started reading the spec, but didn't find it yet.  ServletContext
> > doesn't
> > have any obvious way to get to a temporary dir, but I assumed I could
> > create one.  Would probably need to tweak a security policy to be able
> > to write to it, but that would be the next step.
>
> > Job H.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lift...@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.
>
> --
> Heiko Seeberger
>
> My job: weiglewilczek.com
> My blog: heikoseeberger.name
> Follow me: twitter.com/hseeberger
> OSGi on Scala: scalamodules.org
> Lift, the simply functional web framework: liftweb.net

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to get the servlet context

2009-11-27 Thread jhonig
Dear Heiko,

> According to the Servlet spec each webapp has got a private temporary
> directory. I cannot remember exactly how to get this, maybe
> ServletContext.getTmpDir(). Please take a look at the spec.

I started reading the spec, but didn't find it yet.  ServletContext
doesn't
have any obvious way to get to a temporary dir, but I assumed I could
create one.  Would probably need to tweak a security policy to be able
to write to it, but that would be the next step.

Job H.

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to get the servlet context

2009-11-27 Thread jhonig
Thanks Ross, I will try this!   Is there a generic way to get to a
kind
of "sandbox" directory where snippets can read/write files?

Job

On Nov 27, 5:12 pm, Ross Mellgren  wrote:
> A way you can get the Servlet context is like this:
>
> LiftRules.context match {
>  case context: HTTPServletContext => // do something with
> context.ctx which is the javax.servlet.ServletContext
>  case _ => // do something when the context is not a servlet
> context, perhaps log an error
>
> }
>
> The reason you need the match is because Lift can run on non-servlet
> web containers, so Lift does not guarantee there is a Servlet context
> in scope.
>
> Hope that helps,
>
> -Ross
>
> On Nov 27, 2009, at 10:51 AM, jhonig wrote:
>
> > LS,
>
> > After Ross' kind invitation to post any other questions I might have,
> > I'll start with
> > this one:
>
> > The web application I am developing needs a scratch directory to white
> > scaled
> > images to.  I first try to use a subdir of /tmp and put a symbolic
> > link in place to
> > access that directory from my project's context.  However, this got me
> > an
> > error message (something about an aliased resource), so after some
> > searching
> > around I decided the best way is to create a directory inside WEF-INF
> > and
> > access it through getServletContext ().getRealPath ("/...").
>
> > From the APIdocs I found out that an instance of a ServiceContext is
> > passed
> > to HTTPServletContext, but I haven't been able to find if that is the
> > instance I
> > need, or how to get an instance of HTTPServletContext...
>
> > Note: I am currently able to read/write temporary finds when running
> > through
> > mvn getty:run, but I need a solution that still works when I deploy a
> > war with
> > an existing jetty server.
>
> > Thanks for any hints!
>
> > Job Honig
>
> > --
>
> > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en
> > .

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] How to get the servlet context

2009-11-27 Thread jhonig
LS,

After Ross' kind invitation to post any other questions I might have,
I'll start with
this one:

The web application I am developing needs a scratch directory to white
scaled
images to.  I first try to use a subdir of /tmp and put a symbolic
link in place to
access that directory from my project's context.  However, this got me
an
error message (something about an aliased resource), so after some
searching
around I decided the best way is to create a directory inside WEF-INF
and
access it through getServletContext ().getRealPath ("/...").

>From the APIdocs I found out that an instance of a ServiceContext is
passed
to HTTPServletContext, but I haven't been able to find if that is the
instance I
need, or how to get an instance of HTTPServletContext...

Note: I am currently able to read/write temporary finds when running
through
mvn getty:run, but I need a solution that still works when I deploy a
war with
an existing jetty server.

Thanks for any hints!

Job Honig

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to make Ajax call from "onLoad"/"onResize"?

2009-11-22 Thread jhonig
Hi Ross,

I haven't been able to test your solution yet, still struggling with
several other
issues.  I seldom feel this unproductive, I'm afraid, the lack of
documentation
and issues of what documentation are up to date are both troubling me.

Thanks for your help and I will definitely post back once I was
successful.

Job H.

PS: maybe I will now be someone else: google groups wanted me to re-
register to this group with a new nickname...

On Nov 18, 10:18 pm, Ross Mellgren  wrote:
> Yes, jsonCall is an extension of ajaxCall that automatically does the
> JSON conversion for you, which why you get an immutable.Map out of it
> rather than a blob of text. Let me know how it works out.
>
> -Ross
>
> On Nov 18, 2009, at 4:16 PM, jhonig wrote:
>
> > Hi Ross,
>
> > Thanks for your suggestion!  So I can actually use any jsonCall as if
> > it were
> > Ajax and deal with the result...  OK, nice.  Will try it out tomorrow!
>
> > Job
>
> > On Nov 18, 6:24 pm, Ross Mellgren  wrote:
> >> (n.b. not compiled or tested, and there might be an easier way:)
>
> >> class MySnippet {
> >> def handlers(ns: NodeSeq): NodeSeq = {
> >> val handleResize = SHtml.jsonCall(JE.JsObj("width" ->
> >> JE.JsVar
> >> ("window", "screen", "width"),
> >>"height" ->
> >> JE.JsVar("window", "screen", "height")),
> >>   obj => {
> >> val result = for {
> >>m <- (Box!!obj).asA[scala.collection.immutable.Map
> >> [String, Any]]
> >>width  <- m.get("width").asA[Int]
> >>height <- m.get("height").asA[Int]
> >> } yield {
> >>// do stuff with the width and height
>
> >>// some JS command to send back to the browser
> >>JsCmds.Noop
> >> }
>
> >> result.openOr(/* JS command to send back to browser if we
> >> failed to get arguments and so on */ JsCmds.Noop)
> >> })._2
>
> >> { Script {
> >> Function("handleResize", Nil, handleResize)
> >> } }
> >> }
>
> >> }
>
> >> Then in your template say onResize="handleResize()"
>
> >> Hope that gives you some pointers,
> >> -Ross
>
> >> On Nov 18, 2009, at 4:19 AM, jhonig wrote:
>
> >>> Hi All,
>
> >>> Yet another question: I need to make Ajax calls when a page is
> >>> loaded
> >>> or resized.  The call would need to pass some local client
> >>> information
> >>> (browser size).  The return should be javascript code that
> >>> populates a
> >>> div on that page (in particular: an image that is scaled on the
> >>> server
> >>> to match the browser size).   Actually, local js code is in place
> >>> that
> >>> makes the call only after the user has stopped resizing (using a
> >>> timeout).
>
> >>> I guess I have to use AjaxCall, providing an expression that puts
> >>> the
> >>> window dimensions in an array or list, then return the javascript to
> >>> add an  tag that downloads the scaled image from a generated
> >>> url.
>
> >>> Given the level of success I achieved so far, I thought I better ask
> >>> if this would work our before I start trying endlessly.
>
> >>> Thanks for any suggestions,
>
> >>> Job
>
> >>> --
>
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Lift" group.
> >>> To post to this group, send email to lift...@googlegroups.com.
> >>> To unsubscribe from this group, send email to 
> >>> liftweb+unsubscr...@googlegroups.com
> >>> .
> >>> For more options, visit this group 
> >>> athttp://groups.google.com/group/liftweb?hl=
> >>> .
>
> > --
>
> > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en
> > .

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




[Lift] Re: How to make Ajax call from "onLoad"/"onResize"?

2009-11-22 Thread jhonig
Thanks Ross, for your replies, they sure gave me new insights and
hints!
I got a simple version working, and at least now I can proceed
implementing
the behaviour I wanted, which was a bit more complex than what I
described
in my question.

Thanx again!  Job Honig


On Nov 18, 10:18 pm, Ross Mellgren  wrote:
> Yes, jsonCall is an extension of ajaxCall that automatically does the
> JSON conversion for you, which why you get an immutable.Map out of it
> rather than a blob of text. Let me know how it works out.
>
> -Ross
>
> On Nov 18, 2009, at 4:16 PM, jhonig wrote:
>
> > Hi Ross,
>
> > Thanks for your suggestion!  So I can actually use any jsonCall as if
> > it were
> > Ajax and deal with the result...  OK, nice.  Will try it out tomorrow!
>
> > Job
>
> > On Nov 18, 6:24 pm, Ross Mellgren  wrote:
> >> (n.b. not compiled or tested, and there might be an easier way:)
>
> >> class MySnippet {
> >> def handlers(ns: NodeSeq): NodeSeq = {
> >> val handleResize = SHtml.jsonCall(JE.JsObj("width" ->
> >> JE.JsVar
> >> ("window", "screen", "width"),
> >>"height" ->
> >> JE.JsVar("window", "screen", "height")),
> >>   obj => {
> >> val result = for {
> >>m <- (Box!!obj).asA[scala.collection.immutable.Map
> >> [String, Any]]
> >>width  <- m.get("width").asA[Int]
> >>height <- m.get("height").asA[Int]
> >> } yield {
> >>// do stuff with the width and height
>
> >>// some JS command to send back to the browser
> >>JsCmds.Noop
> >> }
>
> >> result.openOr(/* JS command to send back to browser if we
> >> failed to get arguments and so on */ JsCmds.Noop)
> >> })._2
>
> >> { Script {
> >> Function("handleResize", Nil, handleResize)
> >> } }
> >> }
>
> >> }
>
> >> Then in your template say onResize="handleResize()"
>
> >> Hope that gives you some pointers,
> >> -Ross
>
> >> On Nov 18, 2009, at 4:19 AM, jhonig wrote:
>
> >>> Hi All,
>
> >>> Yet another question: I need to make Ajax calls when a page is
> >>> loaded
> >>> or resized.  The call would need to pass some local client
> >>> information
> >>> (browser size).  The return should be javascript code that
> >>> populates a
> >>> div on that page (in particular: an image that is scaled on the
> >>> server
> >>> to match the browser size).   Actually, local js code is in place
> >>> that
> >>> makes the call only after the user has stopped resizing (using a
> >>> timeout).
>
> >>> I guess I have to use AjaxCall, providing an expression that puts
> >>> the
> >>> window dimensions in an array or list, then return the javascript to
> >>> add an  tag that downloads the scaled image from a generated
> >>> url.
>
> >>> Given the level of success I achieved so far, I thought I better ask
> >>> if this would work our before I start trying endlessly.
>
> >>> Thanks for any suggestions,
>
> >>> Job
>
> >>> --
>
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Lift" group.
> >>> To post to this group, send email to lift...@googlegroups.com.
> >>> To unsubscribe from this group, send email to 
> >>> liftweb+unsubscr...@googlegroups.com
> >>> .
> >>> For more options, visit this group 
> >>> athttp://groups.google.com/group/liftweb?hl=
> >>> .
>
> > --
>
> > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en
> > .

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




[Lift] Re: How to make Ajax call from "onLoad"/"onResize"?

2009-11-18 Thread jhonig
Hi Ross,

Thanks for your suggestion!  So I can actually use any jsonCall as if
it were
Ajax and deal with the result...  OK, nice.  Will try it out tomorrow!

Job

On Nov 18, 6:24 pm, Ross Mellgren  wrote:
> (n.b. not compiled or tested, and there might be an easier way:)
>
> class MySnippet {
>  def handlers(ns: NodeSeq): NodeSeq = {
>  val handleResize = SHtml.jsonCall(JE.JsObj("width" -> JE.JsVar
> ("window", "screen", "width"),
> "height" ->
> JE.JsVar("window", "screen", "height")),
>obj => {
>  val result = for {
> m <- (Box!!obj).asA[scala.collection.immutable.Map
> [String, Any]]
> width  <- m.get("width").asA[Int]
> height <- m.get("height").asA[Int]
>  } yield {
> // do stuff with the width and height
>
> // some JS command to send back to the browser
> JsCmds.Noop
>  }
>
>  result.openOr(/* JS command to send back to browser if we
> failed to get arguments and so on */ JsCmds.Noop)
>  })._2
>
>  { Script {
>  Function("handleResize", Nil, handleResize)
>  } }
>  }
>
> }
>
> Then in your template say onResize="handleResize()"
>
> Hope that gives you some pointers,
> -Ross
>
> On Nov 18, 2009, at 4:19 AM, jhonig wrote:
>
> > Hi All,
>
> > Yet another question: I need to make Ajax calls when a page is loaded
> > or resized.  The call would need to pass some local client information
> > (browser size).  The return should be javascript code that populates a
> > div on that page (in particular: an image that is scaled on the server
> > to match the browser size).   Actually, local js code is in place that
> > makes the call only after the user has stopped resizing (using a
> > timeout).
>
> > I guess I have to use AjaxCall, providing an expression that puts the
> > window dimensions in an array or list, then return the javascript to
> > add an  tag that downloads the scaled image from a generated url.
>
> > Given the level of success I achieved so far, I thought I better ask
> > if this would work our before I start trying endlessly.
>
> > Thanks for any suggestions,
>
> > Job
>
> > --
>
> > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=
> > .

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: How to execute client-side js from ajax callback?

2009-11-18 Thread jhonig
Dear Eros,

I had hoped to avoid reading the source code to get something done :-)

Indeed I noticed that the argument was a String.   I just hoped that
it
would be evaluated :-)

Your code is working now; next step was to try to assemble a
Javascript
string from some bits and pieces, including data gathered from client-
side
calls.  That's also a non-trivial undertaking, I've found by now.

Thanks a lot,

Job H.



On Nov 18, 12:17 pm, Eros Candelaresi  wrote:
> Hi,
>
> as a rule of thumb: when the Lift class expects a String as parameter,
> this will also be a String on JavaScript side. Alert expects a String,
> so it does not matter if the string is "Hello World!",
> "getAvailableWidth()" or anything else. By the time it reaches the
> client, Lift has already made sure that it is a plain text string. I
> guess, Run() is one of very little exceptions.
>
> On the other hand, when a Lift class takes a JsExp as parameter, the
> expression will be sent to the client as JavaScript code and then be
> executed there.
> Example:
> Stringify(getWidth())
> would result in the following JavaScript code:
> JSON.stringify(getAvailableWidth)
>
> It got pretty clear to me when I started looking at the source code.
> Most of those JavaScript wrapper classes are simply one-liners that
> create a small piece of JavaScript code.
>
> Btw, I found a nicer solution for your alert problem:
> def alert(what: JsExp) = {
>   JsFunc("alert", what)
>
> }
>
> Regards,
> Eros
>
> jhonig wrote:
> > Hi Eros,
>
> > Thanks for your reply!
>
> >> I ran into the same problem. The Alert case class takes only a string.
> >> |case class Alert(val text : String
> >> <http://java.sun.com/javase/6/docs/api/java/lang/String.html>)| |
>
> >> |I.e. the result of getWidth is quoted such that it remains a plain
> >> string when it is evaluated on client side. Best thing would be if Alert
> >> was changed to accept a JsExp as parameter, then your code would work.
>
> > I will try your workaround, but I still don't understand how
> > "Javascript"
> > expressions are evaluated.  From what you say, the result of getWidth
> > would be converted to "getAvailableWidth ()" and never actually run.
> > But then "Alert (Run (what))" should work, shouldn't it?  But the
> > results
> > are exactly the same!
>
> > Do you know of any comprehensive description of how such expressions
> > are evaluated by Lift?
>
> > Job
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




[Lift] Re: How to execute client-side js from ajax callback?

2009-11-18 Thread jhonig
Hi Eros,

Thanks for your reply!

> I ran into the same problem. The Alert case class takes only a string.
> |case class Alert(val text : String
> )| |
>
> |I.e. the result of getWidth is quoted such that it remains a plain
> string when it is evaluated on client side. Best thing would be if Alert
> was changed to accept a JsExp as parameter, then your code would work.

I will try your workaround, but I still don't understand how
"Javascript"
expressions are evaluated.  From what you say, the result of getWidth
would be converted to "getAvailableWidth ()" and never actually run.
But then "Alert (Run (what))" should work, shouldn't it?  But the
results
are exactly the same!

Do you know of any comprehensive description of how such expressions
are evaluated by Lift?

Job

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




[Lift] How to make Ajax call from "onLoad"/"onResize"?

2009-11-18 Thread jhonig
Hi All,

Yet another question: I need to make Ajax calls when a page is loaded
or resized.  The call would need to pass some local client information
(browser size).  The return should be javascript code that populates a
div on that page (in particular: an image that is scaled on the server
to match the browser size).   Actually, local js code is in place that
makes the call only after the user has stopped resizing (using a
timeout).

I guess I have to use AjaxCall, providing an expression that puts the
window dimensions in an array or list, then return the javascript to
add an  tag that downloads the scaled image from a generated url.

Given the level of success I achieved so far, I thought I better ask
if this would work our before I start trying endlessly.

Thanks for any suggestions,

Job

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




[Lift] How to execute client-side js from ajax callback?

2009-11-18 Thread jhonig
Hi All,

I am trying to execute a local (ie: defined in the template)
javascript function from an Ajax
callback.  This is the callback:

def testAjax2 (theXhtml : NodeSeq) : NodeSeq =
{
def getWidth () =
{
Call ("getAvailableWidth").cmd;
}

def alert (what : String) =
{
Alert (what);
}

bind ("fgh", theXhtml, "key" -> SHtml.a (() => {alert
(getWidth ());}, Text ("Click me")));
}

The alert is displayed, but the text it shows is "getAvailableWidth
()".  I have been trying dozens
of variations, but didn't get the result I am hoping for; it's always
the string...

What am I doing wrong?

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




[Lift] Re: Jetty beginner's question

2009-11-10 Thread jhonig


> to create war file:
>
> mvn package

Yes, that's what I did.  And then I dropped the war into the
appropriate directory
and created the configuration file in the contexts dir.  When I then
try to go to the
page I get: 

Well, that's weird.  I'm doing the same as before and now it suddenly
works!
Before I got a long stack trace that I wanted to paste into this
message.

Thanks anyway!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Jetty beginner's question

2009-11-10 Thread jhonig

Maybe someone can point out if I'm missing something.  I am trying to
get a
lift-war to run in a jetty instance on another machine.  I assumed
that the war
would include everything needed to make my test application run, but
apparently
it doesn't include all the dependencies that are found when I run
jetty from within
Maven.  How do I generate a war that is self-contained?

W
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Re: beginner's question about surround/bind/bind-at/with-param

2009-11-05 Thread jhonig

James,

> That would be because those are examples of tags, not copy-and-paste-code
> necessarily.

I didn't just cut and paste, tried to extract the "rule" how to do it
(of course).

> I can think of about million definitions of "just didn't work".  Which one
> do you mean here?

Blank page when I referred to my new "index" page referring to the
template.
No error message.  Looks like "nothing happening at all".   Assuming
the
"surround" didn't get bound.

When I said "head merging" didn't work, it was just that.  I tried to
merge a
title to the "head" element but it didn't make it.  No error message.
So in
this case "didn't work" meant "didn't have any visible effects at
all".  Sorry
for the overloading of the term "didn't work" :-)

Only  when I used a surround with "at" and a single bind point it my
page
showed up in the browser with the title merged.  That is the page I
have
now.

> Again.  No code, can't really tell you what's wrong, or right.

I'm sorry for that.  The problem was that I switched to a single bind
point
(which did what I wanted for now) and didn't keep the old code because
I
assumed I had used outdated documentation.  But now it appears that
the
working version is based on outdated information!

I will recreate the other version today and report any successes or
failures,
including code.

> Which examples are you talking about?  Most of the ones I've seen are fairly
> trivial.

My examples were even more trivial :-)  For now, I want just 3 static
pages
that refer to each other, each with a number of areas that are bound
to a
hook in a page template.  That's all.  That shouldn't be too
difficult, I thought.

Job Honig

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Re: beginner's question about surround/bind/bind-at/with-param

2009-11-05 Thread jhonig

I used 1.0, now switching to 1.1-M7, will report later.  First result
is that now the
Boot file of the demo project doesn't compile anymore.   Box, Full,
and Empty
are not found.

Job H.

On Nov 5, 11:47 pm, David Pollak 
wrote:
> On Thu, Nov 5, 2009 at 2:30 PM, Jim Barrows  wrote:
>
> > On Thu, Nov 5, 2009 at 3:04 PM, jhonig  wrote:
>
> >> Thank you James,
>
> >> What I tried first was taken from
> >>http://wiki.github.com/dpp/liftweb/about-lift-tags.
> >> I don't have the code anymore.  It was a surround without "at"
> >> attribute, and with
> >> multiple "bind-at"-s inside.   Nothing got bound, as far as I could
> >> see.  When I
> >> replaced the bind-at's with with-params, they *did* bind as expected.
> >> However,
> >> head-merging didn't work.   No errors either, just didn't work.
>
> >  That would be because those are examples of tags, not copy-and-paste-code
> > necessarily.
>
> > I can think of about million definitions of "just didn't work".  Which one
> > do you mean here?
>
> >> When I used a surround with an "at" attribute as in the old wiki, but
> >> without bind-at's
> >> or with-params, head-merging *did* work!   That's why I assumed that
> >> that description
> >> was the newer version!  So now it seems I'm on the wrong track,
> >> because that's
> >> the code I started using.
>
> > Again.  No code, can't really tell you what's wrong, or right.
>
> >> Another problem I didn't resolve sofar is that I had a few
> >> conventional 
> >> elements in my page.  But jetty can't resolve them so clearly I have
> >> to do more
> >> than that.  Should be trivial, of course.  Guess it has something to
> >> do with the
> >> sitemap, but I don't have a clear picture as to how that works.  The
> >> examples
> >> I found are much more involved than what I was looking for.
>
> > Yes, sitemap is a place to start looking.
> > The problem is that you're not providing enough detail to help you out.
> > "Doesn't work" is not enough to help out.  Did you get a 404 error?  blank
> > page?  Anything at all?
>
> > Which examples are you talking about?  Most of the ones I've seen are
> > fairly trivial.
>
> Also, please use Lift 1.1 (either M7 or SNAPSHOT).  It's got much better
> error reporting.
>
>
>
>
>
> >> Any help appreciated!
>
> >> Job Honig
>
> > --
> > James A Barrows
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://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
-~--~~~~--~~--~--~---



[Lift] Re: beginner's question about surround/bind/bind-at/with-param

2009-11-05 Thread jhonig

Thank you James,

What I tried first was taken from 
http://wiki.github.com/dpp/liftweb/about-lift-tags.
I don't have the code anymore.  It was a surround without "at"
attribute, and with
multiple "bind-at"-s inside.   Nothing got bound, as far as I could
see.  When I
replaced the bind-at's with with-params, they *did* bind as expected.
However,
head-merging didn't work.   No errors either, just didn't work.

When I used a surround with an "at" attribute as in the old wiki, but
without bind-at's
or with-params, head-merging *did* work!   That's why I assumed that
that description
was the newer version!  So now it seems I'm on the wrong track,
because that's
the code I started using.

Another problem I didn't resolve sofar is that I had a few
conventional 
elements in my page.  But jetty can't resolve them so clearly I have
to do more
than that.  Should be trivial, of course.  Guess it has something to
do with the
sitemap, but I don't have a clear picture as to how that works.  The
examples
I found are much more involved than what I was looking for.

Any help appreciated!

Job Honig

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---