jQuery in Action, 2nd edition*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question Bank ID : 36 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question Bank ID : 36" Watch "Question Bank ID : 36" New topic
Author

Question Bank ID : 36

Jacky Chow
Ranch Hand

Joined: Sep 01, 2002
Posts: 63
Hi all,
The following question is mock exam in this site, i got wrong answers although i understanding the concept. can anyone tell me does same question appear real exam ?
Qution: Which of the following statements are TRUE? (Choose Two)
1. Files in the WEB-INF directory can not be served to the client.
2. Files in the WEB-INF directory can be served to the client.
3. The servlet class files must reside as a sub-directory of WEB-INF named classes.
4. The web.xml deployment descriptor can reside outside the WEB-INF directory as long as it has been properly mapped.
The provided answer is 1 & 3.
I choose answer 2 & 4, because i think "can be served to.." means "can directly or indirectly", is that right ?(may be my english is poor),
i choose 4 because i think the class can be put in a jar file when i do the mock exam.
i don't want to face the same type of question in real exam !


Jacky
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Hi Jacky,
According to the servlet 2.3 specs:

A special directory exists within the application hierarchy named “WEB-INF”. This directory contains all things related to the application that aren’t in the document root of the application. The WEB-INF node is not part of the public document tree of the application. No file contained in the WEB-INF directory may be served directly to a client by the container. However, the contents of the WEB-INF directory are visible to servlet code using the getResource and getResourceAsStream method calls on the ServletContext. Hence, if the Application Developer needs access, from servlet code, to application specific configuration information that he does not wish to be exposed to the web client, he may place it under this directory. Since requests are matched to resource mappings case-sensitively, client requests for ‘/WEB-INF/foo’, ‘/WEb-iNf/foo’, for example, should not result in contents of the web application located under /WEB-INF being returned, nor any form of directory listing thereof.
The contents of the WEB-INF directory are:
• The /WEB-INF/web.xml deployment descriptor.
• The /WEB-INF/classes/ directory for servlet and utility classes. The classes in this directory must be available to the application class loader.
• The /WEB-INF/lib/*.jar area for Java ARchive files. These files contain servlets, beans, and other utility classes useful to the web application. The web application class loader must be able to load classes from any of these archive files.
Jacky Chow
Ranch Hand

Joined: Sep 01, 2002
Posts: 63
hi Anthony,
Thanks for you repily, I know that resource in /WEB-INF/ can't access by client directly, but i have a doubt here, because the resource in /WEB-INF/ can access by client indirectly through other jsp/servlet ! is that answer 2 only means directly serves ?
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Originally posted by Jacky Chow:
I know that resource in /WEB-INF/ can't access by client directly, but i have a doubt here, because the resource in /WEB-INF/ can access by client indirectly through other jsp/servlet ! is that answer 2 only means directly serves ?

IHMO yes
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Thank you for your points. The answers where modified to conatin the word "directly" and the answer for the servlet class files was reworded to say "can be located in..."
If you find any others please bring them to my attention.
Kyle Tang
Ranch Hand

Joined: Aug 22, 2002
Posts: 78
hi,
I think in the question, the phrase:
"served to clients" means, you can type that url in your web-browser:
http://host/app/WEB-INF/**.whatever
this is what "served to clients" means. It means directly accessible.
I know it is confusing somehow. but I saw a couple of mock questions and the real one actually also use this phrase to mean directly accessble.


Kyle Tang<br />SCJP 91<br />SCWCD 96<br />SCBCD 95
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question Bank ID : 36
 
Similar Threads
Exmulator mock exam question 36
Question Bank ID : 36 JavaRanch
JavaRanch Mock Exam Question
Doubt in HSFJ Final Mock Exam
Weblogic 7.0 certification mock test question