Working on the tag support for this blog, I ' ve cut a little sample code out of a Java servlet, and I ' m showing it below. I was looking at the HttpServletRequest, and is curious about the difference between request.getPathInfo() , request.getPathTranslated() , and request.getRequestURI() , so I created This demo code. Here's the example code from the servlet:
String pathInfo = Request.getpathinfo (); String Pathtrans = request.getpathtranslated (); String uri = Request.getrequesturi (); System.err.println ("PathInfo: " + pathInfo); System.err.println ("Pathtrans:" + Pathtrans); System.err.println ("uri: " + uri);
And here's the sample output from the Servlets, running under Tomcat on my MacBook Pro:
PathInfo: /java+mac+foopathtrans:/users/al/tomcat-4.1.31/webapps/blog/tag/java+mac+foouri: /blog/tag/ Java+mac+foo
I forgot to mention, the URL I hits to generate this output washttp://localhost:8080/blog/tag/java+mac+foo
Java servlet example-httpservletrequest, GetPathInfo, and Getrequesturi