Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inter Servlet Communication

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IS this same as forward and including a page.
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can be much more than that. I guess we can broadly classify the interservlet comm. into two categories. First, between servlets running under the same web context and secondly running under different web contexts as in a truly distributed environment.
Typically when we say servlets communicating with each other, it may imply the exchange of information via objects. Objects can be stored at different scopes like application, session and request using keys to retrieve them across servlets.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do servlets in distributed env communicate or share objects.
Why is the need for servlets in different web context to communicate.
If we do a J2ee project won't all the components be in one server.
Somehow can anyone explain it more clearly.?
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't get to work with servlets contacting each other from different web contexts, but i'm pretty sure such a thing exists. If you ask me under what scenario, the people who work full fledged on these things should come up with the situations. I'm also waiting to hear from someone on this.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't get to work with servlets contacting each other from different web contexts, but i'm pretty sure such a thing exists. If you ask me under what scenario, the people who work full fledged on these things should come up with the situations. I'm also waiting to hear from someone on this.
Trust me, it exists. I work for a large corporation and we have our site spread across many servers.
how do servlets in distributed env communicate or share objects.
There are lots of ways, but the two most important ways are using databases and EJBs. You can use serialized objects and a URLConnection to communicate between servlets or just RMI.
Why is the need for servlets in different web context to communicate.
If we do a J2ee project won't all the components be in one server.

Load balancing, failsafe issues (you don't want the whole site going down if just one server crashes), keeping logical sections of the site separated, mitigating risk when deploying new development, etc.

If we do a J2ee project won't all the components be in one server.

That's fine for a small site but isn't practical for a large enterprise operation. It does complicate matters though, because you could cross JVMs several times with a single request. That can make debugging tuff, but interesting. Also note that for a full J2EE project, you would have EJBs somewhere which lend themselves well to a distributed environment. That fact that they can easily be accessed remotely is one of their main selling points, along with built-in transaction management and container managed persistence.
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Morris:

Why is the need for servlets in different web context to communicate.
If we do a J2ee project won't all the components be in one server.

Load balancing, failsafe issues (you don't want the whole site going down if just one server crashes), keeping logical sections of the site separated, mitigating risk when deploying new development, etc.
[b]

Michael,
Can you please direct me to any resources on the web that talk about replicating sessions in the event of server crash, etc., so that the user would never feel any change, despite for some latency? I would appreciate your inputs.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic