Interface MutableHttpHeaders

  • All Superinterfaces:
    io.micronaut.core.convert.value.ConvertibleMultiValues<java.lang.String>, io.micronaut.core.convert.value.ConvertibleValues<java.util.List<java.lang.String>>, io.micronaut.core.type.Headers, HttpHeaders, java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.util.List<java.lang.String>>>, io.micronaut.core.type.MutableHeaders, io.micronaut.core.value.ValueResolver<java.lang.CharSequence>
    All Known Implementing Classes:
    CaseInsensitiveMutableHttpHeaders, SimpleHttpHeaders

    public interface MutableHttpHeaders
    extends io.micronaut.core.type.MutableHeaders, HttpHeaders
    Extends HttpHeaders add methods for mutation of headers.
    Since:
    1.0
    • Field Detail

      • GMT

        static final java.time.ZoneId GMT
        The default GMT zone for date values.
    • Method Detail

      • add

        MutableHttpHeaders add​(java.lang.CharSequence header,
                               java.lang.CharSequence value)
        Add a header for the given name and value.
        Specified by:
        add in interface io.micronaut.core.type.MutableHeaders
        Parameters:
        header - The header name
        value - The value
        Returns:
        This headers object
      • remove

        MutableHttpHeaders remove​(java.lang.CharSequence header)
        Specified by:
        remove in interface io.micronaut.core.type.MutableHeaders
      • set

        default io.micronaut.core.type.MutableHeaders set​(java.lang.CharSequence header,
                                                          java.lang.CharSequence value)
        Specified by:
        set in interface io.micronaut.core.type.MutableHeaders
      • allow

        default MutableHttpHeaders allow​(HttpMethod... methods)
        Set the allowed HTTP methods.
        Parameters:
        methods - The methods to specify in the Allowed HTTP header
        Returns:
        This HTTP headers
      • date

        default MutableHttpHeaders date​(java.time.LocalDateTime date)
        Adds the date header for the given LocalDateTime.
        Parameters:
        date - The local date time (assumed to represent system's default time-zone ZoneId.systemDefault(), will be converted to GMT) as per DateTimeFormatter.RFC_1123_DATE_TIME
        Returns:
        The MutableHttpHeaders
        See Also:
        to set date time with time-zone.
      • expires

        default MutableHttpHeaders expires​(java.time.LocalDateTime date)
        Adds the EXPIRES header for the given LocalDateTime.
        Parameters:
        date - The local date time (assumed to represent system's default time-zone ZoneId.systemDefault(), will be converted to GMT) as per DateTimeFormatter.RFC_1123_DATE_TIME
        Returns:
        The MutableHttpHeaders
        See Also:
        to set date time with time-zone.
      • lastModified

        default MutableHttpHeaders lastModified​(java.time.LocalDateTime date)
        Adds the LAST_MODIFIED header for the given LocalDateTime.
        Parameters:
        date - The local date time (assumed to represent system's default time-zone ZoneId.systemDefault(), will be converted to GMT) as per DateTimeFormatter.RFC_1123_DATE_TIME
        Returns:
        The MutableHttpHeaders
        See Also:
        to set date time with time-zone.
      • ifModifiedSince

        default MutableHttpHeaders ifModifiedSince​(java.time.LocalDateTime date)
        Adds the IF_MODIFIED_SINCE header for the given ZonedDateTime.
        Parameters:
        date - The local date time (assumed to represent system's default time-zone ZoneId.systemDefault(), will be converted to GMT) as per DateTimeFormatter.RFC_1123_DATE_TIME
        Returns:
        The MutableHttpHeaders
        See Also:
        to set date time with time-zone.
      • date

        default MutableHttpHeaders date​(long timeInMillis)
        Adds the DATE header for the given Long.
        Parameters:
        timeInMillis - The time in milli seconds since Epoch.
        Returns:
        The MutableHttpHeaders
      • expires

        default MutableHttpHeaders expires​(long timeInMillis)
        Adds the EXPIRES header for the given Long.
        Parameters:
        timeInMillis - The time in milli seconds since Epoch.
        Returns:
        The MutableHttpHeaders
      • lastModified

        default MutableHttpHeaders lastModified​(long timeInMillis)
        Adds the LAST_MODIFIED header for the given Long.
        Parameters:
        timeInMillis - The time in milli seconds since Epoch.
        Returns:
        The MutableHttpHeaders
      • ifModifiedSince

        default MutableHttpHeaders ifModifiedSince​(long timeInMillis)
        Adds the IF_MODIFIED_SINCE header for the given Long.
        Parameters:
        timeInMillis - The time in milli seconds since Epoch.
        Returns:
        The MutableHttpHeaders
      • auth

        default MutableHttpHeaders auth​(java.lang.String username,
                                        java.lang.String password)
        Used to configure BASIC authentication.
        Parameters:
        username - The username
        password - The password
        Returns:
        This HTTP headers
      • auth

        default MutableHttpHeaders auth​(java.lang.String userInfo)
        Used to configure BASIC authentication.
        Parameters:
        userInfo - The user info which is in the form "username:password"
        Returns:
        This HTTP headers
      • allow

        default MutableHttpHeaders allow​(java.util.Collection<HttpMethod> methods)
        Set the allowed HTTP methods.
        Parameters:
        methods - The methods to specify in the Allowed HTTP header
        Returns:
        This HTTP headers
      • allowGeneric

        default MutableHttpHeaders allowGeneric​(java.util.Collection<? extends java.lang.CharSequence> methods)
        Set the allowed HTTP methods.
        Parameters:
        methods - The methods to specify in the Allowed HTTP header
        Returns:
        This HTTP headers
      • location

        default MutableHttpHeaders location​(java.net.URI uri)
        Sets the location header to the given URI.
        Parameters:
        uri - The URI
        Returns:
        This HTTP headers
      • add

        default MutableHttpHeaders add​(java.lang.CharSequence header,
                                       java.time.ZonedDateTime value)
        Add a header for the given name and value.
        Parameters:
        header - The header name
        value - The value
        Returns:
        This headers object
      • add

        default MutableHttpHeaders add​(java.lang.CharSequence header,
                                       java.lang.Integer value)
        Add a header for the given name and value.
        Parameters:
        header - The header name
        value - The value
        Returns:
        This headers object