public interface IOptions
The options are backed by a Properties
object, so any property,
including properties not defined by this interface, can be read using
getOption(String)
and set using
setOption(String, String)
.
The options are read on bundle activation from aggregator.properties located in the home directory of the user that started the server.
Aggregator options are server-wide, meaning the each aggregator servlet
running on a given server shares the same options. A single OSGi service is
registered using the IOptions interface during bundle activation for the
aggregator bundle. Calls to IAggregator.getOptions()
return this
single instance of the options object.
Modifier and Type | Field and Description |
---|---|
static String |
CACHE_DIRECTORY
Name of property to specify the directory to use for cache files.
|
static String |
CACHEBUST
Name of property that specifies a cache bust string.
|
static String |
DEBUG_MODE
Name of property that specifies if the aggregator is running in debug
mode.
|
static int |
DEFAULT_DELETE_DELAY
The default value returned by
getDeleteDelay() |
static String |
DELETE_DELAY
Name of property that specifies the delay in seconds to wait before
asynchronously deleting a cache file that has been queued for deletion.
|
static String |
DEVELOPMENT_MODE
Name of property that specifies if the aggregator is running in
development mode.
|
static String |
DISABLE_HASFILTERING
Name of property that specifies if the aggregator should not perform
has.js feature trimming of javascript code.
|
static String |
DISABLE_HASPLUGINBRANCHING
Name of property that specifies if has! plugin branching should be
disabled during require list expansion.
|
static String |
DISABLE_MODULENAMEIDENCODING
Name of property that specifies if module name id encoding should be disabled.
|
static String |
DISABLE_REQUIRELISTEXPANSION
Name of property that specifies if the dependency lists in require()
calls should not be expanded to include nested dependencies.
|
static String |
propsFilename
Name of aggregator propertis file located in the home directory
of the user that launched the server.
|
static String |
SOURCE_MAPS
Name of property that specifies if requests for source maps should be honored.
|
static String |
VERIFY_DEPS
Name of property to specify if the dependency list of required modules
specified in the define() function of AMD modules should be validated,
during module minification, against the the dependency list that was used
to create the dependency graph for require list expansion.
|
Modifier and Type | Method and Description |
---|---|
String |
getCacheBust()
Convenience method for reading the
CACHEBUST options
property. |
String |
getCacheDirectory()
Convenience method for reading the
CACHE_DIRECTORY
options property. |
Map<String,String> |
getDefaultOptionsMap()
Returns an immutable map of the default options and their values.
|
int |
getDeleteDelay()
Convenience method for reading the
DELETE_DELAY
options property. |
String |
getName()
Returns the name that can be used to track this options object using the IOptionsListener
interface.
|
String |
getOption(String name)
Returns the value of the specified option
|
Map<String,String> |
getOptionsMap()
Returns an immutable map of the current options and their values.
|
boolean |
isDebugMode()
Convenience method for reading the
DEBUG_MODE
options property. |
boolean |
isDevelopmentMode()
Convenience method for reading the
DEVELOPMENT_MODE
options property. |
boolean |
isDisableHasFiltering()
Convenience method for reading the
DISABLE_HASFILTERING
options property. |
boolean |
isDisableHasPluginBranching()
Convenience method for reading the
DISABLE_HASPLUGINBRANCHING
options property. |
boolean |
isDisableModuleNameIdEncoding()
Convenience method for reading the
DISABLE_MODULENAMEIDENCODING
options property. |
boolean |
isDisableRequireListExpansion()
Convenience method for reading the
DISABLE_REQUIRELISTEXPANSION
options property. |
boolean |
isSourceMapsEnabled()
Convenience method for reading the
SOURCE_MAPS
options property. |
boolean |
isVerifyDeps()
Convenience method for reading the
VERIFY_DEPS
options property. |
void |
setOption(String name,
boolean value)
Convenience method for setting options with boolean values.
|
void |
setOption(String name,
String value)
Sets the named option to the specified value.
|
static final String propsFilename
static final String DEVELOPMENT_MODE
Development mode also enables enhanced error reporting, with information about errors that occur on the server displayed in the browser console using console.error() calls.
Development mode also enables all debug mode features
Valid values: true/false
static final String DEBUG_MODE
Debug mode features do not negatively impact overall server performance like some development mode features do.
All features enabled by debug mode are also enabled by development mode.
Valid values: true/false
static final String SOURCE_MAPS
Valid values: true/false
static final String DISABLE_HASFILTERING
Valid values: true/false
static final String DISABLE_REQUIRELISTEXPANSION
Valid values: true/false
static final String DISABLE_HASPLUGINBRANCHING
static final String DISABLE_MODULENAMEIDENCODING
Module name id encoding is used to reduce the amount of space required to specify module names in request URLs. When module name encoding is enabled (the default), the aggregator specifies number id values for the names of expanded dependencies and when the client needs to request these modules, it does so using the ids instead of the module names.
Because the ids assigned to module names are subject to change as modules are added or removed during application development, it can be useful to disable this feature while actively developing an application in order to reduce the need to clear the browser cache.
Note that disabling this feature can affect application performance, resulting in increased request splitting in order to keep URL lengths within maximum length limits.
static final String CACHEBUST
Valid values: String
static final String DELETE_DELAY
Valid values: Integer value >= 0
DEFAULT_DELETE_DELAY
,
Constant Field Valuesstatic final String VERIFY_DEPS
A dependency verification failure results in discarding of the response being processed and replacement with a response that invokes a JavaScript alert message on the browser indicating the module that caused the failure, and instructions to clear the browser cache and reload the page. It also causes dependencies to be revalidated on the server (the equivilent if issuing a 'aggregator verifyDeps' console command).
Valid values: true/false
static final String CACHE_DIRECTORY
static final int DEFAULT_DELETE_DELAY
getDeleteDelay()
boolean isVerifyDeps()
VERIFY_DEPS
options property.VERIFY_DEPS
property
as a booleanboolean isDisableRequireListExpansion()
DISABLE_REQUIRELISTEXPANSION
options property.DISABLE_REQUIRELISTEXPANSION
property
as a booleanboolean isDevelopmentMode()
DEVELOPMENT_MODE
options property.DEVELOPMENT_MODE
property
as a booleanboolean isDebugMode()
DEBUG_MODE
options property.DEBUG_MODE
property
as a booleanboolean isSourceMapsEnabled()
SOURCE_MAPS
options property.SOURCE_MAPS
property
as a booleanboolean isDisableHasFiltering()
DISABLE_HASFILTERING
options property.DISABLE_HASFILTERING
property
as a booleanboolean isDisableHasPluginBranching()
DISABLE_HASPLUGINBRANCHING
options property.DISABLE_HASPLUGINBRANCHING
property
as a booleanboolean isDisableModuleNameIdEncoding()
DISABLE_MODULENAMEIDENCODING
options property.DISABLE_MODULENAMEIDENCODING
property
as a booleanString getCacheBust()
CACHEBUST
options
property.CACHEBUST
options property.int getDeleteDelay()
DELETE_DELAY
options property.DELETE_DELAY
property
as an int. If the property is not set, then
DEFAULT_DELETE_DELAY
is returned.String getCacheDirectory()
CACHE_DIRECTORY
options property.CACHE_DIRECTORY
propertyString getOption(String name)
name
- The option namevoid setOption(String name, String value) throws IOException
Use this method sparingly. Calling this method results in options listeners being called to inform them that the options have changed. Some listeners react to this by performing actions that can have significant adverse effects on performance. The cache manager, for example, purges the cache of all cached responses.
This method should not generally be called as part of normal operation of the aggregator. I may be called, for example, by a console command handler that allows admins or developers to set properties while the server is running. Changes to options made using this method are persisted to the properties file.
name
- The name of the option to setvalue
- The new option value. If null, then name
is
reset to its default value.IOException
- If an error occurs persisting the updated options to the
aggregator properties file.void setOption(String name, boolean value) throws IOException
setOption(name, Boolean.toString(value));
.name
- The name of the option to setvalue
- The boolean value.IOException
- If an error occurs persisting the updated options to the
aggregator properties file.Map<String,String> getOptionsMap()
Map<String,String> getDefaultOptionsMap()
setOption(String, boolean)
or setOption(String, String)
.String getName()
Copyright © 2011-2015 IBM. All Rights Reserved.