Dear All: Sorry for bothering. We use HttpServletRequest.getServletPath() in OpenMRS, and I have noticed a difference in behavior between HTTP Service (both Felix and Equinox) and Jetty, and was wondering if there was some explanation for this.
My apologies if I am missing something simple. Here are two versions: 1) Jetty version: http://old.nabble.com/file/p30137615/my-webapp.zip my-webapp.zip Request: http://localhost:9999/my-webapp/index.htm Result of getServletPath: [/index.htm] 2) Felix version (exact same servlet): http://old.nabble.com/file/p30137615/test.zip test.zip Request: http://localhost:8080/hello/index.htm Result of getServletPath: [/hello] Here is the servlet: http://old.nabble.com/file/p30137615/HelloWorld.java HelloWorld.java and the web.xml: http://old.nabble.com/file/p30137615/web.xml web.xml for the Jetty version. Fyi, per Servlet 2.1 API spec: http://download.oracle.com/docs/cd/E17802_01/products/products/servlet/2.1/api/javax.servlet.http.HttpServletRequest.html#getServletPath() "public abstract String getServletPath() Gets the part of this request's URI that refers to the servlet being invoked. Analogous to the CGI variable SCRIPT_NAME." and, e.g., http://www.perlfect.com/articles/cgi_env.shtml "SCRIPT_NAME The virtual path from which the script is executed. This is very useful if your script will output html code that contains calls to itself. Having the script determin its virtual path, (and hence, along with DOCUMENT_ROOT, its full URL) is much more portable than hard coding it in a configuration variable. Also, if you like to keep a log of all script accesses in some file, and want to have each script report its name along with the calling parameters or time, it is very portable to use SCRIPT_NAME to print the path of the script." The Jetty behavior seems correct even for Servlet API 2.1. However, clearly both Felix and Equinox chose to implement this differently from the Jetty HTTP Server. Am I missing something? More importantly, where would I get the relevant string (i.e. /index.htm) from the Felix and/or Equinox implementations of HttpServletRequest? Thank you Yours Misha p.s. The relevant OpenMRS controller: http://source.openmrs.org/browse/~raw,r=16192/OpenMRS/trunk/web/src/main/java/org/openmrs/web/controller/patient/ShortPatientFormValidator.java -- View this message in context: http://old.nabble.com/HttpServletRequest.getServletPath%28%29-behavior-on-HTTP-Service-does-not-match-Jetty--tp30137615p30137615.html Sent from the Apache Felix - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

