public interface ResourceContext
ResourceGenerator.init(com.google.gwt.core.ext.TreeLogger, com.google.gwt.resources.ext.ResourceContext)
. Because this interface
is not intended to be implemented by end-users, the API provided by this
interface may be extended in the future.
Depending on the optimizations made by the implementation of deploy(java.lang.String, java.lang.String, byte[], boolean)
,
the resulting URL may or may not be compatible with standard
RequestBuilder
/ XMLHttpRequest security
semantics. If the resource is intended to be used with XHR, or if there are
other reasons why embedding the resource is undesirable such as known
incompatibilities, the forceExternal
parameter should be set to
true
when invoking deploy(java.lang.String, java.lang.String, byte[], boolean)
.
Modifier and Type | Method and Description |
---|---|
String |
deploy(String suggestedFileName,
String mimeType,
byte[] data,
boolean forceExternal)
Cause a specific collection of bytes to be available in the program's
compiled output.
|
String |
deploy(URL resource,
boolean forceExternal)
Deprecated.
use
deploy(URL, String, boolean) instead |
String |
deploy(URL resource,
String mimeType,
boolean forceExternal)
Cause a specific collection of bytes to be available in the program's
compiled output.
|
<T> T |
getCachedData(String key,
Class<T> clazz)
Retrieve data from the ResourceContext.
|
com.google.gwt.core.ext.typeinfo.JClassType |
getClientBundleType()
Return the interface type of the resource bundle being generated.
|
com.google.gwt.core.ext.GeneratorContext |
getGeneratorContext()
Return the GeneratorContext in which the overall resource generation
framework is being run.
|
String |
getImplementationSimpleSourceName()
Returns the simple source name of the implementation of the bundle being
generated.
|
ClientBundleRequirements |
getRequirements()
Returns a
ClientBundleRequirements object, which can be used to
track deferred-binding and configuration properties that are relevant to a
resource context. |
<T> boolean |
putCachedData(String key,
T value)
Store data in the ResourceContext.
|
boolean |
supportsDataUrls()
Indicates if the runtime context supports data: urls.
|
String deploy(String suggestedFileName, String mimeType, byte[] data, boolean forceExternal) throws com.google.gwt.core.ext.UnableToCompleteException
suggestedFileName
- an unobfuscated filename to possibly use for the
resourcemimeType
- the MIME type of the data being provideddata
- the bytes to add to the outputforceExternal
- prevents embedding of the resource, e.g. in case of
known incompatibilities or for example to enforce compatibility
with security restrictions if the resource is intended to be
accessed via an XMLHttpRequestcom.google.gwt.core.ext.UnableToCompleteException
@Deprecated String deploy(URL resource, boolean forceExternal) throws com.google.gwt.core.ext.UnableToCompleteException
deploy(URL, String, boolean)
insteadresource
- the resource to add to the compiled outputforceExternal
- prevents embedding of the resource, e.g. in case of
known incompatibilities or for example to enforce compatibility
with security restrictions if the resource is intended to be
accessed via an XMLHttpRequestcom.google.gwt.core.ext.UnableToCompleteException
String deploy(URL resource, String mimeType, boolean forceExternal) throws com.google.gwt.core.ext.UnableToCompleteException
resource
- the resource to add to the compiled outputmimeType
- optional MIME Type to be used for an embedded resourceforceExternal
- prevents embedding of the resource, e.g. in case of
known incompatibilities or for example to enforce compatibility
with security restrictions if the resource is intended to be
accessed via an XMLHttpRequestcom.google.gwt.core.ext.UnableToCompleteException
<T> T getCachedData(String key, Class<T> clazz)
T
- the type of data to retrievekey
- the key value passed to getCachedData(java.lang.String, java.lang.Class<T>)
clazz
- the type to which the cached value must be assignableputCachedData(java.lang.String, T)
or
null
if the data was not foundClassCastException
- if the cached data is not assignable to the
specified typecom.google.gwt.core.ext.typeinfo.JClassType getClientBundleType()
com.google.gwt.core.ext.GeneratorContext getGeneratorContext()
deploy(java.lang.String, java.lang.String, byte[], boolean)
over GeneratorContext.tryCreateResource(com.google.gwt.core.ext.TreeLogger, java.lang.String)
in order to
take advantage of serving optimizations that can be performed by the bundle
architecture.String getImplementationSimpleSourceName() throws IllegalStateException
SimpleSourceName.this
).IllegalStateException
- if this method is called during
ResourceGenerator.init(com.google.gwt.core.ext.TreeLogger, com.google.gwt.resources.ext.ResourceContext)
or
ResourceGenerator.prepare(com.google.gwt.core.ext.TreeLogger, com.google.gwt.resources.ext.ResourceContext, com.google.gwt.resources.ext.ClientBundleRequirements, com.google.gwt.core.ext.typeinfo.JMethod)
methods.ClientBundleRequirements getRequirements()
ClientBundleRequirements
object, which can be used to
track deferred-binding and configuration properties that are relevant to a
resource context.<T> boolean putCachedData(String key, T value)
T
- the type of data being storedkey
- a string key to locate the datavalue
- the value to storetrue
if the cache did not previously contain the
key-value pairboolean supportsDataUrls()
Copyright © 2016. All rights reserved.