I have a command-handling servlet that triggers different commandactions depending on the value of the pathInfo property. I.e. my command-handler servlets has code looking something like:
String pathInfo = request.getPathInfo();
String commandName = getCommandName(pathInfo);
String methodName = getMethodName(commandName);
Method commandMethod = getCommandMethod(methodName);
invokeCommandMethod(commandMethod);
and is invoked using an URI like:
/gunnar/action/ListCategories
where "action" is the url-pattern mapped for this servlet and "gunnar" is the context-path for this app. This is how the browser invokes the servlet. When including and forwarding the Context-path is not passed along. And the problem does not lie in the not passing the context-path along the request. I tried both with and without. When having the Context-path on the URI, getRequestDispatcher throws an IllegalArgumentException just as the API documentation denotes.
the problem occurs when I try to <jsp:include> my servlet from a JSP page. When including the servlet, getPathInfo() on HttpServletRequest returns null. After looking through the Java Servlet Specification 2.3 I found a couple of request attributes that are supposed to exist to let at servlet find out values such as path-info, query-string and so on when having been included by the request target servlet/jsp. But as I read the javax.servlet.include.path_info attribute that the spec talks about I get a null value again.
regards,
Patrik Andersson
