JBridge

JBridge: Certification Question Of The Day

JBridge Home >> Certification Questions >> Question for Saturday 10th May 2003 Saturday 10th May 2003

Suppose the following servlet mapping is set up for a web application called “music”:

<servlet-mapping>
	<servlet-name>PlayPiece</servlet-name>
	<url-pattern>/PlayPiece</url-pattern>
</servlet-mapping>
Which of the following are true statements? (2 correct answers)



A Given a request URL of http://myHost/music/PlayPiece, the context path would be ‘/music’.
B Given a request URL of http://myHost/music/PlayPiece/requiem, the path information would be ‘/requiem’.
C Given a request URL of http://myHost/music/PlayPiece, the servlet path would be ‘/PlayPiece’, and the path information would be null.
D Given a request URL of http://myHost/music/PlayPiece, the real path information would be ‘//myHost/music/PlayPiece'
Page down for the answer...











































The Answer

A and C are the correct answers.
The URL in answer B would result in an HTTP 404 (page/resource not found) error, as the servlet mapping does not cater for any path information following the servlet name (it would have to be set up as /PlayPiece/* to allow path information).
Although it would not be impossible for the real path information in D to be ‘//myHost/music/PlayPiece”, it’s very unlikely. The real path information would give the full path within the file system where the resource ‘PlayPiece’ is located (e.g. ‘C:\Java\jakarta-tomcat-4.1.18\webapps\music\PlayPiece’ given a Windows directory structure).


EMail: dbridgewater@jbridge.co.uk
Phone: +44 (0)1943 877414
Fax: +44 (0)1943 877414
Mail: David Bridgewater, Willow Dene, Bradford Road, Menston, Ilkley, West Yorkshire, LS29 6ED, UK
Copyright © 2003 David Bridgewater. All rights reserved.