Package com.qwazr.server
Class GenericServer
java.lang.Object
com.qwazr.server.GenericServer
- All Implemented Interfaces:
java.lang.AutoCloseable
public class GenericServer
extends java.lang.Object
implements java.lang.AutoCloseable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
GenericServer.IdentityManagerProvider
static interface
GenericServer.Listener
static interface
GenericServer.SessionPersistenceManagerProvider
-
Method Summary
Modifier and Type Method Description void
close()
java.util.Collection<ConnectorStatisticsMXBean>
getConnectorsStatistics()
static <T> T
getContextAttribute(javax.servlet.ServletContext context, java.lang.Class<T> cls)
Returns an attribute where the name of the attribute in the name of the classstatic <T> T
getContextAttribute(javax.servlet.ServletContext context, java.lang.String name, java.lang.Class<T> type)
Returns the named attribute.static GenericServerBuilder
of(ServerConfiguration config)
static GenericServerBuilder
of(ServerConfiguration config, java.util.concurrent.ExecutorService executorService)
static GenericServerBuilder
of(ServerConfiguration config, java.util.concurrent.ExecutorService executorService, java.lang.ClassLoader classLoader)
static GenericServerBuilder
of(ServerConfiguration config, java.util.concurrent.ExecutorService executorService, java.lang.ClassLoader classLoader, com.qwazr.utils.reflection.ConstructorParameters constructorParameters)
void
start(boolean shutdownHook)
Call this method to start the servervoid
stopAll()
Deprecated.
-
Method Details
-
getContextAttribute
public static <T> T getContextAttribute(javax.servlet.ServletContext context, java.lang.String name, java.lang.Class<T> type)Returns the named attribute. The method checks the type of the object.- Type Parameters:
T
- the expected object- Parameters:
context
- the context to requestname
- the name of the attributetype
- the expected type- Returns:
- the expected object
-
getContextAttribute
public static <T> T getContextAttribute(javax.servlet.ServletContext context, java.lang.Class<T> cls)Returns an attribute where the name of the attribute in the name of the class- Type Parameters:
T
- the expected object- Parameters:
context
- the context to requestcls
- the type of the object- Returns:
- the expected object
-
stopAll
@Deprecated public void stopAll()Deprecated.Uses close() -
close
public void close()- Specified by:
close
in interfacejava.lang.AutoCloseable
-
start
public final void start(boolean shutdownHook) throws java.io.IOException, javax.servlet.ServletException, javax.management.JMExceptionCall this method to start the server- Parameters:
shutdownHook
- pass true to install the StopAll method as Runtime shutdown hook- Throws:
java.io.IOException
- if any IO error occursjavax.servlet.ServletException
- if the servlet configuration failedjavax.management.JMException
- if any JMX error occurs
-
getConnectorsStatistics
-
of
public static GenericServerBuilder of(ServerConfiguration config, java.util.concurrent.ExecutorService executorService, java.lang.ClassLoader classLoader, com.qwazr.utils.reflection.ConstructorParameters constructorParameters) -
of
public static GenericServerBuilder of(ServerConfiguration config, java.util.concurrent.ExecutorService executorService, java.lang.ClassLoader classLoader) -
of
public static GenericServerBuilder of(ServerConfiguration config, java.util.concurrent.ExecutorService executorService) -
of
-