aspose file tools*
The moose likes JSP and the fly likes execute the wget command or get output of url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "execute the wget command or get output of url" Watch "execute the wget command or get output of url" New topic
Author

execute the wget command or get output of url

laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
Hi,

I have a wget command that I want to execute from a jsp page: "wget localhost:8080/myApp -q -O -"

I tried running the command from jsp using this method but it didn't work:


Then I tried using this method I found:



Any suggestions?

I would like to get the contents of a given page. In the big picture, what I want to accomplish is that I have a cluster of https servers under a dns and I want to monitor if a given server is functioning by finding a string from the wget response. So the jsp page will be running from each server and I'll have a fail/pass response from each jsp page that will be used to monitor.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Why use wget? The JSTL <c:import> action will suck in the contents of another URL without all that mess and bother (and without polluting the JSP page with obsolete scriptlet code).


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

Joined: Jan 10, 2002
Posts: 61433
    
  67

P.S. If you don't want to display the result, this shouldn't be in a JSP page at all, but in a servlet. JSPs are for views, not processing.
laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
Okay, I see. Thanks for the advice.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

And if you decide to do this in a Java class (servlet or delegate) there are still easier ways than wget. Look into the classes in java.net, or packages like HttpClient.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: execute the wget command or get output of url