File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet context

 
geeta lalchandani
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that the servlet container is distributed across multiple JVMs, which of the following statements are correct?



Options

Select 2 correct options.

A separate instance of a non-default servlet context will be available on each of the JVMs.


A separate instance of all servlet context will be avaible on each of the JVMs



The default servlet context will be present only on one of the JVMs.


There is only one instance of servlet contexts across all the JVMs.


None of the above.

As per me.. the first two that are bold are correct. Bt the answer is 1 and 3. Please explain
 
geeta lalchandani
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the comment .... from someone ...

There is one instance of the ServletContext interface associated with each web application
deployed into a container. In cases where the container is distributed over many virtual machines,
there is one instance per web application per VM.
Servlets that exist in a container that were not deployed as part of a web application are implicitly
part of a �default� web application and are contained by a default ServletContext. In a
distributed container, the default ServletContext is non-distributable and must only exist on
one VM.


How is this possible??
 
ankur rathi
Ranch Hand
Posts: 3830
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you (or anyone) explain me, what is default servlet context?

... then I will be able to answer your question.

Thanks.
 
geeta lalchandani
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wish i knew it...
thats the first time i read it..
was browsing through some dummy questions.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my suggestion.
1. Go to the authoritative servlet API site and download the servlet API documents.
2. Search the API for default servlet context (and variations)
3. Report back to the class what you find.

Bill
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There would be one context per JVM. But session is something that only one per user per application( not JVM).Imagin a cluster having a load balancer to redirect the client requests.For example the first the file load balancer redirects the request to Node 1 and for the second request from the user the load balancer directs the request to Node 2.But still the session is with Node 1..so node 1 passivated the session and sends that to node 2 , where again this gets activated.
I know this is nothing much to do with your exact question.
Hope this helps.
 
geeta lalchandani
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks william.
Yes there exists something that is the default servlet context.As per the specs..

Servlets in a container that were not deployed as part of aWeb application are
implicitly part of a �default� Web application and have a default ServletContext.
In a distributed container, the default ServletContext is non-distributable and
must only exist in one JVM.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had never run across that before, now it has me wondering how you have a servlet that is "not deployed as part of a Web application."

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic