Class HttpUtil


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

      Constructors 
      Constructor Description
      HttpUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getParameter​(java.lang.String parameterName, java.lang.String queryString)
      Returns the value for the first occurrence of a parameter in a query string.
      static java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getParameters​(java.lang.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 java.lang.String getPathSegments​(java.lang.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 Detail

      • HttpUtil

        public HttpUtil()
    • Method Detail

      • getPathSegments

        public static java.lang.String getPathSegments​(java.lang.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 java.lang.String getParameter​(java.lang.String parameterName,
                                                    java.lang.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 java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getParameters​(java.lang.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