• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Default servlet context

 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic