public abstract class AbstractResourceContext extends Object implements ResourceContext
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_INLINE_SIZE
The largest file size that will be inlined.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractResourceContext(com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.core.ext.GeneratorContext context,
com.google.gwt.core.ext.typeinfo.JClassType resourceBundleType,
ClientBundleContext clientBundleCtx) |
Modifier and Type | Method and Description |
---|---|
String |
deploy(URL resource,
boolean forceExternal)
Deprecated.
|
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.
|
protected com.google.gwt.core.ext.GeneratorContext |
getContext() |
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.
|
protected com.google.gwt.core.ext.TreeLogger |
getLogger() |
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.
|
void |
setRequirements(ClientBundleRequirements requirements) |
protected static String |
toBase64(byte[] data) |
deploy, supportsDataUrls
protected static final int MAX_INLINE_SIZE
protected AbstractResourceContext(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.core.ext.GeneratorContext context, com.google.gwt.core.ext.typeinfo.JClassType resourceBundleType, ClientBundleContext clientBundleCtx)
protected static String toBase64(byte[] data)
@Deprecated public String deploy(URL resource, boolean forceExternal) throws com.google.gwt.core.ext.UnableToCompleteException
ResourceContext
deploy
in interface ResourceContext
resource
- 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
public String deploy(URL resource, String mimeType, boolean forceExternal) throws com.google.gwt.core.ext.UnableToCompleteException
ResourceContext
deploy
in interface ResourceContext
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
public <T> T getCachedData(String key, Class<T> clazz)
ResourceContext
getCachedData
in interface ResourceContext
T
- the type of data to retrievekey
- the key value passed to ResourceContext.getCachedData(java.lang.String, java.lang.Class<T>)
clazz
- the type to which the cached value must be assignableResourceContext.putCachedData(java.lang.String, T)
or
null
if the data was not foundpublic com.google.gwt.core.ext.typeinfo.JClassType getClientBundleType()
ResourceContext
getClientBundleType
in interface ResourceContext
public com.google.gwt.core.ext.GeneratorContext getGeneratorContext()
ResourceContext
ResourceContext.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.getGeneratorContext
in interface ResourceContext
public String getImplementationSimpleSourceName()
ResourceContext
SimpleSourceName.this
).getImplementationSimpleSourceName
in interface ResourceContext
public ClientBundleRequirements getRequirements()
ResourceContext
ClientBundleRequirements
object, which can be used to
track deferred-binding and configuration properties that are relevant to a
resource context.getRequirements
in interface ResourceContext
public <T> boolean putCachedData(String key, T value)
ResourceContext
putCachedData
in interface ResourceContext
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 pairpublic void setRequirements(ClientBundleRequirements requirements)
protected com.google.gwt.core.ext.GeneratorContext getContext()
protected com.google.gwt.core.ext.TreeLogger getLogger()
Copyright © 2016. All rights reserved.