HttpMessages (Apache Tomcat 8.5.43 API Documentation)

org.apache.tomcat.util.http

## Class HttpMessages

- java.lang.Object
- - org.apache.tomcat.util.http.HttpMessages

-     public class HttpMessages
      extends java.lang.Object

  Handle (internationalized) HTTP messages.
  Author:
    James Duncan Davidson [duncan@eng.sun.com], James Todd [gonzo@eng.sun.com], Jason Hunter [jch@eng.sun.com], Harish Prabandham, costin@eng.sun.com

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static HttpMessages` | `getInstance(java.util.Locale locale)`
    `java.lang.String` | `getMessage(int status)` Get the status string associated with a status code.
    `static boolean` | `isSafeInHttpHeader(java.lang.String msg)` Is the provided message safe to use in an HTTP header.

    - ### Methods inherited from class java.lang.Object

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

- - ### Method Detail

    - #### getMessage

          public java.lang.String getMessage(int status)

      Get the status string associated with a status code. Common messages are cached.
      Parameters:
        `status` - The HTTP status code to retrieve the message for
      Returns:
        The HTTP status string that conforms to the requirements of the HTTP specification

    - #### getInstance

          public static HttpMessages getInstance(java.util.Locale locale)

    - #### isSafeInHttpHeader

          public static boolean isSafeInHttpHeader(java.lang.String msg)

      Is the provided message safe to use in an HTTP header. Safe messages must meet the requirements of RFC2616 - i.e. must consist only of TEXT.
      Parameters:
        `msg` - The message to test
      Returns:
        `true` if the message is safe to use in an HTTP header else `false`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.