electric.webserver
Class WebServer

java.lang.Object
  extended byelectric.webserver.WebServer
All Implemented Interfaces:
IChannelSink, IChannelStates, IEXMLLoggingConstants, IGLUELoggingConstants, IHTTPConstants, ILoggingConstants, IWebServerConstants

public final class WebServer
extends java.lang.Object
implements IWebServerConstants, IChannelSink, IHTTPConstants, IGLUELoggingConstants, IChannelStates

WebServer provides the functionality of a web server, including a servlet engine and HTTP routing capabilities.

Author:
webMethods

Field Summary
 
Fields inherited from interface electric.webserver.IWebServerConstants
DEFAULT_TIMEOUT
 
Fields inherited from interface electric.util.http.IHTTPConstants
ACCEPT_LANGUAGE, ACCEPT_RANGES, APPLICATION_BINARY, APPLICATION_OCTET_STREAM, ASCII, AUTHORIZATION, BASIC, BOUNDARY, CHARSET_EQUALS, CHUNKED, CLOSE, COLON_SLASH_SLASH, CONNECT, CONNECTION, CONTENT_ID, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, CONTINUATION_STATUS, CONTINUE_EXPECTATION, COOKIE, COOKIE_LISTENER, DATE, DEFAULT_CONTENT_TYPE, DEFAULT_HTTP_CHARSET, DEFAULT_HTTPS_PORT, DEFAULT_MIME_TYPE, DEFAULT_PROXY_PORT, DIGEST, EOL, EXPECT, EXPECT_HEADER, FORM_URLENCODED, GET, GLUE_SESSION, HEAD, HOST, HTTP_1_0, HTTP_1_1, HTTP_PROTOCOL, HTTPS_PROTOCOL, IF_MODIFIED_SINCE, KEEP_ALIVE, LAST_MODIFIED, LOCATION, MD5_HASH, MIME_BOUNDARY, MIME_VERSION, MULTIPART_CONTENT_TYPE, OK, POST, PROXY_AUTHORIZATION, RANGE, SC_CONTINUE, SC_MOVED, SC_MOVED_PERMANENTLY, SC_OK, SC_PROXY_AUTHENTICATION_REQUIRED, SC_UNAUTHORIZED, SEPARATOR, SERVER, SERVER_PREFIX, SERVER_TYPE, SET_COOKIE_0, SET_COOKIE_1, SLASH, START, TEXT_HTML, TEXT_PLAIN, TEXT_XML, TEXT_XML_UTF_8, TRANSFER_ENCODING, USER_AGENT, WWW_AUTHENTICATE
 
Fields inherited from interface electric.glue.IGLUELoggingConstants
CLUSTER_DEBUG_EVENT, CLUSTER_EVENT, CONSOLE_DEBUG_EVENT, DEPLOY_EVENT, DETECTORS_EVENT, HTTP_EVENT, JMS_EVENT, REBINDING_EVENT, SECURITY_DEBUG_EVENT, SECURITY_DETAIL_EVENT, SERVLET_EVENT, SOAP_EVENT
 
Fields inherited from interface electric.xml.IEXMLLoggingConstants
MAPPING_EVENT, SCHEMA_EVENT
 
Fields inherited from interface electric.util.log.ILoggingConstants
CLASSLOADER_EVENT, COMMAND_EVENT, COMMENT_EVENT, CONFIG_EVENT, DEBUG_EVENT, ELECTRIC_LOGGING_PROPERTY, ERROR_EVENT, EXCEPTION_EVENT, FILE_EVENT, LICENSE_EVENT, RESOURCES_EVENT, SECURITY_EVENT, SHUTDOWN_EVENT, SOURCE_EVENT, SQL_EVENT, STARTUP_EVENT, WARNING_EVENT
 
Fields inherited from interface electric.net.channel.IChannelStates
ACTIVE, IDLE, PENDING, STATES
 
Constructor Summary
WebServer(java.lang.String url)
          Construct a web server associated with the specified URL but do not start processing HTTP requests until startup() is invoked.
WebServer(java.lang.String url, Context context)
           
WebServer(java.lang.String url, ThreadPool threadPool, int backlog, Context context)
          Construct a web server associated with the specified URL but do not start processing HTTP requests until I am sent startup().
 
Method Summary
 void addContext(java.lang.String path, HTTPContext context)
          Add the context, associating it with the specified path.
 void addContext(java.lang.String path, HTTPContext context, boolean startup)
          Add the context, associating it with the specified path.
 void addWelcomeFile(java.lang.String filename)
           
 HTTPContext[] getAllContexts()
          Return all my contexts
 HTTPContext getContext(java.lang.String path)
          Return the context associated with the specified path.
static int getDefaultTimeout()
           
 IMessageFactory getMessageFactory()
           
 SocketServer getSocketServer()
          Return socket server associated with this web server
 int getTimeout()
           
 XURL getXURL()
          Return my XURL.
 HTTPContext removeContext(java.lang.String path)
          Remove the context associated with the specified path.
 boolean service(IChannel channel)
          If the channel has pending HTTP input, service it and return true, otherwise return false.
static void setDefaultTimeout(int defaultTimeout)
           
 void setDocbase(java.lang.String docbase)
           
 void setMessageFactory(IMessageFactory messageFactory)
          Allow explicit control over the message factory being used.
 void setTimeout(int timeout)
           
 void shutdown()
          Stop processing incoming HTTP requests and send a destroy() message to all of my servlets.
 void startup()
          Start processing incoming HTTP requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebServer

public WebServer(java.lang.String url)
          throws java.io.IOException
Construct a web server associated with the specified URL but do not start processing HTTP requests until startup() is invoked. Use the shared thread pool.

Parameters:
url - The URL to service.
Throws:
java.io.IOException - If an I/O exception occurs.

WebServer

public WebServer(java.lang.String url,
                 Context context)
          throws java.io.IOException
Parameters:
url -
context -

WebServer

public WebServer(java.lang.String url,
                 ThreadPool threadPool,
                 int backlog,
                 Context context)
          throws java.io.IOException
Construct a web server associated with the specified URL but do not start processing HTTP requests until I am sent startup(). Use the shared thread pool.

Parameters:
url - The URL to service.
threadPool - The thread pool to use.
backlog - The maximum number of pending connections.
Throws:
java.io.IOException - If an I/O exception occurs.
Method Detail

service

public boolean service(IChannel channel)
                throws java.io.IOException
If the channel has pending HTTP input, service it and return true, otherwise return false. Note that even if true is returned, the actual keep-alive status depends on a number of other factors, such as whether the client requested keep-alive, etc.

Specified by:
service in interface IChannelSink
Parameters:
channel -
Returns:
true if this channel should be eligible for keep-alive, false otherwise.
Throws:
java.io.IOException

getXURL

public XURL getXURL()
Return my XURL.


startup

public void startup()
             throws java.io.IOException
Start processing incoming HTTP requests.

Throws:
java.io.IOException

shutdown

public void shutdown()
              throws java.io.IOException
Stop processing incoming HTTP requests and send a destroy() message to all of my servlets.

Throws:
java.io.IOException

setDocbase

public void setDocbase(java.lang.String docbase)
Parameters:
docbase -

addWelcomeFile

public void addWelcomeFile(java.lang.String filename)
Parameters:
filename -

addContext

public void addContext(java.lang.String path,
                       HTTPContext context)
                throws javax.servlet.ServletException
Add the context, associating it with the specified path.

Parameters:
path -
context - The context.
Throws:
javax.servlet.ServletException - If the context could not be added.

addContext

public void addContext(java.lang.String path,
                       HTTPContext context,
                       boolean startup)
                throws javax.servlet.ServletException
Add the context, associating it with the specified path.

Parameters:
path -
context - The context.
startup - start up context if true
Throws:
javax.servlet.ServletException - If the context could not be added.

removeContext

public HTTPContext removeContext(java.lang.String path)
Remove the context associated with the specified path.

Parameters:
path - The path.

getContext

public HTTPContext getContext(java.lang.String path)
Return the context associated with the specified path.

Parameters:
path - The path.

getAllContexts

public HTTPContext[] getAllContexts()
Return all my contexts


setTimeout

public void setTimeout(int timeout)
Parameters:
timeout -

getTimeout

public int getTimeout()

setDefaultTimeout

public static void setDefaultTimeout(int defaultTimeout)
Parameters:
defaultTimeout -

getDefaultTimeout

public static int getDefaultTimeout()

getSocketServer

public SocketServer getSocketServer()
Return socket server associated with this web server


getMessageFactory

public IMessageFactory getMessageFactory()
Returns:
the current message factory.

setMessageFactory

public void setMessageFactory(IMessageFactory messageFactory)
Allow explicit control over the message factory being used. There will always be a default factory. The message factory should not be reset while the server is running.

Parameters:
messageFactory -


copyright© 2001-2004 by webMethods All Rights Reserved.