GWT Html not served from Lift Application

26 views
Skip to first unread message

AGYNAMIX Torsten Uhlmann

unread,
Sep 19, 2010, 1:16:12 PM9/19/10
to lif...@googlegroups.com
I'm trying to combine a simple GWT application with Lift. To keep it simple the GWT application is client side only so no client-server communication is needed.

Basically I have taken the Lift 2.1 prototype and exchanged the index.html page with the GWT host page- a simple page that loads the .nocache.js. I did not include any Lift surround tags to keep it as simple as possible. The GWT code resides in a directory webapp/gwtapp.

I have commented out access control through SiteMap: //LiftRules.setSiteMap(SiteMap(entries:_*))

When I open the index.html page directory in a browser all loads fine, however when I try to serve the page through Lift (running sbt jetty-run) the following happens:

- the page loads
- the GWT nocache.js is found and loads
- the GWT CSS files get loaded
- GWT creates an iframe on the page in which it should load the compiled file xxx.cache.html from webapp/gwtapp, however this file cannot be loaded:

"The Requested URL /gwtapp/3A9A9066398FE8F1910EF123A5D2CED1.cache.html was not found on this server"

I then copied index.html to index2.cache.html and tried to load this (after a server restart) which also failed.

So I guess there is some switch preventing Lift from loading .cache.html files...

I also tried to adapt the ObjJServer object and statelessDispatchTable as David showed in the Frothy Cappuccino example:

    LiftRules.statelessDispatchTable.prepend {
        case r @ Req( "invoicezero" :: Nil, _, GetRequest) => ObjJServer.serve(r)
      }

But that didn't help- probably because I did something wrong.


Can someone point me in the right direction on how to enable loading the .cache.html files? If it helps I'll upload the project to GitHub or BitBucket.

Thanks,
Torsten.


-- 
Torsten Uhlmann
AGYNAMIX(R). Passionate Software.
Inh. Torsten Uhlmann
Buchenweg 5, 09380 Thalheim
Phone:       +49 3721 273445
Fax:             +49 3721 273446
Mobile:       +49 151 12412427
Web:           http://www.agynamix.de
Skype:        torsten.uhlmann
Facebook, Twitter: agynamix

Timothy Perrett

unread,
Sep 19, 2010, 2:24:15 PM9/19/10
to lif...@googlegroups.com
I havent the first clue about GWT, but can you upload the project to github.

What is the purpose of serving index.cache.html? Its not clear to me.

Cheers, Tim

> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

David Pollak

unread,
Sep 19, 2010, 2:24:37 PM9/19/10
to lif...@googlegroups.com
On Sun, Sep 19, 2010 at 10:16 AM, AGYNAMIX Torsten Uhlmann <T.Uh...@agynamix.de> wrote:
I'm trying to combine a simple GWT application with Lift. To keep it simple the GWT application is client side only so no client-server communication is needed.

Basically I have taken the Lift 2.1 prototype and exchanged the index.html page with the GWT host page- a simple page that loads the .nocache.js. I did not include any Lift surround tags to keep it as simple as possible. The GWT code resides in a directory webapp/gwtapp.

I have commented out access control through SiteMap: //LiftRules.setSiteMap(SiteMap(entries:_*))

When I open the index.html page directory in a browser all loads fine, however when I try to serve the page through Lift (running sbt jetty-run) the following happens:

- the page loads
- the GWT nocache.js is found and loads
- the GWT CSS files get loaded
- GWT creates an iframe on the page in which it should load the compiled file xxx.cache.html from webapp/gwtapp, however this file cannot be loaded:

"The Requested URL /gwtapp/3A9A9066398FE8F1910EF123A5D2CED1.cache.html was not found on this server"

You need a SiteMap entry for the specific page or a global entry for the /gwtapp directory.  You can see an example of how to make a complete directory servable in the example code (everything in /static is servable).
 

I then copied index.html to index2.cache.html and tried to load this (after a server restart) which also failed.

So I guess there is some switch preventing Lift from loading .cache.html files...

I also tried to adapt the ObjJServer object and statelessDispatchTable as David showed in the Frothy Cappuccino example:

    LiftRules.statelessDispatchTable.prepend {
        case r @ Req( "invoicezero" :: Nil, _, GetRequest) => ObjJServer.serve(r)
      }

But that didn't help- probably because I did something wrong.


Can someone point me in the right direction on how to enable loading the .cache.html files? If it helps I'll upload the project to GitHub or BitBucket.

Thanks,
Torsten.


-- 
Torsten Uhlmann
AGYNAMIX(R). Passionate Software.
Inh. Torsten Uhlmann
Buchenweg 5, 09380 Thalheim
Phone:       +49 3721 273445
Fax:             +49 3721 273446
Mobile:       +49 151 12412427
Web:           http://www.agynamix.de
Skype:        torsten.uhlmann
Facebook, Twitter: agynamix

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

AGYNAMIX Torsten Uhlmann

unread,
Sep 19, 2010, 3:06:41 PM9/19/10
to lif...@googlegroups.com
I have uploaded the example code to: http://github.com/tuhlmann/lift-gwt

The GWT code directory is called "invoicezero" within webapp.

@David: I added the directory to the LiftRules but that didn't change the situations. Files from the directory had been loaded before (I disabled access control) but the cache.html files cannot be loaded.

@Tim: I tried to load index.cache.html just for the purpose to prove I have a problem loading files that end with cache.html. It was only a test. However GWT names the files that contain the GWT JavaScript code <arbitrary number>.cache.html.

Thanks for your help,
Torsten.
Mit freundlichen Grüßen,
Kind Regards,

Torsten Uhlmann

AGYNAMIX Torsten Uhlmann

unread,
Sep 20, 2010, 3:45:41 AM9/20/10
to lif...@googlegroups.com
The problems really seems to come from the file extension "cache.html".

For instance, I renamed the file webapp/invoicezero/3A9A9066398FE8F1910EF123A5D2CED1.cache.html to webapp/invoicezero/3A9A9066398FE8F1910EF123A5D2CED1.cache.txt


which worked perfectly fine. Using the extension ".html" (without .cache) also works, but ".cache.html" or ".nocache.html" does not.

At this stage it seems Lift is preventing files with these extensions from being served.

I also updated the Lift version in the SBT project to 2.1-RC2, without success.

Have you got any ideas why files with this extension do not get through?

Thanks,
Torsten.

Am 19.09.2010 um 20:24 schrieb David Pollak:

Mit freundlichen Grüßen,
Kind Regards,

Torsten Uhlmann

-- 

Timothy Perrett

unread,
Sep 20, 2010, 4:29:54 AM9/20/10
to lif...@googlegroups.com
See the attached. Serves them just fine. 

Note, this is onyl a good option if the cache.html stuff does not need to interact with Lift snippets directly. Otherwise you'll need to use a sitemap wildcard like:

Menu("static") / "static" / **

Cheers, Tim

lift-gwt.zip

AGYNAMIX Torsten Uhlmann

unread,
Sep 20, 2010, 5:03:54 AM9/20/10
to lif...@googlegroups.com
Splendid!

Such a small piece of code with such a large impact :)

I try to put up a sample application and write a short article about it so that it may serve as a blueprint in the future.

Thanks again,
Torsten.

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

<lift-gwt.zip>
Reply all
Reply to author
Forward
0 new messages