Eclipse Rich Ajax Platform

org.eclipse.rwt.resources
Interface IResource


public interface IResource

Implementations of this interface represent an existing resource - local or external.

Since:
1.0

Method Summary
 java.lang.String getCharset()
          Specifies the charset to use for this resource.
 java.lang.ClassLoader getLoader()
          Specifies the classloader that has access to the resource that should be loaded.
 java.lang.String getLocation()
          Returns the location of the resource.
 IResourceManager.RegisterOptions getOptions()
          Specifies in which way the resource is delivered.
 boolean isExternal()
          Decides whether the resource is external or not.
 boolean isJSLibrary()
          Decides whether the resource is a javascript library and thus handled a bit different than other resources.
 

Method Detail

getLoader

java.lang.ClassLoader getLoader()
Specifies the classloader that has access to the resource that should be loaded. If there is no special classloader you want to use just return the one of your implementation:

 ClassLoader getLoader() {
    return this.getClass().getClassLoader();
 }
 

Returns:
the classloader to use

getLocation

java.lang.String getLocation()
Returns the location of the resource. This can be a path to a file within the bundles classpath or a URI for an external resource.

Returns:
the location of the resource
See Also:
isExternal()

getCharset

java.lang.String getCharset()
Specifies the charset to use for this resource.

Returns:
the charset to use

getOptions

IResourceManager.RegisterOptions getOptions()
Specifies in which way the resource is delivered. This is interesting for javascript libraries to compress and version them before sending them to the client. If this resource is not an javascript library use RegisterOptions#NONE. If you want RAP to compress the file use RegisterOptions#COMPRESS and to version it use RegisterOptions#VERSION. If you want to combine versioning and compression you can return RegisterOptions#VERSION_AND_COMPRESS as value.

Returns:
an instance of RegisterOptions
See Also:
IResourceManager.RegisterOptions

isJSLibrary

boolean isJSLibrary()
Decides whether the resource is a javascript library and thus handled a bit different than other resources. This is also needed if you plan to have external, compressed and versioned javascript libraries.

Returns:
whether this resource is a javascript library
See Also:
IResourceManager.RegisterOptions, isExternal(), getOptions()

isExternal

boolean isExternal()
Decides whether the resource is external or not. If the resource is a javascript library and not external it will be transmitted immediately with all the other resources. In the case of an external javascript library it will be included in the generated page with a <script> tag.

Returns:
whether the resource is located externally

Eclipse Rich Ajax Platform

Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.