• 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

doubt about constraints of WEB-INF folder

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I came across a question from javabeat

15) Which of the following statements are true?

a. A Servlet Container can host multiple Web Applications.
b. A single Web Application may contain multiple contexts.
c. A single Web Application can contain only one context.
d. Any resources with the 'WEB-INF' directory can be directly accessed by the clients.

i think the answer is a but the answer given is a and d.

please clarify..
[ June 17, 2008: Message edited by: Prince Jain ]
 
Ranch Hand
Posts: 47
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Prince,


Can you send the URL of question where did you see this question?

Also Just a thought, Pls. consider why option c should not be correct?

Thanks

Muks
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think d is correct one, as I know client can't access any resource under WEB-INF folder
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone, without having to have any knowledge of servlets/jsp, but with some boolean logic sense, can tell that either b or c is true, the other being false

And yes, c is true. And d is false.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My answers

My ans a b c

a is definelty correct .

b is correct becuase if the application is used in distributed environment then the application will have multiple context

c is correct if the application is running in single JVM.

d is abslutely incorrect. If you try accesing it trhough client directly
you will get 404 error.
 
P. Jain
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If such a question comes in exam should we take distributed application into consideration???
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think in other not to confuse ourself about the answer to questions, i think we always have moderators that have the final say to questions, because, i this case now, whose answer do we follow?

Juwonlo ibigbami
SCJP 5.0
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ravi Singh:
...

b is correct becuase if the application is used in distributed environment then the application will have multiple context

...



Aren't you confused with sessions?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Prince Jain",
Please check your private messages regarding an important administrative matter.
-Ben
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ravi Singh:
...

b is correct becuase if the application is used in distributed environment then the application will have multiple context

c is correct if the application is running in single JVM.
..



Originally posted by Jan Sterk:


Aren't you confused with sessions?



Ah well, meantime I found something about it in HF (p.255).

You probably mean that there's one context object per JVM. But they're completly identical, copies of each other, all the time. From the programmer's point of view, there's only one context object. If a servlet in JVM A adds or changes an attribute in the context, then a servlet in JVM B can use that attribute and gets the same new value.

Charles Lyons also states in his book 'Study Companion': one application, one context.

Clearly that's what the question refers to, otherwise it would have used the word 'object'.

Please correct me if I'm wrong about it. These kind of things are hard to check empirical.

Btw, it was me who was confused with sessions There's one session object only, migrating from one JVM to the other..

[ June 18, 2008: Message edited by: Jan Sterk ]

[ June 18, 2008: Message edited by: Jan Sterk ]
[ June 18, 2008: Message edited by: Jan Sterk ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic