Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default servlet context

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is callws default servlet context?


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.


Source: Jdiscuss

Thanks,
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandra


I think that

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

I am not really shore what means "A separate instance of all servlet context" ?

Regards,
M
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not really shore what means "A separate instance of all servlet context" ?


It means all including the default app, so its not true.

Even this is right
The default servlet context will be present only on one of the JVMs.
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it mean that there can be a custom ServletContext in a web application?
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chandra about your question,

There is always a default web application, its context is the
default ServletContext.

Generally its the app that is served when you dont specify the context path
(I am not sure if the spec guarantees it).

for tomcat the application under webapps/ROOT is the default webapp.
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mihai Radulescu:

I am not really shore what means "A separate instance of all servlet context" ?



There is a ServletContext per web application. Thats why it would have been "A separate instance of all servlet context".

As Amol said, there would be a default web application which serves the homepage when you just start the server and dont specify ant specific context root.

Say, for example, in case of Tomcat it would be "http://localhost:8080" (assume port number is not modified) it will serve the default web application present in the "TOMCAT_INSTALL_DIR/webapps/ROOT".

Does it help?
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mihai, Amol & Raghavan,

The correct answers to that question were:


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

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


I am also not sure but think like "default servlet context is given by the
container that is root of the web app and because servlet context is not
shared across JVM like session (we have sessionDidActivate and sessionWillPassivate methods from the HttpSessionListener)".


Amol and Raghavan, I got your points.

Thanks,
[ August 10, 2007: Message edited by: Chandra Bhatt ]
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chandra Bhatt:
I am also not sure but think like "default servlet context is given by the container that is root of the web app and because servlet context is not shared across JVM like session (we have sessionDidActivate and sessionWillPassivate methods from the HttpSessionListener)".


Chandra, Your guess sounds reasonable!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic