my dog learned polymorphism*
The moose likes Servlets and the fly likes how to run java web application offline? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to run java web application offline?" Watch "how to run java web application offline?" New topic
Author

how to run java web application offline?

Michael L. Zhang
Ranch Hand

Joined: Jul 06, 2003
Posts: 33
We have a web application built on java/jsp technology. This web application generates most of the client side files at the initial launching time.

Now, we need add a new functionality to let user download all the client side html/javascript source after launching the application, so user can access our application by viewing the downloaded html files offline.

We need add a button saying "DOWNLOAD" in the web application, when user click the button, we captures all the current client side content and saved it to user's local disk. Since it has multiple frames, we will need capture the source for all the frames.

Can someone shed light on how to achieve that?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Well this isn't going to have a JSP solution, so I've moved this to the Servlets forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Do all the pages makes sense in a vacuum? In other words, not depending on user input via forms links or the like that need server processing?

I'm having a hard time envisioning how anything that needs to be written as a web app can operate in an environment without a server. If it could, why not just use static HTML pages to begin with?
Michael L. Zhang
Ranch Hand

Joined: Jul 06, 2003
Posts: 33
In our case, all the client html pages are being generated at the very beginning when the user launches this jsp application. We only need access backend server at the initial launch time, then we do not need the server any more. So, that is why we like to run it offline as a pure html collections application if the user downloads it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Using a web app as a templating engne in this way is a bit weird. I'd have used something you could automate with ant, perhaps XSLT.

In any case, I guess you could set up a filter and a response wrapper that could write the resulting responses to the file system, and then have a script that traverses every page on the site.

Search for "filter" and "response wrapper" in the forum for previous discussions of their usage.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Or...

Write a small Java app that uses HttpClient to hit every page and capture the response.

Or...

Write the above as an Ant task.
[ October 13, 2006: Message edited by: Bear Bibeault ]
Michael L. Zhang
Ranch Hand

Joined: Jul 06, 2003
Posts: 33
Bear, thanks. But it did not work out here.

I think I need explain my situation more specifically.

I am working on a jsp based course player. Whenever user login or logout, we keep the track of the status of the course user accessed. So we know how many items the user already visisted, and we bring the user back to the previous page he/she last visited when he/she log back in.

Now, some users like to play a course offline. The idea is adding a "download" button at our current jsp appliation. Because by the time of user clicking "download", the server already generated all client side source (html/javascript) and downloaded to user's browser.

I know there are some commercial software, like Htmlsource Viewer can catch all the client side source when you move the mouse to IE browser. But I just do not know how to do that by using a button at our web application. Is there a way to go back to server side and get all the source initially generated for this course when user click the "download" button?
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Is your LMS compliant to SCORM (Shareable Content Object Reference Model).

If not please google it you may find something for your situation.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Setup a filter which will capture all user's request responses and store them in a temporary storage. When user selected DOWNLOAD, then zip the storage and send to the user. You may have something on client side as offline player or something like that. We use TJWS for that. Live search for it.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Michael L. Zhang
Ranch Hand

Joined: Jul 06, 2003
Posts: 33
Patel, Rog

Thanks for your reply.

I am now using a html form to post back all the frames' html source from client side to a servlet, and then on the server side, I write to a file/folder/zip to let user to download. Is this a good solution?

BTW, Patel, we are using SCORM for our course player.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to run java web application offline?