Enum HttpCompliance

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<HttpCompliance>

    public enum HttpCompliance
    extends java.lang.Enum<HttpCompliance>
    HTTP compliance modes for Jetty HTTP parsing and handling. A Compliance mode consists of a set of HttpComplianceSections which are applied when the mode is enabled.

    Currently the set of modes is an enum and cannot be dynamically extended, but future major releases may convert this to a class. To modify modes there are four custom modes that can be modified by setting the property org.eclipse.jetty.http.HttpCompliance.CUSTOMn (where 'n' is '0', '1', '2' or '3'), to a comma separated list of sections. The list should start with one of the following strings:

    0
    No HttpComplianceSections
    *
    All HttpComplianceSections
    RFC2616
    The set of HttpComplianceSections application to https://tools.ietf.org/html/rfc2616, but not https://tools.ietf.org/html/rfc7230
    RFC7230
    The set of HttpComplianceSections application to https://tools.ietf.org/html/rfc7230
    The remainder of the list can contain then names of HttpComplianceSections to include them in the mode, or prefixed with a '-' to exclude thm from the mode. Note that Jetty's modes may have some historic minor differences from the strict RFC compliance, for example the RFC2616_LEGACY HttpCompliance is defined as RFC2616,-FIELD_COLON,-METHOD_CASE_SENSITIVE.

    Note also that the EnumSet return by sections() is mutable, so that modes may be altered in code and will affect all usages of the mode.

    • Field Detail

    • Method Detail

      • values

        public static HttpCompliance[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (HttpCompliance c : HttpCompliance.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static HttpCompliance valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • requiredCompliance

        public static HttpCompliance requiredCompliance​(HttpComplianceSection section)
        Parameters:
        section - The section to query
        Returns:
        The minimum compliance required to enable the section.
      • sections

        public java.util.EnumSet<HttpComplianceSection> sections()
        Get the set of HttpComplianceSections supported by this compliance mode. This set is mutable, so it can be modified. Any modification will affect all usages of the mode within the same ClassLoader.
        Returns:
        The set of HttpComplianceSections supported by this compliance mode.
      • checkUriCompliance

        public static java.lang.String checkUriCompliance​(HttpCompliance compliance,
                                                          HttpURI uri)