|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface URLPolicy
This interface represents the ModuleLoader's policy for creating URL for resource loading and security purposes. Java requires the use of URLs for resource loading and security. For resource loading, URLs are returned for requested resources. Subsequently, the resource URL is used to create an input stream for reading the resources bytes. With respect to security, URLs are used when defining a class in order to determine where the code came from, this concept is called a CodeSource. This approach enables Java to assign permissions to code that originates from particular locations.
The ModuleManager requires a concrete implementation of this interface in order to function. Whenever the ModuleManager requires a URL for either resource loading or security, it delegates to the policy implementation. A default implementation is provided, called DefaultURLPolicy, but it only supports resource loading, not security.
ModuleManager
,
DefaultURLPolicy
Method Summary | |
---|---|
java.net.URL |
createCodeSourceURL(ModuleManager mgr,
Module module)
This method should return a URL that represents the location from which the module originated. |
java.net.URL |
createResourceURL(ModuleManager mgr,
Module module,
int rsIdx,
java.lang.String name)
This method should return a URL that is suitable for accessing the bytes of the specified resource. |
Method Detail |
---|
java.net.URL createCodeSourceURL(ModuleManager mgr, Module module)
This method should return a URL that represents the location from which the module originated. This URL can be used when assigning permissions to the module, such as is done in the Java permissions policy file.
mgr
- the ModuleManager of the module.module
- the module for which the URL is to be created.
java.net.URL createResourceURL(ModuleManager mgr, Module module, int rsIdx, java.lang.String name)
This method should return a URL that is suitable for accessing the bytes of the specified resource. It must be possible open a connection to this URL, which may require that the implementer of this method also introduce a custom java.net.URLStreamHander when creating the URL.
mgr
- the ModuleManager of the module.module
- the module for which the resource is being loaded.rsIdx
- the index of the ResourceSource containing the resource.name
- the name of the resource being loaded.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |