subzero
subzero

Reputation: 3450

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.

i.e:

$ consoleApp status
running

Is it possible?, if yes, how?

thanks in advance.

Upvotes: 1

Views: 341

Answers (3)

Roberto Fernandez
Roberto Fernandez

Reputation: 11

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.

Upvotes: 0

michael667
michael667

Reputation: 3260

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.

Upvotes: 3

Guido
Guido

Reputation: 47665

Yes, you can use several command line tools such as curl or wget to call your servlet and obtain the response.

Upvotes: 2

Related Questions