public class DojoHttpTransport extends AbstractHttpTransport implements IHttpTransport, IExtensionInitializer
Modifier and Type | Class and Description |
---|---|
class |
DojoHttpTransport.LoaderExtensionResourceFactory
Resource factory that creates a
AbstractHttpTransport.LoaderExtensionResource for the dojo http
transport when the loader extension resource URI is requested |
AbstractHttpTransport.FeatureListResourceFactory, AbstractHttpTransport.LoaderExtensionResource
IHttpTransport.LayerContributionType, IHttpTransport.ModuleInfo, IHttpTransport.OptimizationLevel
IExtensionInitializer.IExtensionRegistrar
ASSERTNONLS_REQPARAM, CACHEBUST_REQPARAMS, CONFIGVARNAME_REQPARAM, CONSOLE_WARNING_MSG_FMT, DEPENDENCYEXPANSIONLOGGING_REQPARAMS, DEPS_REQPARAM, ENCODED_FEATURE_MAP_REQPARAM, EXCLUDEENC_REQPARAM, EXCLUDEIDS_REQPARAM, EXCLUDES_REQPARAM, EXPANDREQUIRELISTS_REQPARAMS, EXPORTMODULENAMES_REQPARAMS, FEATURE_LIST_PRELUDE, FEATURE_LIST_PROLOGUE, FEATUREMAP_JS_NAME, FEATUREMAP_REQPARAM, FEATUREMAPHASH_REQPARAM, GENERATESOURCEMAPS_REQPARAMS, INCLUDEREQUIREDEPS_REQPARAM, INCLUDEUNDEFINEDFEATUREDEPS_REQPARAM, LAYERCONTRIBUTIONSTATE_REQATTRNAME, NOCACHE_REQPARAMS, OPTIMIZATIONLEVEL_REQPARAMS, PATHS_PROPNAME, PRELOADS_REQPARAM, REQUESTEDLOCALES_REQPARAMS, REQUESTEDMODULEIDS_REQPARAM, REQUESTEDMODULES_REQPARAM, REQUESTEDMODULESCOUNT_REQPARAM, REQUIRED_REQPARAM, SCRIPTS_REQPARAM, SERVEREXPANDLAYERS_REQPARAMS, SHOWFILENAMES_REQPARAMS
ASSERTNONLS_REQATTRNAME, CACHEBUST_REQATTRNAME, CONFIGVARNAME_REQATTRNAME, DEPENDENCYEXPANSIONLOGGING_REQATTRNAME, EXPANDREQLOGGING_REQATTRNAME, EXPANDREQUIRELISTS_REQATTRNAME, EXPORTMODULENAMES_REQATTRNAME, FEATUREMAP_REQATTRNAME, GENERATESOURCEMAPS_REQATTRNAME, INCLUDEREQUIREDEPS_REQATTRNAME, INCLUDEUNDEFINEDFEATUREDEPS_REQATTRNAME, NOADDMODULES_REQATTRNAME, NOCACHE_REQATTRNAME, NOTEXTADORN_REQATTRNAME, OPTIMIZATIONLEVEL_REQATTRNAME, REQUESTEDLOCALES_REQATTRNAME, REQUESTEDMODULENAMES_REQATTRNAME, SERVEREXPANDLAYERS_REQATTRNAME, SHOWFILENAMES_REQATTRNAME
Constructor and Description |
---|
DojoHttpTransport() |
Modifier and Type | Method and Description |
---|---|
protected String |
afterLayerModule(javax.servlet.http.HttpServletRequest request,
IHttpTransport.ModuleInfo info)
Handles the
IHttpTransport.LayerContributionType.AFTER_LAYER_MODULE
layer listener event. |
protected String |
afterModule(javax.servlet.http.HttpServletRequest request,
IHttpTransport.ModuleInfo info)
Handles the
IHttpTransport.LayerContributionType.AFTER_MODULE
layer listener event. |
protected String |
beforeLayerModule(javax.servlet.http.HttpServletRequest request,
IHttpTransport.ModuleInfo info)
Handles
IHttpTransport.LayerContributionType.BEFORE_FIRST_LAYER_MODULE
and
IHttpTransport.LayerContributionType.BEFORE_SUBSEQUENT_LAYER_MODULE
layer listener events. |
protected String |
beforeModule(javax.servlet.http.HttpServletRequest request,
IHttpTransport.ModuleInfo info)
Handles
IHttpTransport.LayerContributionType.BEFORE_FIRST_MODULE
and
IHttpTransport.LayerContributionType.BEFORE_SUBSEQUENT_MODULE
layer listener events. |
protected String |
beginLayerModules(javax.servlet.http.HttpServletRequest request,
Object arg)
Handles the
IHttpTransport.LayerContributionType.BEGIN_LAYER_MODULES
layer listener event. |
void |
decorateRequest(javax.servlet.http.HttpServletRequest request)
Called to parse the HTTP request and decorate the request with the
request attributes defined in this interface.
|
protected String |
endLayerModules(javax.servlet.http.HttpServletRequest request,
Object arg)
Handles the
IHttpTransport.LayerContributionType.END_LAYER_MODULES
layer listener event. |
protected String |
endResponse(javax.servlet.http.HttpServletRequest request,
Object arg)
Handles the
IHttpTransport.LayerContributionType.END_RESPONSE layer
listener event |
String |
getAggregatorTextPluginName()
Returns the plugin name used by the transport for text resources (e.g.
|
List<ICacheKeyGenerator> |
getCacheKeyGenerators()
Returns a cache key generator for the JavaScript contained in the
loader extension JavaScript and output by
IHttpTransport.getLayerContribution(HttpServletRequest, LayerContributionType, Object)
. |
protected List<String[]> |
getClientConfigAliases()
Returns the list of client config aliases
|
protected String |
getDynamicLoaderExtensionJavaScript(javax.servlet.http.HttpServletRequest request)
Returns the dynamic portion of the loader extension javascript for this transport.
|
String |
getLayerContribution(javax.servlet.http.HttpServletRequest request,
IHttpTransport.LayerContributionType type,
Object arg)
Returns a string value that will be added to the layer in the location
specified by
type , or null if the transport has no contribution
to make. |
protected String |
getLoaderExtensionPath()
Property accessor for the loaderExtensionPath property
|
protected String[] |
getLoaderExtensionResources()
Property accessor for the loaderExtensionResources property
|
String |
getModuleIdRegFunctionName()
Returns the name of the client side registration function used to register module-name/module-id
mappings.
|
protected String |
getTextPluginPath() |
protected String |
getTextPluginProxyUriStr() |
void |
initialize(IAggregator aggregator,
IAggregatorExtension extension,
IExtensionInitializer.IExtensionRegistrar reg)
Called immediately after the extension is created to set the aggregator
instance that this extension object was created for.
|
boolean |
isServerExpandable(javax.servlet.http.HttpServletRequest request,
String mid)
Returns true if the specified module can be included in a server expanded
layer (i.e.
|
void |
modifyConfig(IAggregator aggregator,
Object configObj)
Add paths and aliases mappings to the config for the dojo text plugin.
|
clientRegisterSyntheticModules, contributeBootLayerDeps, contributeLoaderExtensionJavaScript, createFeatureListResource, dependenciesLoaded, generateModuleIdMap, getAggregator, getComboUri, getExtensionContributions, getFeatureListResourceUri, getFeaturesFromRequest, getFeaturesFromRequestEncoded, getHasConditionsFromRequest, getModuleIdList, getModuleIdMap, getOptimizationLevelFromRequest, getParameter, getRequestedLocales, getResourcePathId, getSyntheticModuleNames, getTransportId, newFeatureListResourceFactory, putDeps, setRequestedModuleNames, shutdown, validateLayerContributionState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contributeLoaderExtensionJavaScript, getModuleIdMap
protected String getLoaderExtensionPath()
protected String getTextPluginPath()
protected String[] getLoaderExtensionResources()
protected List<String[]> getClientConfigAliases()
public String getAggregatorTextPluginName()
IHttpTransport
getAggregatorTextPluginName
in interface IHttpTransport
public String getModuleIdRegFunctionName()
IHttpTransport
[ [ ["module1", "module2", "module3"], ["module4"], ["module5", "module6"] ], [ [1,2,3], [4], [5,6] ] ]
The JavaScript module builder emits code to register module-ids for expanded dependencies on the client, using the string arrays (the first element) both to specify the expanded dependencies and as part of the id mappings.
The id mappings are used by the client to encode requested module names when requesting modules from the aggregator in order to minimize URL lengths.
getModuleIdRegFunctionName
in interface IHttpTransport
getModuleIdRegFunctionName
in class AbstractHttpTransport
public String getLayerContribution(javax.servlet.http.HttpServletRequest request, IHttpTransport.LayerContributionType type, Object arg)
IHttpTransport
type
, or null if the transport has no contribution
to make. This method is provided to allow the transport to inject
scaffolding JavaScript that may be required by the AMD loader.getLayerContribution
in interface IHttpTransport
getLayerContribution
in class AbstractHttpTransport
request
- The request objecttype
- The layer contribution typearg
- This parameter specifies a IHttpTransport.ModuleInfo
object for the following
type
values:
IHttpTransport.LayerContributionType.BEFORE_FIRST_MODULE
IHttpTransport.LayerContributionType.BEFORE_SUBSEQUENT_MODULE
IHttpTransport.LayerContributionType.AFTER_MODULE
IHttpTransport.LayerContributionType.BEFORE_FIRST_LAYER_MODULE
IHttpTransport.LayerContributionType.BEFORE_SUBSEQUENT_LAYER_MODULE
IHttpTransport.LayerContributionType.AFTER_LAYER_MODULE
type
, arg
specifies
a Set<String>
of modules which are to be required by the
loader via a synthetically generated require() call.
IHttpTransport.LayerContributionType.BEGIN_LAYER_MODULES
IHttpTransport.LayerContributionType.END_LAYER_MODULES
type
, mid
is null.type
.public boolean isServerExpandable(javax.servlet.http.HttpServletRequest request, String mid)
IHttpTransport
Excluded modules consist of those that specify a loader plugin that is not
included in IConfig.TEXTPLUGINDELEGATORS_CONFIGPARAM
or
IConfig.JSPLUGINDELEGATORS_CONFIGPARAM
, and modules that specify
an absolute or server relative URL.
isServerExpandable
in interface IHttpTransport
isServerExpandable
in class AbstractHttpTransport
request
- The request objectmid
- The module idprotected String beforeModule(javax.servlet.http.HttpServletRequest request, IHttpTransport.ModuleInfo info)
IHttpTransport.LayerContributionType.BEFORE_FIRST_MODULE
and
IHttpTransport.LayerContributionType.BEFORE_SUBSEQUENT_MODULE
layer listener events.request
- the http request objectinfo
- the IHttpTransport.ModuleInfo
object for the moduleprotected String afterModule(javax.servlet.http.HttpServletRequest request, IHttpTransport.ModuleInfo info)
IHttpTransport.LayerContributionType.AFTER_MODULE
layer listener event.request
- the http request objectinfo
- the IHttpTransport.ModuleInfo
object for the moduleprotected String beforeLayerModule(javax.servlet.http.HttpServletRequest request, IHttpTransport.ModuleInfo info)
IHttpTransport.LayerContributionType.BEFORE_FIRST_LAYER_MODULE
and
IHttpTransport.LayerContributionType.BEFORE_SUBSEQUENT_LAYER_MODULE
layer listener events.request
- the http request objectinfo
- the IHttpTransport.ModuleInfo
object for the moduleprotected String afterLayerModule(javax.servlet.http.HttpServletRequest request, IHttpTransport.ModuleInfo info)
IHttpTransport.LayerContributionType.AFTER_LAYER_MODULE
layer listener event.request
- the http request objectinfo
- the IHttpTransport.ModuleInfo
object for the moduleprotected String beginLayerModules(javax.servlet.http.HttpServletRequest request, Object arg)
IHttpTransport.LayerContributionType.BEGIN_LAYER_MODULES
layer listener event.request
- the http request objectarg
- the set of required modulesprotected String endLayerModules(javax.servlet.http.HttpServletRequest request, Object arg)
IHttpTransport.LayerContributionType.END_LAYER_MODULES
layer listener event.request
- the http request objectarg
- the set of required modulesprotected String endResponse(javax.servlet.http.HttpServletRequest request, Object arg)
IHttpTransport.LayerContributionType.END_RESPONSE
layer
listener eventrequest
- the http request objectarg
- nullpublic List<ICacheKeyGenerator> getCacheKeyGenerators()
IHttpTransport
IHttpTransport.getLayerContribution(HttpServletRequest, LayerContributionType, Object)
. If the output JavaScript is invariant with regard to the request for
the same set of modules, then this function may return null.getCacheKeyGenerators
in interface IHttpTransport
getCacheKeyGenerators
in class AbstractHttpTransport
public void decorateRequest(javax.servlet.http.HttpServletRequest request) throws IOException
IHttpTransport
decorateRequest
in interface IHttpTransport
decorateRequest
in class AbstractHttpTransport
request
- The HTTP requestIOException
public void initialize(IAggregator aggregator, IAggregatorExtension extension, IExtensionInitializer.IExtensionRegistrar reg)
IExtensionInitializer
initialize
in interface IExtensionInitializer
initialize
in class AbstractHttpTransport
aggregator
- The aggregator that this extension was created for.extension
- The extension objectreg
- A registrar object that can be used to register additional
aggregator extendablesprotected String getDynamicLoaderExtensionJavaScript(javax.servlet.http.HttpServletRequest request)
AbstractHttpTransport
getDynamicLoaderExtensionJavaScript
in class AbstractHttpTransport
request
- The http request objectprotected String getTextPluginProxyUriStr()
public void modifyConfig(IAggregator aggregator, Object configObj)
The reason this is a bit complex is that in order to support text plugin resources that specify an absolute path (e.g. dojo/text!http://server.com/resource.html), we use server-side config paths entries to map dojo/text to a proxy plugin module provided by this transport. The proxy plugin module examines the module id of the requested resource, and if the id is absolute, it delegates to the dojo text plugin which can still be accessed from the client using an alternative path which we set up below. If the module id is relative, then the proxy plugin module delegates to the aggregator text plugin (which is a pseudo plugin that resolves to the aggregator itself).
In addition to the paths mappings, aliases are used, both in the
server-side config and in the client config, to allow the proxy plugin
module to refer to the dojo text plugin module and the aggregator text
plugin via static names, allowing the actual names to be dynamic without
requiring us to dynamically modify the contents of the proxy plugin
resource itself. This method sets the server-side config aliases
and sets up the client-side config aliases to be set in
AbstractHttpTransport.contributeLoaderExtensionJavaScript(String)
.
modifyConfig
in interface IConfigModifier
modifyConfig
in class AbstractHttpTransport
aggregator
- The aggregator that this config is associated withconfigObj
- The implementation specific raw config object from the config JavaScript. See
IConfig.getRawConfig()
for a description of this object. Implementors of
this method may modify the config object as needed.Copyright © 2011-2015 IBM. All Rights Reserved.