flash
flash

Reputation: 1229

how can a servlet in one jvm communicate with servlet in another jvm

can this be solved simply by specifying the complete url of the servlet in the RequestDispatcher?

Upvotes: 0

Views: 640

Answers (2)

Sebastien Lorber
Sebastien Lorber

Reputation: 92210

Brian is true, use HttpClient to do that.

But anyway it seems to be a poor design to call a servlet from another servlet no? You'd better make at least a service that will handle the request to the other servlet.

Upvotes: 1

Brian Agnew
Brian Agnew

Reputation: 272407

If the two servlets are deployed completely separately, then the simplest means of communication is via HTTP and specifying the URL (after all, that is the API they are presenting).

Using a library such as HttpClient will simplify this process and manage sessions/authentication etc. if/when required.

Upvotes: 3

Related Questions