com.google.gwt.resources.ext.ResourceContext |
Known Indirect Subclasses |
Context object for ResourceGenerators. An instance of this type will be
provided by the resource generation framework to implementations of
ResourceGenerator via init(TreeLogger, 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(String, 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(String, String, byte[], boolean)
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Cause a specific collection of bytes to be available in the program's
compiled output.
| |||||||||||
Cause a specific collection of bytes to be available in the program's
compiled output.
| |||||||||||
This method is deprecated.
use
deploy(URL, String, boolean) instead
| |||||||||||
Retrieve data from the ResourceContext.
| |||||||||||
Return the interface type of the resource bundle being generated.
| |||||||||||
Return the GeneratorContext in which the overall resource generation
framework is being run.
| |||||||||||
Returns the simple source name of the implementation of the bundle being
generated.
| |||||||||||
Store data in the ResourceContext.
| |||||||||||
Indicates if the runtime context supports data: urls.
|
Cause a specific collection of bytes to be available in the program's compiled output. The return value of this method is a Java expression which will evaluate to the location of the resource at runtime. The exact format should not be depended upon.
resource | the resource to add to the compiled output |
---|---|
mimeType | optional MIME Type to be used for an embedded resource |
forceExternal | 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 XMLHttpRequest |
UnableToCompleteException |
---|
Cause a specific collection of bytes to be available in the program's compiled output. The return value of this method is a Java expression which will evaluate to the location of the resource at runtime. The exact format should not be depended upon.
suggestedFileName | an unobfuscated filename to possibly use for the resource |
---|---|
mimeType | the MIME type of the data being provided |
data | the bytes to add to the output |
forceExternal | 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 XMLHttpRequest |
UnableToCompleteException |
---|
This method is deprecated.
use deploy(URL, String, boolean)
instead
Cause a specific collection of bytes to be available in the program's compiled output. The return value of this method is a Java expression which will evaluate to the location of the resource at runtime. The exact format should not be depended upon.
resource | the resource to add to the compiled output |
---|---|
forceExternal | 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 XMLHttpRequest |
UnableToCompleteException |
---|
Retrieve data from the ResourceContext.
key | the key value passed to getCachedData(String, Class |
---|---|
clazz | the type to which the cached value must be assignable |
putCachedData(String, T)
or
null
if the data was not foundClassCastException | if the cached data is not assignable to the specified type |
---|
Return the interface type of the resource bundle being generated.
Return the GeneratorContext in which the overall resource generation
framework is being run. Implementations of ResourceGenerator should prefer
deploy(String, String, byte[], boolean)
over tryCreateResource(TreeLogger, String)
in order to
take advantage of serving optimizations that can be performed by the bundle
architecture.
Returns the simple source name of the implementation of the bundle being
generated. This can be used during code-generation to refer to the instance
of the bundle (e.g. via SimpleSourceName.this
).
IllegalStateException | if this method is called during
init(TreeLogger, ResourceContext) or
prepare(TreeLogger, ResourceContext, ClientBundleRequirements, JMethod) methods.
|
---|
Store data in the ResourceContext. ResourceGenerators may reduce the amount of recomputation performed by caching data the ResourceContext. This cache will be invalidated when the compiler's TypeOracle is refreshed or replaced. Each ResourceGenerator has an isolated view of the cache.
key | a string key to locate the data |
---|---|
value | the value to store |
true
if the cache did not previously contain the
key-value pair
Indicates if the runtime context supports data: urls. When data URLs are supported by the context, aggregation of resource data into larger payloads is discouraged, as it offers reduced benefit to the application at runtime.