Class StrictTransportSecurityServerHttpHeadersWriter

  • All Implemented Interfaces:
    ServerHttpHeadersWriter

    public final class StrictTransportSecurityServerHttpHeadersWriter
    extends java.lang.Object
    implements ServerHttpHeadersWriter
    Writes the Strict-Transport-Security if the request is secure.
    Since:
    5.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setIncludeSubDomains​(boolean includeSubDomains)
      Sets if subdomains should be included.
      void setMaxAge​(java.time.Duration maxAge)
      Sets the max age of the header.
      void setPreload​(boolean preload)
      Sets if preload should be included.
      reactor.core.publisher.Mono<java.lang.Void> writeHttpHeaders​(org.springframework.web.server.ServerWebExchange exchange)
      Write the headers to the response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STRICT_TRANSPORT_SECURITY

        public static final java.lang.String STRICT_TRANSPORT_SECURITY
        See Also:
        Constant Field Values
    • Constructor Detail

      • StrictTransportSecurityServerHttpHeadersWriter

        public StrictTransportSecurityServerHttpHeadersWriter()
    • Method Detail

      • writeHttpHeaders

        public reactor.core.publisher.Mono<java.lang.Void> writeHttpHeaders​(org.springframework.web.server.ServerWebExchange exchange)
        Description copied from interface: ServerHttpHeadersWriter
        Write the headers to the response.
        Specified by:
        writeHttpHeaders in interface ServerHttpHeadersWriter
        Returns:
        A Mono which is returned to the Supplier of the ReactiveHttpOutputMessage.beforeCommit(Supplier).
      • setIncludeSubDomains

        public void setIncludeSubDomains​(boolean includeSubDomains)
        Sets if subdomains should be included. Default is true
        Parameters:
        includeSubDomains - if subdomains should be included
      • setPreload

        public void setPreload​(boolean preload)

        Sets if preload should be included. Default is false

        See Website hstspreload.org for additional details.

        Parameters:
        preload - if preload should be included
        Since:
        5.2.0
      • setMaxAge

        public void setMaxAge​(java.time.Duration maxAge)
        Sets the max age of the header. Default is a year.
        Parameters:
        maxAge - the max age of the header