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

Heads First - Web App Deployment - Question 14 (Page 615)

 
David Bates
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find the question on Page 610/615 rather bizarre:

Question: Which statements concerning the contaiiner class loader are true?

(a) CORRECT - Web applications should NOT attempt to override container implementation classes.

(b) INCORRECT - A web application must not attempt to load resources from within a WAR file using the J2SE semantics of getResource().

(c) INCORRECT - A web application may override any J2EE classes in the javax.* namespace.

(d) INCORRECT - A web developer may override J2EE platform classes provided they are containeed in a library JAR within a WAR.


My thoughts:

In option (b) why would you be looking in a WAR? I would understand if it was talking about the JAR files in "lib". The Spec says:

"The class loader that a container uses to load a servlet in a WAR must allow the developer to load any resources contained in library JARs within the WAR following normal J2SE semantics using getResource.".

I know a WAR is basically a JAR, but how would a WAR file be accessible to a web-app? Am I just getting hung-up on the way Tomcat deals with WAR files by exploding their contents?
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bates,

When answering this questions I also got the same doubt.

I think we both misread the question.

After re-read the question I could realize that the sentence ... from within a WAR file ... would have in mind that your application is within a WAR file and not that ONLY your resources are within a WAR file and your application is outside the WAR file as we could think.

I think ... from within a WAR file sentence means that your application is inside a WAR file trying to access some resource also inside the WAR file which is correct.

Maybe some smart guy who natively speaks english can give us a milestone on this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic