站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

WebClassLoader (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.web
Class WebClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byjava.net.URLClassLoader
              extended byorg.jboss.util.loading.DelegatingClassLoader
                  extended byorg.jboss.mx.loading.LoaderRepositoryClassLoader
                      extended byorg.jboss.web.WebClassLoader

public class WebClassLoader
extends org.jboss.mx.loading.LoaderRepositoryClassLoader

A simple subclass of URLClassLoader that is used in conjunction with the the WebService mbean to allow dynamic loading of resources and classes from deployed ears, ejb jars and wars. A WebClassLoader is associated with a Container and must have an UnifiedClassLoader as its parent. It overrides the getURLs() method to return a different set of URLs for remote loading than what is used for local loading.

WebClassLoader has two methods meant to be overriden by subclasses: getKey() and getBytes(). The latter is a no-op in this implementation and should be overriden by subclasses with bytecode generation ability, such as the classloader used by the iiop module.

WebClassLoader subclasses must have a constructor with the same signature as the WebClassLoader constructor.

Version:
$Revision: 1.10 $
Author:
Scott Stark., Sacha Labourey , Vladimir Blagojevic , Francisco Reverbel
See Also:
#getUrls(), setWebURLs(URL[])

Field Summary
 
Fields inherited from class org.jboss.mx.loading.LoaderRepositoryClassLoader
repository
 
Fields inherited from class org.jboss.util.loading.DelegatingClassLoader
EMPTY_URL_ARRAY, standard
 
Constructor Summary
WebClassLoader(javax.management.ObjectName containerName, org.jboss.mx.loading.RepositoryClassLoader parent)
          Creates new WebClassLoader.
 
Method Summary
 byte[] getBytes(Class clz)
          Gets the bytecodes for a given class.
 String getCodebaseString()
           
 javax.management.ObjectName getContainer()
          Gets the JMX ObjectName of the WebClassLoader's container.
 String getKey()
          Gets a string key used as the key into the WebServer's loaderMap.
 URL[] getLocalURLs()
          Access the URLClassLoader.getURLs() value.
 URL getURL()
          Returns the single URL for my parent, an UnifiedClassLoader.
 URL[] getURLs()
          Get the list of URLs that should be used as the RMI annotated codebase.
 void setWebURLs(URL[] webURLs)
          Set the URLs that should be returned from this classes getURLs() override.
 
Methods inherited from class org.jboss.mx.loading.LoaderRepositoryClassLoader
loadClass
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebClassLoader

public WebClassLoader(javax.management.ObjectName containerName,
                      org.jboss.mx.loading.RepositoryClassLoader parent)
Creates new WebClassLoader. Subclasses must have a constructor with the same signature.

Method Detail

getKey

public String getKey()
Gets a string key used as the key into the WebServer's loaderMap.


getContainer

public javax.management.ObjectName getContainer()
Gets the JMX ObjectName of the WebClassLoader's container.


getURL

public URL getURL()
Returns the single URL for my parent, an UnifiedClassLoader.


getURLs

public URL[] getURLs()
Get the list of URLs that should be used as the RMI annotated codebase. This is the URLs previously set via setWebURLs. If setWebURLs has not been invoked or was passed in a null value, the super class value of getURLs() is used.

Returns:
the local web URLs if not null, else the value of super.getURLs()

getLocalURLs

public URL[] getLocalURLs()
Access the URLClassLoader.getURLs() value.

Returns:
the URLs used for local class and resource loading

setWebURLs

public void setWebURLs(URL[] webURLs)
Set the URLs that should be returned from this classes getURLs() override.


getCodebaseString

public String getCodebaseString()

getBytes

public byte[] getBytes(Class clz)
Gets the bytecodes for a given class. This implementation always returns null, indicating that it is unable to get bytecodes for any class. Should be overridden by subclasses with bytecode generation capability (such as the classloader used by the iiop module, which generates IIOP stubs on the fly).

Returns:
a byte array with the bytecodes for class cls, or null if this classloader is unable to return such byte array.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.