This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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.
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 ?
Thanks and Regards, Amit Taneja
Joined: Sep 30, 2002
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.
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
Joined: Mar 27, 2004
Hi Sumeet, we're talking here not about "the" servlet context, but specifically about the "default" servlet context.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com