Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Servlet communication between web-apps

using the ServletContext to enable communication between Servlets within the same Application is quite nice and I wonder if there's a comparable way to enable communication between servlets from different apps (which are deployed on the same Servlet-Container?

The background is that I've two applications which could be distributed to multiple servers. In that case they're supposed to communicate via SOAP - but in case they're both hosted in the same server (and Servlet-Container) I'd like to avoid the SOAP overhead and have direct communication.

Any suggestions?

Cheers

like image 954
pagid Avatar asked Aug 22 '26 04:08

pagid


1 Answers

Such API existed in the first version of Servlet API. You could find other servlets from servlet context and call them. I doubt you could call servlets from other web applications.

Anyway this API was deprecated and is not supported more. The reason is that EJBs were introduced. Servlets play role of a web front-end only. They should not implement business logic and therefore should not communicate with each other.

The modern way to perform communication among different application is either using web services or EJB or if you are using Spring - their remote mechanisms or messaging.

like image 110
AlexR Avatar answered Aug 23 '26 18:08

AlexR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!