• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Defaul ServletContext ...??? Question

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
What's exactly a default servlet context? How do I configure it?
This is a question from jdiscuss about this.

-----------
Assuming that the servlet container is distributed across multiple JVMs, which of the following statements are correct? (Select 2 correct options.)

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

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

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

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

5 - None of the above.

Option 1 and 3 are actually the specification of the behaviour of ServletContexts.
Default servlet context is provided to servlets that are not deployed as a part of some webapplication. They are considered to be a part of "default" webapplication.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
There is one default web application in the servlet container. In Tomcat, the directory named ROOT refers to the default web application. The servlet context of this web application is called the default servlet context.
 
Ranch Hand
Posts: 817
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Osama Hasan:
Hi!
There is one default web application in the servlet container. In Tomcat, the directory named ROOT refers to the default web application. The servlet context of this web application is called the default servlet context.



so what is the final answer from list of choices and why ?
 
Osama Hasan
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The correct answers as mentioned in the first post are 1 and 3. The Java Servlet specification guarantees that in a distributed environment each web application has one Servlet Context on each JVM except the default web-application whose Servlet Context exists on only one JVM.
Hope it helps.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlet Context is one per application with in one JVM , but in distributed application Servlet Context is per JVM. That means if one Application is distributed among two JVM then there will be 2 Servlet Context in total, one per JVM
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sumeet, we're talking here not about "the" servlet context, but specifically about the "default" servlet context.
 
You can't expect to wield supreme executive power just because
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic