net.sourceforge.stripes.util
Class HttpUtil

java.lang.Object
  extended by net.sourceforge.stripes.util.HttpUtil

public class HttpUtil
extends Object

Provides helper methods for working with HTTP requests and responses.

Since:
Stripes 1.5.1
Author:
Ben Gunter

Method Summary
static String getRequestedPath(HttpServletRequest request)
           Get the path from the given request.
static String getRequestedServletPath(HttpServletRequest request)
          Get the servlet path of the current request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRequestedPath

public static String getRequestedPath(HttpServletRequest request)

Get the path from the given request. This method is different from HttpServletRequest.getRequestURI() in that it concatenates and returns the servlet path plus the path info from the request. These are usually the same, but in some cases they are not.

One case where they are known to differ is when a request for a directory is forwarded by the servlet container to a welcome file. In that case, HttpServletRequest.getRequestURI() returns the path that was actually requested (e.g., "/"), whereas the servlet path plus path info is the path to the welcome file (e.g. "/index.jsp").


getRequestedServletPath

public static String getRequestedServletPath(HttpServletRequest request)
Get the servlet path of the current request. The value returned by this method may differ from HttpServletRequest.getServletPath(). If the given request is an include, then the servlet path of the included resource is returned.



? Copyright 2005-2006, Stripes Development Team.