This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

execute the wget command or get output of url

 
laura mccord
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I see. Thanks for the advice.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic