Hi, I have a question related to what do you guys think about the value returned by HttpServletRequest getServletPath() and getPathInfo() in case of an Http Service registered servlet with an alias of "/". The problem appeared in Pax Web and was described like this: "When a request of "/api/foo/bar" is made which matches to a servlet registered at "/api" the servlet path is correctly set as "/api" and the path info set to "/foo/bar". However if the same servlet is registered in exactly the same manner to "/" and a request is made to "/foo/bar" the servlet path is set to "/foo/bar" and the path info is null. The servlet is somehow being treated as though it was mounted against the exact uri that is being requested no matter what that uri is."
Now, as Http Service specs down not mention anything about a relation between the alias and servlet path and path info, I consider that http service implementations should follow the servlet specs in this matter. The servlet specs are as follow (this is from servlet specs 2.4): SRV.11.2 Specification of Mappings In theWeb application deployment descriptor, the following syntax is used to define mappings: • A string beginning with a '/' character and ending with a '/*' suffix is used for path mapping. • A string beginning with a '*.' prefix is used as an extension mapping. • A string containing only the '/' character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null. • All other strings are used for exact matches only. So, in the described bug above Pax Web acts accordingly to the servlet specs. So, what do you guys think: should a registration of "/" alias behave as a servlet mapping of: 1) "/" - in this case for a request of "/foo/bar" the servlet path will be "/foo/bar" and path info null 2) "/*" - in this case for a request of "/foo/bar" the servlet path will be "" and path info "/foo/bar" Some related resource (examples) can be found here: http://jetty.mortbay.org/jetty5/faq/faq_s_500-Servlets_t_Path%20Mapping.html Thanx, -- Alin Dreghiciu http://www.ops4j.org - New Energy for OSS Communities - Open Participation Software. http://www.qi4j.org - New Energy for Java - Domain Driven Development. http://malaysia.jayway.net - New Energy for Projects - Great People working on Great Projects at Great Places _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
