|
PageMixer API - 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--jp.ne.dti.lares.foozy.pagemixer.servlet.PageServlet
Base Servlet class.
This provides template to combine modules shown below for response page renderring on PageMixer framework:
ContextFactory
LocaleFactory
ForwardStrategy
FilterFactory
PageFactory
LocatorFactory
ProducerFactory
These modules allow you to customize renderring procedure with minimum work.
For example, when you want to read HTML page source not from file but from DB, what you should do are:
Locator
implementation to read HTML source in from DB
LocatorFactory
implementation to use
your custom Locator
LocatorFactory
with PageServlet
You can use your custom modules by
(1)defining class derived from this,
which specifies your custom modules
as parameters of base class constructor, or
(2)specifing class name of them in deployment descriptor
as "servlet.contextFactory"
,
"servlet.localeFactory"
,
"servlet.forwardStrategy"
,
"servlet.filterFactory"
,
"servlet.pageFactory"
,
"servlet.locatorFactory"
and/or
"servlet.producerFactory"
'init-param' of Servlet.
This template class provides mechanism to re-use
Filter
on the thread on which it is created.
This reduces cost to create Filter
.
To reduce memory consumption,
this invokes
expiration method
per specified millisec interval
,
if it is specified and grater than 0.
System.currentTimeMills()
-
interval
is passed to
expiration method
as limit.
Field Summary | |
static java.lang.String |
PARAM_CONTEXT_FACTORY
Name of servlet init-param to create " ContextFactory ". |
static java.lang.String |
PARAM_EXPIRE_INTERVAL
Name of servlet init-param of expiration interval(millisec). |
static java.lang.String |
PARAM_FILTER_FACTORY
Name of servlet init-param to create " FilterFactory ". |
static java.lang.String |
PARAM_FORWARD_STRATEGY
Name of servlet init-param to create " ForwardStrategy ". |
static java.lang.String |
PARAM_LOCALE_FACTORY
Name of servlet init-param to create " LocaleFactory ". |
static java.lang.String |
PARAM_LOCATOR_FACTORY
Name of servlet init-param to create " LocatorFactory ". |
static java.lang.String |
PARAM_PAGE_FACTORY
Name of servlet init-param to create " PageFactory ". |
static java.lang.String |
PARAM_PRODUCER_FACTORY
Name of servlet init-param to create " ProducerFactory ". |
Constructor Summary | |
PageServlet(ContextFactory contextFactory,
LocaleFactory localeFactory,
ForwardStrategy forwardStrategy,
FilterFactory filterFactory,
PageFactory pageFactory,
LocatorFactory locatorFactory,
ProducerFactory producerFactory)
Construct. |
Method Summary | |
void |
destroy()
Finalize. |
protected void |
doAction(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Template of servlet process to render response page or forward control. |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Respond to "GET" request from client. |
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Respond to "POST" request from client. |
void |
init()
Initialize. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
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 PARAM_CONTEXT_FACTORY
ContextFactory
".
This has value "servlet.contextFactory
".
public static final java.lang.String PARAM_LOCALE_FACTORY
LocaleFactory
".
This has value "servlet.localeFactory
".
public static final java.lang.String PARAM_FORWARD_STRATEGY
ForwardStrategy
".
This has value "servlet.forwardStrategy
".
public static final java.lang.String PARAM_FILTER_FACTORY
FilterFactory
".
This has value "servlet.filterFactory
".
public static final java.lang.String PARAM_PAGE_FACTORY
PageFactory
".
This has value "servlet.pageFactory
".
public static final java.lang.String PARAM_LOCATOR_FACTORY
LocatorFactory
".
This has value "servlet.locatorFactory
".
public static final java.lang.String PARAM_PRODUCER_FACTORY
ProducerFactory
".
This has value "servlet.producerFactory
".
public static final java.lang.String PARAM_EXPIRE_INTERVAL
This has value "servlet.expireInterval
".
Constructor Detail |
public PageServlet(ContextFactory contextFactory, LocaleFactory localeFactory, ForwardStrategy forwardStrategy, FilterFactory filterFactory, PageFactory pageFactory, LocatorFactory locatorFactory, ProducerFactory producerFactory)
This class uses class(es) specified in deployment descriptor, event though construction parameter corresponded to it is not null.
Earlier version implementation had different priority policy: it used construction parameter rather than one specified in deployment descriptor.
contextFactory
- to create ConsumerContextlocaleFactory
- to create LocaleforwardStrategy
- to decide control forwardingfilterFactory
- to create FilterpageFactory
- to create PagelocatorFactory
- to create LocatorproducerFactory
- to create Producer.FactoryMethod Detail |
protected final void doAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
context
by
ContextFactory#create()
LocaleFactory#create()
PageEntry
by
PageEntryFactory#create()
or PageEntryFactory#create()
,
with above path and locale
PageEntry
context
by
encoding key
for parameter decoding, if above encoding is not null
ForwardStrategy.forwards(ConsumerContext)
PageEntry
into HttpServletResponse
Filter
by
Filter.Factory
Token
stream produced by
Producer
in
PageEntry
by above
Filter
This implementation recognizes fail of
PageEntryFactory
invocations as "404"(Not Found) error.
In this case, this invokes
HttpServletResponse#sendError()
and returns.
request
- of this requestresponse
- of this requestpublic void init() throws javax.servlet.ServletException
For each values specified at construction time, this does in steps shown below.
Because PageFactory
is abstract class,
creation fail of this causes servlet initialization error.
This invokes:
ContextFactory.setup(HttpServlet)
LocaleFactory.setup(HttpServlet)
ForwardStrategy.setup(HttpServlet)
FilterFactory.setup(HttpServlet)
PageFactory.setup(HttpServlet)
LocatorFactory.setup(HttpServlet)
ProducerFactory.setup(HttpServlet)
Then, this create PageEntryFactory
.
init
in class javax.servlet.GenericServlet
public void destroy()
This invokes:
ContextFactory.cleanup(HttpServlet)
LocaleFactory.cleanup(HttpServlet)
ForwardStrategy.cleanup(HttpServlet)
FilterFactory.cleanup(HttpServlet)
PageFactory.cleanup(HttpServlet)
LocatorFactory.cleanup(HttpServlet)
ProducerFactory.cleanup(HttpServlet)
destroy
in class javax.servlet.GenericServlet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
This invokes
doAction(HttpServletRequest, HttpServletResponse)
.
doGet
in class javax.servlet.http.HttpServlet
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
This invokes
doAction(HttpServletRequest, HttpServletResponse)
.
doPost
in class javax.servlet.http.HttpServlet
|
PageMixer API - 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |