Class XServletSettings

  • All Implemented Interfaces:
    com.helger.commons.lang.ICloneable<XServletSettings>, Serializable

    public class XServletSettings
    extends Object
    implements Serializable, com.helger.commons.lang.ICloneable<XServletSettings>
    This class keeps all the settings that can be applied to all XServlet based settings. The settings need to be applied per Servlet instance!
    The following things can be set here:
    • HTTP Referrer Policy - see EHttpReferrerPolicy
    Author:
    Philip Helger
    See Also:
    Serialized Form
    • Field Detail

      • DEFAULT_HTTP_REFERRER_POLICY

        public static final com.helger.http.EHttpReferrerPolicy DEFAULT_HTTP_REFERRER_POLICY
      • DEFAULT_MULTIPART_ENABLED

        public static final boolean DEFAULT_MULTIPART_ENABLED
        See Also:
        Constant Field Values
    • Constructor Detail

      • XServletSettings

        public XServletSettings()
    • Method Detail

      • getHttpReferrerPolicy

        @Nullable
        public final com.helger.http.EHttpReferrerPolicy getHttpReferrerPolicy()
        Returns:
        The current http Referrer Policy or null if none is set.
      • hasHttpReferrerPolicy

        public final boolean hasHttpReferrerPolicy()
        Returns:
        true if a referrer policy is set, false if not.
      • setHttpReferrerPolicy

        @Nonnull
        public final XServletSettings setHttpReferrerPolicy​(@Nullable
                                                            com.helger.http.EHttpReferrerPolicy eHttpReferrerPolicy)
        Set the Http Referrer Policy to be used.
        Parameters:
        eHttpReferrerPolicy - The enumeration value to be used. May be null to indicate: don't set
        Returns:
        this for chaining
      • getXFrameOptionsType

        @Nullable
        public final com.helger.servlet.response.EXFrameOptionType getXFrameOptionsType()
        Returns:
        The currently set X-Frame-Options type. May be null.
        Since:
        9.1.1
      • getXFrameOptionsDomain

        @Nullable
        public final com.helger.commons.url.ISimpleURL getXFrameOptionsDomain()
        Returns:
        The currently set X-Frame-Options domain only used the type is EXFrameOptionType.ALLOW_FROM. May be null.
        Since:
        9.1.1
      • hasXFrameOptions

        public final boolean hasXFrameOptions()
        Returns:
        true if X-Frame-Options are defined, false if not.
        Since:
        9.1.1
      • setXFrameOptions

        @Nonnull
        public final XServletSettings setXFrameOptions​(@Nullable
                                                       com.helger.servlet.response.EXFrameOptionType eType,
                                                       @Nullable
                                                       com.helger.commons.url.ISimpleURL aDomain)
        The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe> or <object> . Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites. Example:
         X-Frame-Options: DENY
         X-Frame-Options: SAMEORIGIN
         X-Frame-Options: ALLOW-FROM https://example.com/
         
        Parameters:
        eType - The X-Frame-Options type to be set. May be null.
        aDomain - The domain URL to be used in "ALLOW-FROM". May be null for the other cases.
        Returns:
        this for chaining
        Since:
        9.1.1
      • isMultipartEnabled

        public final boolean isMultipartEnabled()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object