|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Acme.Serve.Serve
public class Serve
Nested Class Summary | |
---|---|
protected static class |
Serve.AcceptLocaleEnumeration
|
static interface |
Serve.Acceptor
|
static class |
Serve.AcmeSession
Http session support TODO: provide lazy session restoring, it should allow to load classes from wars 1st step it read serialization data and store under session attribute 2nd when the session requested, it tries to deserialize all session attributes considered that all classes available |
protected static class |
Serve.BasicAuthRealm
|
protected static class |
Serve.HttpSessionContextImpl
|
protected static class |
Serve.LocaleWithWeight
|
static class |
Serve.PathTreeDictionary
Class PathTreeDictionary - this class allows to put path elements in format n1/n2/n2[/*.ext] and get match to a pattern and a unmatched tail |
protected static class |
Serve.ServeConfig
|
static class |
Serve.ServeConnection
provides request/response |
static class |
Serve.ServeInputStream
|
static class |
Serve.ServeOutputStream
|
protected class |
Serve.SimpleRequestDispatcher
|
Field Summary | |
---|---|
protected Serve.Acceptor |
acceptor
|
static java.lang.String |
ARG_ACCEPTOR_CLASS
|
static java.lang.String |
ARG_ACCESS_LOG_FMT
|
static java.lang.String |
ARG_ALIASES
|
static java.lang.String |
ARG_BACKLOG
|
static java.lang.String |
ARG_BINDADDRESS
|
static java.lang.String |
ARG_CGI_PATH
|
static java.lang.String |
ARG_ERR
|
static java.lang.String |
ARG_JSP
|
static java.lang.String |
ARG_KEEPALIVE
|
static java.lang.String |
ARG_KEEPALIVE_TIMEOUT
|
static java.lang.String |
ARG_LOG_DIR
|
static java.lang.String |
ARG_LOG_OPTIONS
|
static java.lang.String |
ARG_MAX_ACTIVE_SESSIONS
|
static java.lang.String |
ARG_MAX_CONN_USE
|
static java.lang.String |
ARG_NOHUP
|
static java.lang.String |
ARG_OUT
|
static java.lang.String |
ARG_PORT
|
static java.lang.String |
ARG_REALMS
|
static java.lang.String |
ARG_SERVLETS
|
static java.lang.String |
ARG_SESSION_PERSIST
|
static java.lang.String |
ARG_SESSION_SEED
|
static java.lang.String |
ARG_SESSION_TIMEOUT
|
static java.lang.String |
ARG_THREAD_POOL_SIZE
|
static java.lang.String |
ARG_THROTTLES
|
static java.lang.String |
ARG_WAR
|
static java.lang.String |
ARG_WORK_DIRECTORY
|
java.util.Map |
arguments
|
protected java.lang.Thread |
backgroundThread
|
static java.lang.String |
BGCOLOR
|
protected java.util.List<Serve.ServeConnection> |
connections
|
static java.lang.String |
DEF_LOGENCODING
|
protected static int |
DEF_MAX_CONN_USE
max number of alive connections default value |
protected static int |
DEF_MIN_ACT_SESS
|
static int |
DEF_PORT
|
protected static int |
DEF_SESSION_TIMEOUT
|
protected static int |
DESTROY_TIME_SEC
|
protected int |
expiredIn
|
protected java.lang.reflect.Constructor |
gzipInStreamConstr
|
protected java.lang.String |
hostName
|
protected static int |
HTTP_MAX_HDR_LEN
|
protected boolean |
initialized
|
protected Acme.Serve.Serve.KeepAliveCleaner |
keepAliveCleaner
|
protected java.lang.String |
keepAliveHdrParams
|
protected Serve.PathTreeDictionary |
mappingtable
|
java.util.Properties |
mime
|
protected Serve.PathTreeDictionary |
realms
|
protected Serve.PathTreeDictionary |
registry
|
protected java.lang.ThreadGroup |
serverThreads
|
protected Serve.HttpSessionContextImpl |
sessions
|
protected java.util.concurrent.CountDownLatch |
shutdownLatch
|
protected java.lang.Thread |
ssclThread
|
protected Utils.ThreadPool |
threadPool
|
static java.lang.String |
UTF8
|
Constructor Summary | |
---|---|
Serve()
Default constructor to create TJWS as a bean |
|
Serve(java.util.Map arguments,
java.io.PrintStream logStream)
|
Method Summary | |
---|---|
void |
addDefaultServlets(java.lang.String cgi)
|
void |
addDefaultServlets(java.lang.String cgi,
java.lang.String throttles)
Register a standard set of Servlets, with optional throttles. |
void |
addServlet(java.lang.String urlPat,
javax.servlet.Servlet servlet)
Register a Servlet. |
void |
addServlet(java.lang.String urlPat,
javax.servlet.Servlet servlet,
java.util.Hashtable initParams)
Register a Servlet |
void |
addServlet(java.lang.String urlPat,
java.lang.String className)
|
void |
addServlet(java.lang.String urlPat,
java.lang.String className,
java.util.Hashtable initParams)
Adds a servlet to run |
protected void |
addWarDeployer(java.lang.String deployerFactory,
java.lang.String throttles)
|
protected Serve.Acceptor |
createAcceptor()
|
void |
destroyAllServlets()
|
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
|
javax.servlet.ServletContext |
getContext(java.lang.String uripath)
|
java.lang.String |
getContextPath()
|
java.lang.String |
getInitParameter(java.lang.String param)
|
java.util.Enumeration |
getInitParameterNames()
|
protected int |
getKeepAliveDuration()
|
protected java.lang.String |
getKeepAliveParamStr()
|
int |
getMajorVersion()
|
protected int |
getMaxTimesConnectionUse()
|
java.lang.String |
getMimeType(java.lang.String file)
|
int |
getMinorVersion()
|
javax.servlet.RequestDispatcher |
getNamedDispatcher(java.lang.String name)
|
protected java.io.File |
getPersistentFile()
|
java.lang.String |
getRealPath(java.lang.String path)
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String urlpath)
|
java.net.URL |
getResource(java.lang.String path)
Returns a URL to the resource that is mapped to a specified path. |
java.io.InputStream |
getResourceAsStream(java.lang.String path)
Returns the resource located at the named path as an InputStream object. |
java.util.Set |
getResourcePaths(java.lang.String path)
Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path matches the supplied path argument. |
java.lang.String |
getServerInfo()
|
javax.servlet.Servlet |
getServlet(java.lang.String name)
|
java.lang.String |
getServletContextName()
Returns the name of this web application correponding to this ServletContext as specified in the deployment descriptor for this web application by the display-name element. |
java.util.Enumeration |
getServletNames()
|
java.util.Enumeration |
getServlets()
|
void |
init()
|
protected void |
initMime()
|
protected boolean |
isAccessLogged()
|
protected boolean |
isKeepAlive()
|
protected boolean |
isShowReferer()
|
protected boolean |
isShowUserAgent()
|
void |
log(java.lang.Exception exception,
java.lang.String message)
|
void |
log(java.lang.String message)
|
void |
log(java.lang.String message,
java.lang.Throwable throwable)
|
void |
notifyStop()
Tells the server to stop |
void |
removeAttribute(java.lang.String name)
|
void |
runInBackground()
|
int |
serve()
Launches the server It doesn't exist until server runs, so start it in a dedicated thread. |
protected void |
setAccessLogged()
|
void |
setAttribute(java.lang.String name,
java.lang.Object object)
|
protected void |
setMappingTable(Serve.PathTreeDictionary mappingtable)
|
protected void |
setRealms(Serve.PathTreeDictionary realms)
|
void |
stopBackground()
|
javax.servlet.Servlet |
unloadServlet(javax.servlet.Servlet servlet)
|
void |
unloadServlet(java.lang.String urlPat)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ARG_PORT
public static final java.lang.String ARG_THROTTLES
public static final java.lang.String ARG_SERVLETS
public static final java.lang.String ARG_REALMS
public static final java.lang.String ARG_ALIASES
public static final java.lang.String ARG_BINDADDRESS
public static final java.lang.String ARG_BACKLOG
public static final java.lang.String ARG_CGI_PATH
public static final java.lang.String ARG_ERR
public static final java.lang.String ARG_OUT
public static final java.lang.String ARG_SESSION_TIMEOUT
public static final java.lang.String ARG_LOG_DIR
public static final java.lang.String ARG_LOG_OPTIONS
public static final java.lang.String ARG_NOHUP
public static final java.lang.String ARG_JSP
public static final java.lang.String ARG_WAR
public static final java.lang.String ARG_KEEPALIVE
public static final java.lang.String DEF_LOGENCODING
public static final java.lang.String ARG_KEEPALIVE_TIMEOUT
public static final java.lang.String ARG_MAX_CONN_USE
public static final java.lang.String ARG_SESSION_PERSIST
public static final java.lang.String ARG_MAX_ACTIVE_SESSIONS
public static final java.lang.String ARG_ACCESS_LOG_FMT
public static final java.lang.String ARG_ACCEPTOR_CLASS
public static final java.lang.String ARG_WORK_DIRECTORY
public static final java.lang.String ARG_SESSION_SEED
public static final java.lang.String ARG_THREAD_POOL_SIZE
protected static final int DEF_SESSION_TIMEOUT
protected static final int DEF_MIN_ACT_SESS
protected static final int DESTROY_TIME_SEC
protected static final int HTTP_MAX_HDR_LEN
public static final int DEF_PORT
public static final java.lang.String BGCOLOR
protected static final int DEF_MAX_CONN_USE
public static final java.lang.String UTF8
protected java.lang.String hostName
protected java.lang.String keepAliveHdrParams
protected transient Serve.PathTreeDictionary registry
protected transient Serve.PathTreeDictionary realms
protected transient Serve.PathTreeDictionary mappingtable
protected transient Acme.Serve.Serve.KeepAliveCleaner keepAliveCleaner
protected transient java.lang.ThreadGroup serverThreads
protected transient Utils.ThreadPool threadPool
protected transient java.lang.reflect.Constructor gzipInStreamConstr
protected Serve.HttpSessionContextImpl sessions
protected int expiredIn
public java.util.Map arguments
public java.util.Properties mime
protected java.util.List<Serve.ServeConnection> connections
protected transient Serve.Acceptor acceptor
protected transient java.lang.Thread ssclThread
protected transient boolean initialized
protected java.util.concurrent.CountDownLatch shutdownLatch
protected java.lang.Thread backgroundThread
Constructor Detail |
---|
public Serve(java.util.Map arguments, java.io.PrintStream logStream)
public Serve()
Method Detail |
---|
protected void setAccessLogged()
protected boolean isAccessLogged()
protected boolean isShowReferer()
protected boolean isShowUserAgent()
protected boolean isKeepAlive()
protected int getKeepAliveDuration()
protected java.lang.String getKeepAliveParamStr()
protected int getMaxTimesConnectionUse()
protected void initMime()
public void addServlet(java.lang.String urlPat, java.lang.String className)
public void addServlet(java.lang.String urlPat, java.lang.String className, java.util.Hashtable initParams)
urlPat
- servlet invoker URL patternclassName
- servlet class nameinitParams
- servlet init parameterspublic void addServlet(java.lang.String urlPat, javax.servlet.Servlet servlet)
urlPat
- servlet invoker URL patternservlet
- already instantiated servlet but initpublic void addServlet(java.lang.String urlPat, javax.servlet.Servlet servlet, java.util.Hashtable initParams)
urlPat
- servlet
- initParams
- public javax.servlet.Servlet unloadServlet(javax.servlet.Servlet servlet)
public void unloadServlet(java.lang.String urlPat)
public void addDefaultServlets(java.lang.String cgi)
public void addDefaultServlets(java.lang.String cgi, java.lang.String throttles) throws java.io.IOException
cgi
- whether to run CGI programsthrottles
- filename to read FileServlet throttle settings from, can be null
java.io.IOException
protected void addWarDeployer(java.lang.String deployerFactory, java.lang.String throttles)
protected java.io.File getPersistentFile()
public void runInBackground()
public void stopBackground()
public int serve()
public void init() throws java.io.IOException
java.io.IOException
public void notifyStop() throws java.io.IOException
java.io.IOException
protected Serve.Acceptor createAcceptor() throws java.io.IOException
java.io.IOException
public javax.servlet.Servlet getServlet(java.lang.String name)
getServlet
in interface javax.servlet.ServletContext
public java.util.Enumeration getServlets()
getServlets
in interface javax.servlet.ServletContext
public java.util.Enumeration getServletNames()
getServletNames
in interface javax.servlet.ServletContext
public void destroyAllServlets()
protected void setMappingTable(Serve.PathTreeDictionary mappingtable)
protected void setRealms(Serve.PathTreeDictionary realms)
public void log(java.lang.String message)
log
in interface javax.servlet.ServletContext
public void log(java.lang.String message, java.lang.Throwable throwable)
log
in interface javax.servlet.ServletContext
public void log(java.lang.Exception exception, java.lang.String message)
log
in interface javax.servlet.ServletContext
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface javax.servlet.ServletContext
public java.lang.String getContextPath()
getContextPath
in interface javax.servlet.ServletContext
public java.lang.String getMimeType(java.lang.String file)
getMimeType
in interface javax.servlet.ServletContext
public java.lang.String getServerInfo()
getServerInfo
in interface javax.servlet.ServletContext
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.servlet.ServletContext
public void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletContext
public void setAttribute(java.lang.String name, java.lang.Object object)
setAttribute
in interface javax.servlet.ServletContext
public java.util.Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletContext
public javax.servlet.ServletContext getContext(java.lang.String uripath)
getContext
in interface javax.servlet.ServletContext
public int getMajorVersion()
getMajorVersion
in interface javax.servlet.ServletContext
public int getMinorVersion()
getMinorVersion
in interface javax.servlet.ServletContext
public java.util.Set getResourcePaths(java.lang.String path)
getResourcePaths
in interface javax.servlet.ServletContext
the
- -
partial path used to match the resources, which must start with a /
public java.lang.String getServletContextName()
getServletContextName
in interface javax.servlet.ServletContext
public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException
.war
file.
The servlet container must implement the URL handlers and URLConnection
objects that are necessary to access the resource.
This method returns null
if no resource is mapped to the pathname.
Some containers may allow writing to the URL returned by this method using the methods of the URL class.
The resource content is returned directly, so be aware that requesting a .jsp
page returns the JSP source code. Use a
RequestDispatcher
instead to include results of an execution.
This method has a different purpose than java.lang.Class.getResource
, which looks up resources based on a class loader. This method does
not use class loaders.
getResource
in interface javax.servlet.ServletContext
path
- a String
specifying the path to the resource
null
if there is no resource at that path
java.net.MalformedURLException
- if the pathname is not given in the correct formpublic java.io.InputStream getResourceAsStream(java.lang.String path)
InputStream
object.
The data in the InputStream
can be of any type or length. The path must be specified according to the rules given in
getResource
. This method returns null
if no resource exists at the specified path.
Meta-information such as content length and content type that is available via getResource
method is lost when using this method.
The servlet container must implement the URL handlers and URLConnection
objects necessary to access the resource.
This method is different from java.lang.Class.getResourceAsStream
, which uses a class loader. This method allows servlet containers to
make a resource available to a servlet from any location, without using a class loader.
getResourceAsStream
in interface javax.servlet.ServletContext
path
- a String
specifying the path to the resource
InputStream
returned to the servlet, or null
if no resource exists at the specified pathpublic javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String urlpath)
getRequestDispatcher
in interface javax.servlet.ServletContext
public java.lang.String getInitParameter(java.lang.String param)
getInitParameter
in interface javax.servlet.ServletContext
public java.util.Enumeration getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletContext
public javax.servlet.RequestDispatcher getNamedDispatcher(java.lang.String name)
getNamedDispatcher
in interface javax.servlet.ServletContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |