Package com.helger.xservlet
Class XServletSettings
- java.lang.Object
-
- com.helger.xservlet.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 Summary
Fields Modifier and Type Field Description static com.helger.http.EHttpReferrerPolicyDEFAULT_HTTP_REFERRER_POLICYstatic booleanDEFAULT_MULTIPART_ENABLED
-
Constructor Summary
Constructors Constructor Description XServletSettings()XServletSettings(XServletSettings aOther)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)XServletSettingsgetClone()com.helger.http.EHttpReferrerPolicygetHttpReferrerPolicy()com.helger.commons.url.ISimpleURLgetXFrameOptionsDomain()com.helger.servlet.response.EXFrameOptionTypegetXFrameOptionsType()inthashCode()booleanhasHttpReferrerPolicy()booleanhasXFrameOptions()booleanisMultipartEnabled()XServletSettingssetHttpReferrerPolicy(com.helger.http.EHttpReferrerPolicy eHttpReferrerPolicy)Set the Http Referrer Policy to be used.XServletSettingssetMultipartEnabled(boolean bIsMultipartEnabled)XServletSettingssetXFrameOptions(com.helger.servlet.response.EXFrameOptionType eType, 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> .StringtoString()
-
-
-
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()
-
XServletSettings
public XServletSettings(@Nonnull XServletSettings aOther)
-
-
Method Detail
-
getHttpReferrerPolicy
@Nullable public final com.helger.http.EHttpReferrerPolicy getHttpReferrerPolicy()
- Returns:
- The current http Referrer Policy or
nullif none is set.
-
hasHttpReferrerPolicy
public final boolean hasHttpReferrerPolicy()
- Returns:
trueif a referrer policy is set,falseif 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 benullto 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 benull. - Since:
- 9.1.1
-
hasXFrameOptions
public final boolean hasXFrameOptions()
- Returns:
trueif X-Frame-Options are defined,falseif 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 benull.aDomain- The domain URL to be used in "ALLOW-FROM". May benullfor the other cases.- Returns:
- this for chaining
- Since:
- 9.1.1
-
isMultipartEnabled
public final boolean isMultipartEnabled()
-
setMultipartEnabled
@Nonnull public final XServletSettings setMultipartEnabled(boolean bIsMultipartEnabled)
-
getClone
@Nonnull @ReturnsMutableCopy public XServletSettings getClone()
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<XServletSettings>
-
-