The WebService implementation. It configures a WebServer instance to
perform dynamic class and resource loading.
| Method from org.jboss.web.WebService Detail: |
public URL addClassLoader(ClassLoader cl) {
return server.addClassLoader(cl);
}
|
protected void createService() throws Exception {
// Load the file mime.types into the mapping list
Properties mimeTypes = new Properties();
try
{
mimeTypes.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jboss/web/mime.types"));
Enumeration keys = mimeTypes.keys();
while (keys.hasMoreElements())
{
String extension = (String) keys.nextElement();
String type = mimeTypes.getProperty(extension);
server.addMimeType(extension, type);
}
}
catch (Exception e)
{
log.error("Failed to load org/jboss/web/mime.types; ignoring", e);
}
// if no override has been specified, default to the jboss bind address
if (getBindAddress() == null)
setBindAddress(System.getProperty(ServerConfig.SERVER_BIND_ADDRESS));
// if no host specified, default to the java.rmi.server.hostname property value
if (getHost() == null)
setHost(System.getProperty("java.rmi.server.hostname"));
// Set the rmi codebase if it is not already set
String codebase = getCodebase();
if (codebase == null)
{
codebase = "http://" + getHost() + ":" + getPort() + "/";
System.setProperty("java.rmi.server.codebase", codebase);
}
log.info("Using RMI server codebase: " + codebase);
}
|
public int getBacklog() {
return server.getBacklog();
}
Get the WebService listen queue backlog limit. The maximum queue length
for incoming connection indications (a request to connect) is set to the
backlog parameter. If a connection indication arrives when the queue is
full, the connection is refused. |
public String getBindAddress() {
InetAddress bindAddress = server.getBindAddress();
if (bindAddress != null)
return bindAddress.getHostAddress();
else
return null;
}
Get the specific address the WebService listens on. |
public String getCodebase() {
return System.getProperty("java.rmi.server.codebase");
}
|
public boolean getDownloadResources() {
return server.getDownloadResources();
}
A flag indicating if the server should attempt to download resources,
i.e. resource paths that don't end in .class |
public boolean getDownloadServerClasses() {
return server.getDownloadServerClasses();
}
A flag indicating if the server should attempt to download classes from
thread context class loader when a request arrives that does not have a
class loader key prefix. |
public String getHost() {
return host;
}
Get the name of the interface to use for the host portion of the
RMI codebase URL. |
protected ObjectName getObjectName(MBeanServer server,
ObjectName name) throws MalformedObjectNameException {
return name == null ? OBJECT_NAME : name;
}
|
public int getPort() {
return server.getPort();
}
Get the WebService listening port. |
public void removeClassLoader(ClassLoader cl) {
server.removeClassLoader(cl);
}
|
public void setBacklog(int backlog) {
server.setBacklog(backlog);
}
Set the WebService listen queue backlog limit. The maximum queue length
for incoming connection indications (a request to connect) is set to the
backlog parameter. If a connection indication arrives when the queue is
full, the connection is refused. |
public void setBindAddress(String address) throws UnknownHostException {
InetAddress bindAddress = toInetAddress(address);
server.setBindAddress(bindAddress);
}
Set the specific address the WebService listens on. This can be used on
a multi-homed host for a ServerSocket that will only accept connect requests
to one of its addresses. |
public void setDownloadResources(boolean flag) {
server.setDownloadResources(flag);
}
|
public void setDownloadServerClasses(boolean flag) {
server.setDownloadServerClasses(flag);
}
|
public void setHost(String hostname) {
this.host = ServerConfigUtil.fixRemoteAddress(hostname);
}
Set the name of the interface to use for the host portion of the
RMI codebase URL. |
public void setPort(int port) {
server.setPort(port);
}
Set the WebService listening port. |
public void setThreadPool(BasicThreadPoolMBean threadPool) {
server.setThreadPool(threadPool);
}
Set the thread pool used for the WebServer class loading. |
protected void startService() throws Exception {
// Start the WebServer running
server.start();
log.debug("Started WebServer with address: " + server.getBindAddress() + ":" + getPort());
}
|
protected void stopService() throws Exception {
server.stop();
log.debug("Stopped WebServer with address: " + server.getBindAddress() + ":" + getPort());
}
|