Class HttpUtil

java.lang.Object
com.jprofiler.api.agent.HttpUtil

public class HttpUtil extends Object
Class with helper methods for http splitting scripts
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getParameter(String parameterName, String queryString)
    Returns the value for the first occurrence of a parameter in a query string.
    getParameters(String queryString)
    Returns a map with the values for all parameters in a query string This method is intended for generic URL splitting scripts, for servlet splitting scripts the servletRequest.getParameterMap(...) method should be used instead.
    static String
    getPathSegments(String requestURI, int fromSegment, int toSegment, boolean replaceNumericIds)
    Returns the specified part of the request URI

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpUtil

      public HttpUtil()
  • Method Details

    • getPathSegments

      public static String getPathSegments(String requestURI, int fromSegment, int toSegment, boolean replaceNumericIds)
      Returns the specified part of the request URI
      Parameters:
      requestURI - the request URI from javax.servlet.http.HttpServletRequest.getRequestURI()
      fromSegment - the first segment to be included, the index is one-based
      toSegment - the last segment to be included, the index is one-based
      replaceNumericIds - if true segments that only contain numbers are replaced with <id>
      Returns:
      the specified part of the request URI
    • getParameter

      public static String getParameter(String parameterName, String queryString)
      Returns the value for the first occurrence of a parameter in a query string. This method is intended for generic URL splitting scripts, for servlet splitting scripts the servletRequest.getParameter(...) method should be used instead.
      Parameters:
      parameterName - the name of the parameter
      queryString - the query string
      Returns:
      the value or null if the parameter was not found
    • getParameters

      public static Map<String,List<String>> getParameters(String queryString)
      Returns a map with the values for all parameters in a query string This method is intended for generic URL splitting scripts, for servlet splitting scripts the servletRequest.getParameterMap(...) method should be used instead.
      Parameters:
      queryString - the query string
      Returns:
      the map from parameter names to lists of parameter values