| Modifier and Type | Class and Description |
|---|---|
static class |
SoyGeneralOptions.CssHandlingScheme
Schemes for handling
css commands. |
| Constructor and Description |
|---|
SoyGeneralOptions() |
| Modifier and Type | Method and Description |
|---|---|
Boolean |
allowExternalCalls()
Returns whether to allow external calls (calls to undefined templates).
|
SoyGeneralOptions |
clone() |
com.google.common.collect.ImmutableMap<String,PrimitiveData> |
getCompileTimeGlobals()
Returns the map from compile-time global name to value.
|
SoyGeneralOptions.CssHandlingScheme |
getCssHandlingScheme()
Returns the scheme for handling
css commands. |
SyntaxVersion |
getDeclaredSyntaxVersion(SyntaxVersion defaultSyntaxVersion)
Returns the user-declared syntax version, or the given default value if the user did not
declare a syntax version.
|
boolean |
isStrictAutoescapingRequired()
Returns whether strict autoescaping is required.
|
void |
setAllowExternalCalls(boolean allowExternalCalls)
Sets whether to allow external calls (calls to undefined templates).
|
void |
setCompileTimeGlobals(File compileTimeGlobalsFile)
Sets the file containing compile-time globals.
|
void |
setCompileTimeGlobals(Map<String,?> compileTimeGlobalsMap)
Sets the map from compile-time global name to value.
|
void |
setCompileTimeGlobals(URL compileTimeGlobalsResource)
Sets the resource file containing compile-time globals.
|
void |
setCssHandlingScheme(SoyGeneralOptions.CssHandlingScheme cssHandlingScheme)
Sets the scheme for handling
css commands. |
void |
setDeclaredSyntaxVersionName(String versionName)
Sets the user-declared syntax version name for the Soy file bundle.
|
void |
setStrictAutoescapingRequired(boolean strictAutoescapingRequired)
Sets whether strict autoescaping is required.
|
void |
setSupportContentSecurityPolicy(boolean supportContentSecurityPolicy)
Pass true to enable CSP (Content Security Policy) support which adds an extra pass that marks
inline scripts in templates specially so the browser can distinguish scripts written by trusted
template authors from scripts injected via XSS.
|
boolean |
supportContentSecurityPolicy()
True when CSP (Content Security Policy) support is enabled causing inline scripts to be marked
so that the browser can run scripts specified by the template author but not ones injected via
XSS.
|
public void setDeclaredSyntaxVersionName(@Nonnull String versionName)
versionName - The syntax version name, e.g. "1.0", "2.0", "2.3".public SyntaxVersion getDeclaredSyntaxVersion(SyntaxVersion defaultSyntaxVersion)
Important: Do not use outside of Soy code (treat as superpackage-private).
defaultSyntaxVersion - The default value to return if the user did not declare a syntax
version.public void setAllowExternalCalls(boolean allowExternalCalls)
allowExternalCalls - The value to set.public Boolean allowExternalCalls()
public void setStrictAutoescapingRequired(boolean strictAutoescapingRequired)
strictAutoescapingRequired - Whether autoescaping is required.public boolean isStrictAutoescapingRequired()
public void setCssHandlingScheme(SoyGeneralOptions.CssHandlingScheme cssHandlingScheme)
css commands.cssHandlingScheme - The css-handling scheme to set.public SoyGeneralOptions.CssHandlingScheme getCssHandlingScheme()
css commands.public void setCompileTimeGlobals(Map<String,?> compileTimeGlobalsMap)
The values can be any of the Soy primitive types: null, boolean, integer, float (Java double), or string.
compileTimeGlobalsMap - Map from compile-time global name to value. The values can be
any of the Soy primitive types: null, boolean, integer, float (Java double), or string.SoySyntaxException - If one of the values is not a valid
Soy primitive type.public void setCompileTimeGlobals(File compileTimeGlobalsFile) throws IOException
Each line of the file should have the format
<global_name> = <primitive_data>
where primitive_data is a valid Soy expression literal for a primitive type (null, boolean,
integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file
should be encoded in UTF-8.
If you need to generate a file in this format from Java, consider using the utility
SoyUtils.generateCompileTimeGlobalsFile().
compileTimeGlobalsFile - The file containing compile-time globals.IOException - If there is an error reading the compile-time globals file.public void setCompileTimeGlobals(URL compileTimeGlobalsResource) throws IOException
Each line of the file should have the format
<global_name> = <primitive_data>
where primitive_data is a valid Soy expression literal for a primitive type (null, boolean,
integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file
should be encoded in UTF-8.
If you need to generate a file in this format from Java, consider using the utility
SoyUtils.generateCompileTimeGlobalsFile().
compileTimeGlobalsResource - The resource file containing compile-time globals.IOException - If there is an error reading the compile-time globals file.public com.google.common.collect.ImmutableMap<String,PrimitiveData> getCompileTimeGlobals()
public void setSupportContentSecurityPolicy(boolean supportContentSecurityPolicy)
Scripts are marked using a per-page-render secret stored in the injected variable
$ij.csp_nonce.
Scripts in non-contextually auto-escaped templates may not be found.
public boolean supportContentSecurityPolicy()
public final SoyGeneralOptions clone()