|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.filterchain.FilterAdapter
org.glassfish.grizzly.web.WebFilter<T>
public class WebFilter<T extends WebFilterConfig>
The WebFilter is the extry point when writing Web application build on Grizzly. You can create a WebFilter by simply doing:
Transport transport = TransportFactory.getInstance().createTCPTransport();
WebFilterConfig webConfig = new WebFilterConfig();
webConfig.setAdapter(adapter);
webConfig.setDisplayConfiguration(true);
WebFilter webFilter = new WebFilter("MyHtttpServer", webConfig);
webFilter.enableMonitoring();
transport.getFilterChain().add(new TransportFilter());
transport.getFilterChain().add(webFilter);
try {
webFilter.initialize();
transport.bind(PORT);
transport.start();
} catch (Exception ex) {
...
}
| Field Summary | |
|---|---|
protected LinkedTransferQueue<ProcessorTask> |
activeProcessorTasks
List of active ProcessorTask. |
protected T |
config
|
protected RequestGroupInfo |
globalRequestProcessor
Monitoring object used to store information. |
protected ObjectName |
globalRequestProcessorName
|
protected WebFilterJMXManager |
jmxManager
|
protected static Logger |
logger
The logger used by the grizzly classes. |
protected String |
name
|
protected LinkedTransferQueue<ProcessorTask> |
processorTasks
ConcurrentLinkedQueue used as an object pool. |
protected ObjectName |
processorWorkerThreadName
|
protected static StringManager |
sm
The string manager for this package. |
protected ThreadPoolStatistic |
threadPoolStat
Placeholder for ExecutorService statistic. |
| Constructor Summary | |
|---|---|
WebFilter()
Create the WebFilter. |
|
WebFilter(String name)
Create the WebFilter with the specific name. |
|
WebFilter(String name,
T config)
Create the WebFilter with the specific name. |
|
| Method Summary | |
|---|---|
protected void |
configureProcessorTask(ProcessorTask processorTask,
FilterChainContext context)
Configure ProcessorTask. |
void |
disableMonitoring()
Disable gathering of monitoring data. |
protected void |
disableThreadPoolStats()
Removes ThreadPoolStatistic from every
ExecutorService, when monitoring has been turned off. |
protected void |
displayConfiguration()
Display the Grizzly configuration parameters. |
void |
enableMonitoring()
Enable gathering of monitoring data. |
protected void |
enableThreadPoolStats()
Injects ThreadPoolStatistic into every
ExecutorService, for monitoring purposes. |
LinkedTransferQueue<ProcessorTask> |
getActiveProcessorTasks()
|
T |
getConfig()
|
WebFilterJMXManager |
getJmxManager()
|
KeepAliveStats |
getKeepAliveStats()
|
String |
getName()
|
ProcessorTask |
getProcessorTask(FilterChainContext ctx)
Return a ProcessorTask from the pool. |
RequestGroupInfo |
getRequestGroupInfo()
|
ThreadPoolStatistic |
getThreadPoolStatistic()
|
NextAction |
handleAccept(FilterChainContext ctx,
NextAction nextAction)
|
NextAction |
handleClose(FilterChainContext ctx,
NextAction nextAction)
|
NextAction |
handleRead(FilterChainContext ctx,
NextAction nextAction)
|
void |
initialize()
initialized the endpoint by creating the ServerScoketChannel
and by initializing the server socket. |
protected ProcessorTask |
initializeProcessorTask(ProcessorTask task)
|
protected void |
initMonitoringLevel()
Initialize the ThreadPoolStat instance. |
protected void |
initProcessorTasks(int size)
Create a pool of ProcessorTask |
static Logger |
logger()
Return the logger used by the Grizzly classes. |
protected ProcessorTask |
newProcessorTask(boolean initialize)
Create ProcessorTask objects and configure it to be ready
to proceed request. |
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
|
protected void |
rampUpProcessorTasks()
Initialize ProcessorTask |
void |
registerComponents()
Register JMX components supported by this WebFilter. |
void |
release()
|
void |
returnTask(Task task)
Returns the Task object to the pool. |
void |
setConfig(T config)
|
void |
setJmxManager(WebFilterJMXManager jmxManager)
|
static void |
setLogger(Logger l)
Set the logger used by this instance. |
void |
setName(String name)
|
void |
setRequestProcessor(RequestGroupInfo requestProcessor)
|
protected void |
unregisterComponents()
Unregister JMX components supported by this WebFilter. |
| Methods inherited from class org.glassfish.grizzly.filterchain.FilterAdapter |
|---|
exceptionOccurred, getFilterChain, getIndex, handleConnect, handleWrite, isIndexable, postAccept, postClose, postConnect, postRead, postWrite, setIndex |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Logger logger
protected static final StringManager sm
protected String name
protected T extends WebFilterConfig config
protected WebFilterJMXManager jmxManager
protected ThreadPoolStatistic threadPoolStat
ExecutorService statistic.
protected LinkedTransferQueue<ProcessorTask> processorTasks
ConcurrentLinkedQueue used as an object pool.
If the list becomes empty, new ProcessorTask will be
automatically added to the list.
protected LinkedTransferQueue<ProcessorTask> activeProcessorTasks
ProcessorTask.
protected RequestGroupInfo globalRequestProcessor
protected ObjectName globalRequestProcessorName
protected ObjectName processorWorkerThreadName
| Constructor Detail |
|---|
public WebFilter()
WebFilter.
public WebFilter(String name)
WebFilter with the specific name.
public WebFilter(String name,
T config)
WebFilter with the specific name.
| Method Detail |
|---|
public NextAction handleRead(FilterChainContext ctx,
NextAction nextAction)
throws IOException
handleRead in interface FilterhandleRead in class FilterAdapterIOException
public NextAction handleAccept(FilterChainContext ctx,
NextAction nextAction)
throws IOException
handleAccept in interface FilterhandleAccept in class FilterAdapterIOException
public NextAction handleClose(FilterChainContext ctx,
NextAction nextAction)
throws IOException
handleClose in interface FilterhandleClose in class FilterAdapterIOException
protected void configureProcessorTask(ProcessorTask processorTask,
FilterChainContext context)
ProcessorTask.
public String getName()
public void setName(String name)
public T getConfig()
public void setConfig(T config)
public WebFilterJMXManager getJmxManager()
public void setJmxManager(WebFilterJMXManager jmxManager)
public ThreadPoolStatistic getThreadPoolStatistic()
protected void enableThreadPoolStats()
ThreadPoolStatistic into every
ExecutorService, for monitoring purposes.
protected void disableThreadPoolStats()
ThreadPoolStatistic from every
ExecutorService, when monitoring has been turned off.
protected void initProcessorTasks(int size)
ProcessorTask
protected void rampUpProcessorTasks()
ProcessorTask
protected ProcessorTask newProcessorTask(boolean initialize)
ProcessorTask objects and configure it to be ready
to proceed request.
protected ProcessorTask initializeProcessorTask(ProcessorTask task)
public ProcessorTask getProcessorTask(FilterChainContext ctx)
ProcessorTask from the pool. If the pool is empty,
create a new instance.
public void initialize()
throws IOException
ServerScoketChannel
and by initializing the server socket.
IOExceptionpublic void release()
public void returnTask(Task task)
Task object to the pool.
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
preRegister in interface MBeanRegistrationExceptionpublic void postRegister(Boolean registrationDone)
postRegister in interface MBeanRegistration
public void preDeregister()
throws Exception
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
postDeregister in interface MBeanRegistrationpublic void enableMonitoring()
public void disableMonitoring()
public KeepAliveStats getKeepAliveStats()
public void registerComponents()
WebFilter. This
include FileCache, RequestInfo, KeepAliveCountManager
and StatsThreadPool. The Management.registerComponent(java.lang.Object, javax.management.ObjectName, java.lang.String)
will be invoked during the registration process.
protected void unregisterComponents()
WebFilter. This
include FileCache, RequestInfo, KeepAliveCountManager
, StatsThreadPool and ProcessorTask.
The Management.unregisterComponent(javax.management.ObjectName) will be invoked during the
registration process.
public RequestGroupInfo getRequestGroupInfo()
public void setRequestProcessor(RequestGroupInfo requestProcessor)
protected void initMonitoringLevel()
ThreadPoolStat instance.
public static void setLogger(Logger l)
public static Logger logger()
protected void displayConfiguration()
public LinkedTransferQueue<ProcessorTask> getActiveProcessorTasks()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||