简体   繁体   中英

send commands to a webapp running on tomcat

I'm new with java and tomcat, so, excuse me if it's silly.

I would like to send commands (from the console) to a servlet that is already running on tomcat. The webapp will run the command in the tomcat context and return the appropiate answer.

ie:

$ consoleApp status
running

Is it possible?, if yes, how?

thanks in advance.

You can make HTTP GET (or POST) requests to your servlet from the command line using tools like curl or wget and then process the servlet's response. Advantage: If properly set up, you can run those commands also from a remote location.

是的,您可以使用curlwget等几种命令行工具来调用servlet并获取响应。

and if you want to more than simple, you can make a simple program that communicate with servlet by HTTP Post or GET request. The key is :

How to communicate with servlet, we can use several http method and any other protocol.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM