![]() |
JBridge: Certification Question Of The Day |
| JBridge Home >> Certification Questions >> Question for Friday 9th May 2003 | Friday 9th May 2003 |
|
Given a web application called “Certification” hosted on a Windows
platform, which path retrieval methods in the servlet API are likely to
return the following
String? A HttpServletRequest.getPathInfo()
B HttpServletRequest.getPathTranslated()
C HttpServletRequest.getRealPath()
D HttpServletRequest.getRealPath(“”);
E ServletContext.getRealPath(“”);
F HttpServletRequest.getServletPath()
G HttpServletRequest.getContextPath();
Page down for the answer... The AnswerThe correct answers are D and E. Though
HttpServletRequest.getRealPath(String path) is deprecated, it will give
the result required. By feeding this method a blank String, the full
machine path up to and including the web application name is returned. The
non-deprecated method ServletContext.getRealPath() does the same
job. |
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.