aspose file tools*
The moose likes Servlets and the fly likes Help me save my Java Webapp from the PHP Hordes! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help me save my Java Webapp from the PHP Hordes!" Watch "Help me save my Java Webapp from the PHP Hordes!" New topic
Author

Help me save my Java Webapp from the PHP Hordes!

Fabio Fonseca
Greenhorn

Joined: Jan 19, 2006
Posts: 29
There is something that was *supposed* to be very easy, but I just can't find any information on the net.

My java Webapp is built upon hibernate and some other frameworks, but we're facing some serious problems with scalability. We don't have any money, and our server is pretty crappy.

To make this story shorter and simple, another company will sponsor us, but they want us to go all PHP. But the PHP house they hired will only rewrite our code, but saving everything as static HTML and serving it through Apache.

I have been for days trying to find information in how to do that in java, but I wasn't successful. I've read tons of documentation about Tapestry, Velocity, etc. But none seemed to just save a page as static html and save it in the directory where is apache located.

Any hope for me?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

How on earth can a web app be pre-saved as static pages?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
I did a site once where the content was templated, not dynamic in the sense of user-specific, or time sensitive views, but the JSP pages were a complex set of includes, for headers, footers, and content that came from a database. The navigation was driven from the database too, so it was a dynamic site, but the content was constant at any given point of time.

In my case the content was accessed by a fake path, like /articles/2006/01
and a servlet would be mapped to /articles/*, and interpreted the rest of the URL as parameters to the page.

what we did was use the unix wget tool to 'spider' our test server and rewrite the paths to be self contained relative url like things.
we really only had a few template jsp pages, but we had hundreds of 'static' html output from it.

the motivation was to make a cdrom of the stuff we had at the time.

though the exact plethora of command line options we used for wget escapes me now. I guess other web crawler tools could be used too.


Error: Keyboard not attached. Press F1 to continue.
Fabio Fonseca
Greenhorn

Joined: Jan 19, 2006
Posts: 29
Originally posted by Travis Hein:
I did a site once where the content was templated, not dynamic in the sense of user-specific, or time sensitive views, but the JSP pages were a complex set of includes, for headers, footers, and content that came from a database. The navigation was driven from the database too, so it was a dynamic site, but the content was constant at any given point of time.


Travis, you just read my mind all alright! This is exactly my problem. I have the content in a database, several JSP and I need static output for this content. And, yes, we're also thinking in distributing our content in other forms, not just web - in pen driver or so.


what we did was use the unix wget tool to 'spider' our test server and rewrite the paths to be self contained relative url like things.
we really only had a few template jsp pages, but we had hundreds of 'static' html output from it.


Gotcha! Correct me if I'm wrong. What you did was: called wget to, well, get all our content and save somewhere else following a definite order. I think that will do the trick, since our content is very manageable and uniform in it's URLs.




though the exact plethora of command line options we used for wget escapes me now. I guess other web crawler tools could be used too.


I will check more on that. Thanks very much for your reply.

I was considering also using tapestry or velocity from Jakarta. Velocity includes a tool called Texen, which saves the output of a servlet in any other format. Any clues on that? Should I ask in the Frameworks forum?

once again, thank you very much!
[ July 05, 2006: Message edited by: Fabio Fonseca ]
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
Let them try.
php scales poorly, hardly at all in fact.
Only advantage is that it's cheaper to host for a given traffic volume, because the cheap low quality providers don't host Java as it's more difficult to find people who can properly administer a Java application server than a plain old Apache with mod-php enabled (never mind that you need more to do it properly, but that's why they're low quality hosting providers).


42
Fabio Fonseca
Greenhorn

Joined: Jan 19, 2006
Posts: 29
Originally posted by Jeroen T Wenting:
Let them try.
php scales poorly, hardly at all in fact.
Only advantage is that it's cheaper to host for a given traffic volume, because the cheap low quality providers don't host Java as it's more difficult to find people who can properly administer a Java application server than a plain old Apache with mod-php enabled (never mind that you need more to do it properly, but that's why they're low quality hosting providers).


That's a very good argument that I will in the meeting next Friday. Haven't really thought about that and you're right. What they will "save" for re-developing our application in PHP would be used to buy a better server.

What you think a good configuration would be ok for handling say, 1million page views daily? Today we're serving 200k page-views in a P4 with 512MB ram together with MySql in the same box...

But I haven't finished my studies on the Velocity yet
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

If you're just using a templating engine to generate a bunch of static pages that will then be served, the performance and scability of the "web app" engine used to generate the static pages isn't really an issue. What matters in that case is the performance of the server that will serving up the static pages.

I wouldn't call this a "web app" at all. It's an auto-generated web site.

In choosing your templating engine, performance and scalability aren't an issue because you'll only be using it to pre-generate the static pages. I'd choose that engine based upon how easy it is to set up and maintain the tmplates, and how easy it is to trigger the generation of the site.
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hmmmm... By scalability... Did you mean the ability of your system to serve multiple users(or am I on a different dimension here)? Anyway, my company have an almost similar(I think) problem. This time I have an app built with Struts and other several open-source programs. At first, we agreed on using SQLServer as our backend and Windows(of course) as our development platform. The problem was that my company couldn't provide the expenses for our target host this time and the app is at about 92% complete. We tried to get a shared hosting but they won't allow Java to be installed along with other servers running IIS or Apache web server. Several factors contributed to the problem like:

- Java eats too much memory (they say)
- I used so many third-party plug-ins(e.g. Struts, JCaptcha, jTDS, etc.)
- Windows hosting costs too much

So now... I was asked to migrate all our data to MySQL. Fortunately, I don't have to re-write the source on another language(PHP probably). What we did is get a Virtual Private Server(Virtual Dedicated Server) which scaled down the price from about $300.00(Full dedicated server in Windows) to about $50.00(Virtual dedicated server in Linux).

Hmmmm... I'm still a little anxious when we get to deployment time...


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help me save my Java Webapp from the PHP Hordes!