@JsType(isNative=true, namespace="Cesium", name="Resource") public class Resource extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Resource.RetryCallback
A function that returns the value of the property.
|
Modifier and Type | Field and Description |
---|---|
boolean |
hasHeaders
True if the Resource has request headers.
|
JsObject |
headers
Additional HTTP headers that will be sent with the request.
|
boolean |
isBlobUri
True if the Resource refers to a blob URI.
|
boolean |
isCrossOriginUrl
True if the Resource refers to a cross origin URL.
|
boolean |
isDataUri
True if the Resource refers to a data URI.
|
DefaultProxy |
proxy
A proxy to be used when loading the resource.
|
Request |
request
A Request object that will be used.
|
int |
retryAttempts
The number of times the retryCallback should be called before giving up.
|
Resource.RetryCallback |
retryCallback
Function to call when a request for this resource fails.
|
JsObject |
templateValues
The key/value pairs used to replace template parameters in the url.
|
String |
url
The url to the resource with template values replaced, query string appended and encoded by proxy if one was set.
|
Constructor and Description |
---|
Resource(ResourceOptions options) |
Modifier and Type | Method and Description |
---|---|
void |
appendForwardSlash()
Appends a forward slash to the URL.
|
void |
appendQueryParameters(JsObject params)
Combines the specified object and the existing query parameters.
|
Resource |
clone()
Duplicates a Resource instance.
|
Resource |
clone(Resource result)
Duplicates a Resource instance.
|
static Resource |
DEFAULT()
A resource instance initialized to the current browser location.
|
static Promise<JsObject,Void> |
delete(ResourceHttpOptions options)
Creates a Resource from a URL and calls delete() on it.
|
static Promise<JsObject,Void> |
delete(String url)
Creates a Resource from a URL and calls delete() on it.
|
String |
extension()
The file extension of the resource.
|
static Promise<JsObject,Void> |
fetch(ResourceHttpOptions options)
Creates a Resource from a URL and calls fetch() on it.
|
static Promise<JsObject,Void> |
fetch(String url)
Creates a Resource from a URL and calls fetch() on it.
|
Promise<com.google.gwt.typedarrays.shared.ArrayBuffer,Void> |
fetchArrayBuffer()
Asynchronously loads the resource as raw binary data.
|
static Promise<com.google.gwt.typedarrays.shared.ArrayBuffer,Void> |
fetchArrayBuffer(ResourceOptions options)
Creates a Resource and calls fetchArrayBuffer() on it.
|
static Promise<com.google.gwt.typedarrays.shared.ArrayBuffer,Void> |
fetchArrayBuffer(String url)
Creates a Resource and calls fetchArrayBuffer() on it.
|
static Promise<JsBlob,Void> |
fetchBlob(ResourceOptions options)
Creates a Resource and calls fetchBlob() on it.
|
static Promise<JsBlob,Void> |
fetchBlob(String url)
Creates a Resource and calls fetchBlob() on it.
|
Promise<JsImage,Void> |
fetchImage()
Asynchronously loads the given image resource.
|
Promise<JsImage,Void> |
fetchImage(boolean preferBlob)
Asynchronously loads the given image resource.
|
static Promise<JsImage,Void> |
fetchImage(ResourceImageOptions options)
Creates a Resource and calls fetchImage() on it.
|
static Promise<JsImage,Void> |
fetchImage(String url)
Creates a Resource and calls fetchImage() on it.
|
Promise<JsObject,Void> |
fetchJson()
Asynchronously loads the given resource as JSON.
|
static Promise<JsObject,Void> |
fetchJson(ResourceOptions options)
Creates a Resource and calls fetchJson() on it.
|
static Promise<JsObject,Void> |
fetchJson(String url)
Creates a Resource and calls fetchJson() on it.
|
Promise<JsObject,Void> |
fetchJsonp()
Requests a resource using JSONP.
|
static Promise<JsObject,Void> |
fetchJsonp(ResourceJsonpOptions options)
Creates a Resource from a URL and calls fetchJsonp() on it.
|
static Promise<JsObject,Void> |
fetchJsonp(String url)
Creates a Resource from a URL and calls fetchJsonp() on it.
|
Promise<JsObject,Void> |
fetchJsonpCallback(String callbackParameterName)
Requests a resource using JSONP.
|
Promise<String,Void> |
fetchText()
Asynchronously loads the given resource as text.
|
static Promise<JsObject,Void> |
fetchText(ResourceOptions options)
Creates a Resource and calls fetchText() on it.
|
static Promise<JsObject,Void> |
fetchText(String url)
Creates a Resource and calls fetchText() on it.
|
static Promise<JsObject,Void> |
fetchXML(ResourceOptions options)
Creates a Resource and calls fetchXML() on it.
|
static Promise<JsObject,Void> |
fetchXML(String url)
Creates a Resource and calls fetchXML() on it.
|
String |
getBaseUri()
Returns the base path of the Resource.
|
String |
getBaseUri(boolean includeQuery)
Returns the base path of the Resource.
|
Resource |
getDerivedResource()
Returns a resource relative to the current instance.
|
Resource |
getDerivedResource(DerivedResourceOptions options)
Returns a resource relative to the current instance.
|
String |
getUrlComponent()
Returns the url, optional with the query string and processed by a proxy.
|
String |
getUrlComponent(boolean query)
Returns the url, optional with the query string and processed by a proxy.
|
String |
getUrlComponent(boolean query,
boolean proxy)
Returns the url, optional with the query string and processed by a proxy.
|
Promise<JsObject,Void> |
head()
Asynchronously gets headers the given resource.
|
Promise<JsObject,Void> |
head(ResourceHttpOptions options)
Asynchronously gets headers the given resource.
|
static boolean |
isBlobSupported()
Returns true if blobs are supported.
|
Promise<JsObject,Void> |
options()
Asynchronously gets options the given resource.
|
Promise<JsObject,Void> |
options(ResourceHttpOptions options)
Asynchronously gets options the given resource.
|
static Promise<JsObject,Void> |
patch(ResourcePathOptions options)
Creates a Resource from a URL and calls patch() on it.
|
static Promise<JsObject,Void> |
patch(String url)
Creates a Resource from a URL and calls patch() on it.
|
Promise<JsObject,Void> |
post(JsObject data)
Asynchronously posts data the given resource.
|
Promise<JsObject,Void> |
post(JsObject data,
ResourceHttpOptions options)
Asynchronously posts data the given resource.
|
static Promise<JsObject,Void> |
post(ResourceHttpOptions options)
Creates a Resource from a URL and calls fetch() on it.
|
static Promise<JsObject,Void> |
post(String url)
Creates a Resource from a URL and calls fetch() on it.
|
static Promise<JsObject,Void> |
put(ResourcePutOptions options)
Creates a Resource from a URL and calls put() on it.
|
static Promise<JsObject,Void> |
put(String url)
Creates a Resource from a URL and calls put() on it.
|
JsObject |
queryParameters()
Query parameters appended to the url.
|
Promise<Boolean,Void> |
retryOnError()
Called when a resource fails to load.
|
Promise<Boolean,Void> |
retryOnError(JsObject error)
Called when a resource fails to load.
|
void |
setQueryParameters(JsObject params)
Combines the specified object and the existing query parameters.
|
void |
setQueryParameters(JsObject params,
boolean useAsDefault)
Combines the specified object and the existing query parameters.
|
@JsProperty public boolean hasHeaders
@JsProperty public JsObject headers
@JsProperty public boolean isBlobUri
@JsProperty public boolean isCrossOriginUrl
@JsProperty public boolean isDataUri
@JsProperty public DefaultProxy proxy
@JsProperty public Request request
@JsProperty public int retryAttempts
@JsProperty public Resource.RetryCallback retryCallback
@JsProperty public JsObject templateValues
@JsProperty public String url
@JsConstructor public Resource(ResourceOptions options)
@JsProperty(name="DEFAULT") public static Resource DEFAULT()
@JsProperty(name="isBlobSupported") public static boolean isBlobSupported()
@JsProperty(name="extension") public String extension()
@JsProperty(name="queryParameters") public JsObject queryParameters()
@JsMethod public static Promise<JsObject,Void> delete(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> delete(ResourceHttpOptions options)
options
- ResourceHttpOptions
.@JsMethod public static Promise<JsObject,Void> fetch(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> fetch(ResourceHttpOptions options)
options
- RequestOptions
.@JsMethod public static Promise<com.google.gwt.typedarrays.shared.ArrayBuffer,Void> fetchArrayBuffer(String url)
url
- The url of the resource.@JsMethod public static Promise<com.google.gwt.typedarrays.shared.ArrayBuffer,Void> fetchArrayBuffer(ResourceOptions options)
options
- RequestOptions
.@JsMethod public static Promise<JsImage,Void> fetchImage(String url)
url
- The url of the resource.@JsMethod public static Promise<JsImage,Void> fetchImage(ResourceImageOptions options)
options
- ResourceImageOptions
object.@JsMethod public static Promise<JsObject,Void> fetchJson(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> fetchJson(ResourceOptions options)
options
- RequestOptions
object.@JsMethod public static Promise<JsObject,Void> fetchJsonp(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> fetchJsonp(ResourceJsonpOptions options)
options
- ResourceJsonpOptions
object.@JsMethod public static Promise<JsObject,Void> fetchText(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> fetchText(ResourceOptions options)
options
- ResourceOptions
object.@JsMethod public static Promise<JsObject,Void> fetchXML(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> fetchXML(ResourceOptions options)
options
- ResourceOptions
object.@JsMethod public static Promise<JsObject,Void> patch(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> patch(ResourcePathOptions options)
options
- ResourcePathOptions
object.@JsMethod public static Promise<JsObject,Void> post(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> post(ResourceHttpOptions options)
options
- ResourceHttpOptions
object.@JsMethod public static Promise<JsObject,Void> put(String url)
url
- The url of the resource.@JsMethod public static Promise<JsObject,Void> put(ResourcePutOptions options)
options
- ResourcePutOptions
opbject.@JsMethod public void appendForwardSlash()
@JsMethod public void appendQueryParameters(JsObject params)
params
- The query parameters@JsMethod public Resource clone()
@JsMethod public Resource clone(Resource result)
result
- The object onto which to store the result.@JsMethod public Promise<com.google.gwt.typedarrays.shared.ArrayBuffer,Void> fetchArrayBuffer()
@JsMethod public static Promise<JsBlob,Void> fetchBlob(String url)
url
- url@JsMethod public static Promise<JsBlob,Void> fetchBlob(ResourceOptions options)
options
- ResourceOptions
@JsMethod public Promise<JsImage,Void> fetchImage()
@JsMethod public Promise<JsImage,Void> fetchImage(boolean preferBlob)
preferBlob
- If true, we will load the image via a blob.@JsMethod public Promise<JsObject,Void> fetchJson()
@JsMethod public Promise<JsObject,Void> fetchJsonp()
@JsMethod(name="fetchJsonp") public Promise<JsObject,Void> fetchJsonpCallback(String callbackParameterName)
callbackParameterName
- The callback parameter name that the server expects.@JsMethod public Promise<String,Void> fetchText()
@JsMethod public String getBaseUri()
@JsMethod public String getBaseUri(boolean includeQuery)
includeQuery
- Whether or not to include the query string and fragment form the uri@JsMethod public Resource getDerivedResource()
@JsMethod public Resource getDerivedResource(DerivedResourceOptions options)
options
- ResourceOptions
object.@JsMethod public String getUrlComponent()
@JsMethod public String getUrlComponent(boolean query)
query
- If true, the query string is included.@JsMethod public String getUrlComponent(boolean query, boolean proxy)
query
- If true, the query string is included.proxy
- If true, the url is processed the proxy object if defined.@JsMethod public Promise<JsObject,Void> head()
@JsMethod public Promise<JsObject,Void> head(ResourceHttpOptions options)
options
- ResourceHttpOptions
object.@JsMethod public Promise<JsObject,Void> options()
@JsMethod public Promise<JsObject,Void> options(ResourceHttpOptions options)
options
- ResourceHttpOptions
object.@JsMethod public Promise<JsObject,Void> post(JsObject data)
data
- Data that is posted with the resource.@JsMethod public Promise<JsObject,Void> post(JsObject data, ResourceHttpOptions options)
data
- Data that is posted with the resource.options
- Object with the following properties: ResourceHttpOptions
.@JsMethod public Promise<Boolean,Void> retryOnError()
@JsMethod public Promise<Boolean,Void> retryOnError(JsObject error)
error
- The error that was encountered.@JsMethod public void setQueryParameters(JsObject params)
params
- The query parameters@JsMethod public void setQueryParameters(JsObject params, boolean useAsDefault)
params
- The query parametersuseAsDefault
- If true the params will be used as the default values, so they will only be set if they are undefined.Copyright © 2019. All rights reserved.