RequestUtil (Apache Tomcat 9.0.121 API Documentation)
Description: declaration: package: org.apache.catalina.util, class: RequestUtil

# Class RequestUtil

java.lang.Object
org.apache.catalina.util.RequestUtil

public final class RequestUtil extends Object
General purpose request parsing and encoding utility methods.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RequestUtil()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static StringBuffer`
  `getRequestURL(HttpServletRequest request)`
  Build an appropriate return value for `HttpServletRequest.getRequestURL()` based on the provided request object.
  `static boolean`
  `isSameWebApplication(HttpServletRequest request, URL url)`
  Tests whether the provided URL is for a resource contained within the same web application as the request.
  `static String`
  `stripPathParams(String input, Request request)`
  Strip parameters for given path.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RequestUtil

    public RequestUtil()
    Default constructor.

- ## Method Details

  - ### getRequestURL

    public static StringBuffer getRequestURL(HttpServletRequest request)
    Build an appropriate return value for `HttpServletRequest.getRequestURL()` based on the provided request object. Note that this will also work for instances of `HttpServletRequestWrapper`.
    Parameters:
      `request` - The request object for which the URL should be built
    Returns:
      The request URL for the given request object

  - ### stripPathParams

    public static String stripPathParams(String input, Request request)
    Strip parameters for given path.
    Parameters:
      `input` - the input path
      `request` - the request to add the parameters to
    Returns:
      the cleaned path

  - ### isSameWebApplication

    public static boolean isSameWebApplication(HttpServletRequest request, URL url)
    Tests whether the provided URL is for a resource contained within the same web application as the request.
    Parameters:
      `request` - The request to test
      `url` - The URL to test
    Returns:
      `true` if the provided URL is for a resource contained within the same web application as the request, otherwise `false`