Class HttpUnitUtils

java.lang.Object
com.meterware.httpunit.HttpUnitUtils

public class HttpUnitUtils extends Object
Utility code shared by httpunit and servletunit.
  • Field Details

  • Constructor Details

    • HttpUnitUtils

      public HttpUnitUtils()
  • Method Details

    • handleException

      public static void handleException(Throwable th)
      handle Exceptions and thowables
      Parameters:
      th -
    • isEclipse

      public static boolean isEclipse()
      are we running in the Eclipse IDE?
      Returns:
      whether we are running in the Eclipse environment
    • parseContentTypeHeader

      public static String[] parseContentTypeHeader(String header)
      Returns the content type and encoding as a pair of strings. If no character set is specified, the second entry will be null.
      Parameters:
      header - the header to parse
      Returns:
      a string array with the content type and the content charset
    • stripQuotes

      public static String stripQuotes(String value)
      strip the quotes from a value
      Parameters:
      value -
      Returns:
      the stripped value
    • decode

      public static String decode(String byteString)
      Returns an interpretation of the specified URL-encoded string, using the iso-8859-1 character set.
      Since:
      1.6
    • decode

      public static String decode(String string, String charset)
      Decodes a URL safe string into its original form using the specified character set. Escaped characters are converted back to their original representation. This method is copied from the Jakarta Commons Codec; org.apache.commons.codec.net.URLCodec class.
      Parameters:
      string - URL safe string to convert into its original form
      Returns:
      original string
      Throws:
      IllegalArgumentException - thrown if URL decoding is unsuccessful,
    • parseISToString

      public static String parseISToString(InputStream is)
      parse an InputStream to a string (for debugging)
      Parameters:
      is -
      Returns:
      the string gotten from the inputString
    • parse

      public static Document parse(InputSource inputSource) throws SAXException, IOException
      parse the given inputSource with a new Parser
      Parameters:
      inputSource -
      Returns:
      the document parsed from the input Source
      Throws:
      SAXException
      IOException
    • parse

      public static Document parse(InputStream inputStream) throws SAXException, IOException
      parse the given inputStream with a new Parser
      Parameters:
      inputStream -
      Returns:
      the document parsed from the input Stream
      Throws:
      SAXException
      IOException
    • newParser

      public static DocumentBuilder newParser() throws SAXException
      creates a parser using JAXP API.
      Throws:
      SAXException
    • isEXCEPTION_DEBUG

      protected static boolean isEXCEPTION_DEBUG()
      Returns:
      the eXCEPTION_DEBUG
    • setEXCEPTION_DEBUG

      public static boolean setEXCEPTION_DEBUG(boolean exception_debug)
      Parameters:
      exception_debug - the eXCEPTION_DEBUG to set