Class AdviceWarning


  • public final class AdviceWarning
    extends Object
    WarningHeader implements RFC 2616 section 14.46 - Warning. It implements Advice, which allows it to be used during the routing of CREST requests such that it can be added into the response in an appropriate location.
    Since:
    2.4.0
    See Also:
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DISCONNECTED_OPERATION
      112 Disconnected operation SHOULD be included if the cache is intentionally disconnected from the rest of the network for a period of time.
      static int HEURISTIC_EXPIRATION
      113 Heuristic expiration MUST be included if the cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours.
      static int MISCELLANEOUS_PERSISTENT_WARNING
      299 Miscellaneous persistent warning The warning text MAY include arbitrary information to be presented to a human user, or logged.
      static int MISCELLANEOUS_WARNING
      199 Miscellaneous warning The warning text MAY include arbitrary information to be presented to a human user, or logged.
      static int NOT_PRESENT
      100 Indicates that there is data missing from the request.
      static int RESPONSE_STALE
      110 Response is stale MUST be included whenever the returned response is stale.
      static int REVALIDATION_FAILED
      111 Revalidation failed MUST be included if a cache returns a stale response because an attempt to revalidate the response failed, due to an inability to reach the server.
      static int TRANFORMATION_APPLIED
      214 Transformation applied MUST be added by an intermediate cache or proxy if it applies any transformation changing the content-coding (as specified in the Content-Encoding header) or media-type (as specified in the Content-Type header) of the response, or the entity-body of the response, unless this Warning code already appears in the response.
    • Field Detail

      • NOT_PRESENT

        public static final int NOT_PRESENT
        100 Indicates that there is data missing from the request. ForgeRock-Specific.
        See Also:
        Constant Field Values
      • RESPONSE_STALE

        public static final int RESPONSE_STALE
        110 Response is stale MUST be included whenever the returned response is stale.
        See Also:
        Constant Field Values
      • REVALIDATION_FAILED

        public static final int REVALIDATION_FAILED
        111 Revalidation failed MUST be included if a cache returns a stale response because an attempt to revalidate the response failed, due to an inability to reach the server.
        See Also:
        Constant Field Values
      • DISCONNECTED_OPERATION

        public static final int DISCONNECTED_OPERATION
        112 Disconnected operation SHOULD be included if the cache is intentionally disconnected from the rest of the network for a period of time.
        See Also:
        Constant Field Values
      • HEURISTIC_EXPIRATION

        public static final int HEURISTIC_EXPIRATION
        113 Heuristic expiration MUST be included if the cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours.
        See Also:
        Constant Field Values
      • MISCELLANEOUS_WARNING

        public static final int MISCELLANEOUS_WARNING
        199 Miscellaneous warning The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action, besides presenting the warning to the user.
        See Also:
        Constant Field Values
      • TRANFORMATION_APPLIED

        public static final int TRANFORMATION_APPLIED
        214 Transformation applied MUST be added by an intermediate cache or proxy if it applies any transformation changing the content-coding (as specified in the Content-Encoding header) or media-type (as specified in the Content-Type header) of the response, or the entity-body of the response, unless this Warning code already appears in the response.
        See Also:
        Constant Field Values
      • MISCELLANEOUS_PERSISTENT_WARNING

        public static final int MISCELLANEOUS_PERSISTENT_WARNING
        299 Miscellaneous persistent warning The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action.
        See Also:
        Constant Field Values
    • Method Detail

      • getNotPresent

        public static AdviceWarning getNotPresent​(String agentName,
                                                  String missingKey)
        Convenience method to quickly generate frequently-used error type: 100.
        Parameters:
        agentName - Name of the component responsible for issuing the warning.
        missingKey - Name of the missing key which must be included.
        Returns:
        a newly constructed AdviceWarning indicating the expected key was not found in the request.
      • newAdviceWarning

        public static AdviceWarning newAdviceWarning​(String agentName,
                                                     String fmt,
                                                     Object... args)
        Generate a warning using the builder provided.
        Parameters:
        agentName - the agent name
        fmt - The format, which may include embedded %s, etc.
        args - Zero or more args, passed into String.format to generate the warning text
        Returns:
        a newly built WarningHeader object