Class Warning


  • public class Warning
    extends Object
    WarningHeader entry. This class is immutable and thread-safe.
    • Constructor Detail

      • Warning

        public Warning​(int code,
                       String agent,
                       String text)
        Creates a new instance without optional date.
        Parameters:
        code - Three digit code
        agent - Name or host[:port] of the server adding the header
        text - Text
      • Warning

        public Warning​(int code,
                       String agent,
                       String text,
                       Date date)
        Creates a new instance with optional date.
        Parameters:
        code - Three digit code
        agent - Name or host[:port] of the server adding the header
        text - Text (unquoted)
        date - Date or null
    • Method Detail

      • getCode

        public int getCode()
        Gets the warning's three digit code.
        Returns:
        Three digit code
      • getAgent

        public String getAgent()
        Gets the warning's agent name.
        Returns:
        Name or host[:port] of the server adding the header
      • getText

        public String getText()
        Gets the warning's text description.
        Returns:
        Text
      • getDate

        public Date getDate()
        Gets the warning's date.
        Returns:
        Date or null if not defined
      • toString

        public String toString()
        Formats a Warning header value, according to RFC 2616 14.46.
        Overrides:
        toString in class Object
        Returns:
        Formatted Warning header
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • valueOf

        public static Warning valueOf​(String value)
        Parses a warning-header value (part after Warning:).
        Parameters:
        value - Warning-header value
        Returns:
        Warning instance of null if could not be parsed