|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mortbay.HTTP.HttpServer
HTTP Server. This is the core class for the Jetty HTTP server. The server takes it's configuration from an instance of a class derived from HttpConfiguration. It then creates a HttpListener for each host and port described in the configuration. Requests received on those ports are converted into HttpRequests and a HttpResponse is instantiated. The request path and server configuration are used to select a handler stack (actually an array of HttpHandler instances). The request and response are passed to each handler in the stack until the request is handled (indicated by the response header fields having been written). HttpHandlers may choose to ignore, modify or completely handle a request given to them. They also may modify the response without completely handling the request. A typical stack of HttpHandlers would include:
java com.mortbay.HTTP.HttpServer [ HttpConfigurationClass ]
Constructor Summary | |
HttpServer()
Construct, must be configured later |
|
HttpServer(HttpConfiguration config)
Construct and configure |
Method Summary | |
void |
close()
Deprecated. Use stop |
HttpConfiguration |
configuration()
Get the Configuration |
void |
configure(HttpConfiguration config)
Configure and start the server Defined server properties are: |
java.lang.Object |
getAttribute(java.lang.String name)
Returns an attribute of the server given the specified key name. |
java.util.Enumeration |
getAttributeNames()
. |
javax.servlet.ServletContext |
getContext(java.lang.String url)
Returns a ServletContext object that
corresponds to a specified URL on the server. |
int |
getMajorVersion()
Returns the major version of the Java Servlet API that this Web server supports. |
java.lang.String |
getMimeType(java.lang.String file)
Returns the mime type of the specified file, or null if not known. |
int |
getMinorVersion()
Returns the minor version of the Servlet API that this Web server supports. |
java.lang.String |
getRealPath(java.lang.String path)
Applies alias rules to the specified virtual path and returns the corresponding real path. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Get a RequestDispatcher. |
java.net.URL |
getResource(java.lang.String path)
Get a resource. |
java.io.InputStream |
getResourceAsStream(java.lang.String path)
Get a resource as a Stream. |
java.lang.String |
getServerInfo()
Returns the name and version of the Web server under which the servlet is running. |
javax.servlet.Servlet |
getServlet(java.lang.String name)
Deprecated. |
java.util.Enumeration |
getServletNames()
Deprecated. |
java.util.Enumeration |
getServlets()
Deprecated. Use getServletNames & getServlet |
void |
join()
join the HttpServer and all its listeners. |
void |
log(java.lang.Exception e,
java.lang.String message)
Deprecated. |
void |
log(java.lang.String message)
Writes a message to the servlet log file. |
void |
log(java.lang.String message,
java.lang.Throwable th)
Writes a message to the servlet log file. |
static void |
main(java.lang.String[] args)
Main |
void |
removeAttribute(java.lang.String name)
. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
. |
void |
stop()
Stop the HttpServer. |
static void |
stopAll()
Stop all instances of HttpServer. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public HttpServer()
public HttpServer(HttpConfiguration config) throws java.lang.Exception
Method Detail |
public void configure(HttpConfiguration config) throws java.lang.Exception
SessionMaxInactiveInterval - Max idle time Ms before session death MinListenerThreads - Min listener threads per listener MaxListenerThreads - Max listener threads per listener MaxListenerThreadIdleMs - Max idle time Ms before listen thread death HTTP1_0_KeepAlive - Boolean for using Keep-Alive with HTTP/1.0 MimeMap - Property file of MIME mappings
public HttpConfiguration configuration()
public void close()
public void stop()
public static void stopAll()
public void join() throws java.lang.InterruptedException
public javax.servlet.Servlet getServlet(java.lang.String name)
name
- the name of the servletpublic java.util.Enumeration getServlets()
public java.util.Enumeration getServletNames()
public javax.servlet.ServletContext getContext(java.lang.String url)
ServletContext
object that
corresponds to a specified URL on the server.
This method allows servlets to gain
access to the resources located at a specified URL and obtain
RequestDispatcher
objects from it.
In security conscious environments, the servlet engine can
return null
for a given URL.
uripath
- a String
specifying the URL for
which you are requesting a ServletContext
objectServletContext
object that
corresponds to the named URLRequestDispatcher
public int getMajorVersion()
public int getMinorVersion()
public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException
path
- URL path of resourcepublic java.io.InputStream getResourceAsStream(java.lang.String path)
path
- URL path of resourcegetResource(String path)
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
path
- URL path of resourcepublic void log(java.lang.String message)
message
- the message to be writtenpublic void log(java.lang.String message, java.lang.Throwable th)
message
- the message to be writtenth
- Throwablepublic void log(java.lang.Exception e, java.lang.String message)
message
- the message to be writtenpublic java.lang.String getRealPath(java.lang.String path)
path
- the real path to be translatedpublic java.lang.String getMimeType(java.lang.String file)
file
- file name whose mime type is requiredpublic java.lang.String getServerInfo()
String
containing at least the
servlet engine name and version numberpublic java.lang.Object getAttribute(java.lang.String name)
name
- the attribute key namepublic java.util.Enumeration getAttributeNames()
Enumeration
of attribute
namesServletContext.getAttribute(java.lang.String)
public void setAttribute(java.lang.String name, java.lang.Object value)
name
- a String
specifying the name
of the attributeobject
- an Object
representing the
attribute to be given the namepublic void removeAttribute(java.lang.String name)
name
- a String
specifying the name
of the attribute to be removedpublic static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |