|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.web.WebServer
public class WebServer
A mini webserver that should be embedded in another application. It can server any file that is available from classloaders that are registered with it, including class-files. Its primary purpose is to simplify dynamic class-loading in RMI. Create an instance of it, register a classloader with your classes, start it, and you'll be able to let RMI-clients dynamically download classes from it. It is configured by calling any methods programmatically prior to startup.
WebClassLoader
Constructor Summary | |
---|---|
WebServer()
|
Method Summary | |
---|---|
URL |
addClassLoader(ClassLoader cl)
Add a class loader to the web server map and return the URL that should be used as the annotated codebase for classes that are to be available via RMI dynamic classloading. |
void |
addMimeType(String extension,
String type)
Augment the type suffix to mime type mappings |
int |
getBacklog()
Get the server sockets listen queue depth |
InetAddress |
getBindAddress()
Get the address the http server binds to |
protected byte[] |
getBytes(URL url)
Read the local class/resource contents into a byte array. |
protected String |
getClassLoaderKey(ClassLoader cl)
Create the string key used as the key into the loaderMap. |
boolean |
getDownloadResources()
|
boolean |
getDownloadServerClasses()
|
protected String |
getMimeType(String path)
Lookup the mime type for the suffix of the path argument. |
protected String |
getPath(BufferedReader in)
|
int |
getPort()
Get the http listening port |
org.jboss.util.threadpool.BasicThreadPoolMBean |
getThreadPool()
|
protected void |
listen()
|
void |
removeClassLoader(ClassLoader cl)
Remove a class loader previously added via addClassLoader |
void |
run()
Listen threads entry point. |
void |
setBacklog(int backlog)
Set the server sockets listen queue depth |
void |
setBindAddress(InetAddress bindAddress)
Set the http server bind address |
void |
setDownloadResources(boolean flag)
|
void |
setDownloadServerClasses(boolean flag)
|
void |
setPort(int port)
Set the http listening port |
void |
setThreadPool(org.jboss.util.threadpool.BasicThreadPoolMBean threadPool)
|
void |
start()
Start the web server on port and begin listening for requests. |
void |
stop()
Close the web server listening socket |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebServer()
Method Detail |
---|
public void setPort(int port)
public int getPort()
public void setBindAddress(InetAddress bindAddress)
bindAddress
- public InetAddress getBindAddress()
public int getBacklog()
public void setBacklog(int backlog)
public boolean getDownloadServerClasses()
public void setDownloadServerClasses(boolean flag)
public boolean getDownloadResources()
public void setDownloadResources(boolean flag)
public org.jboss.util.threadpool.BasicThreadPoolMBean getThreadPool()
public void setThreadPool(org.jboss.util.threadpool.BasicThreadPoolMBean threadPool)
public void addMimeType(String extension, String type)
extension
- - the type extension without a period(class, txt)type
- - the mime type stringpublic void start() throws Exception
Exception
public void stop()
public URL addClassLoader(ClassLoader cl)
cl
- - the ClassLoader instance to begin serving download requests
for
getClassLoaderKey(ClassLoader)
public void removeClassLoader(ClassLoader cl)
cl
- - the ClassLoader previously added via addClassLoaderpublic void run()
run
in interface Runnable
protected String getClassLoaderKey(ClassLoader cl)
protected void listen()
protected String getPath(BufferedReader in) throws IOException
IOException
protected byte[] getBytes(URL url) throws IOException
IOException
protected String getMimeType(String path)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |