|
|||||||||
| Home >> All >> org >> apache >> [ tapestry overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.tapestry
Class ApplicationServlet

java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.tapestry.ApplicationServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class ApplicationServlet
- extends javax.servlet.http.HttpServlet
Links a servlet container with a Tapestry application. The servlet has some responsibilities related to bootstrapping the application (in terms of logging, reading the specification, etc.). It is also responsible for creating or locating the IEngine and delegating incoming requests to it.
The servlet init parameter
org.apache.tapestry.specification-path
should be set to the complete resource path (within the classpath)
to the application specification, i.e.,
/com/foo/bar/MyApp.application.
In some servlet containers (notably
WebLogic)
it is necessary to invoke HttpSession#setAttribute(String,Object)
in order to force a persistent value to be replicated to the other
servers in the cluster. Tapestry applications usually only have a single
persistent value, the engine. For persistence to
work in such an environment, the
JVM system property org.apache.tapestry.store-engine
must be set to true. This will force the application
servlet to restore the engine into the HttpSession at the
end of each request cycle.
As of release 1.0.1, it is no longer necessary for a HttpSession
to be created on the first request cycle. Instead, the HttpSession is created
as needed by the IEngine ... that is, when a visit object is created,
or when persistent page state is required. Otherwise, for sessionless requests,
an IEngine from a Pool is used. Additional work must be done
so that the IEngine can change locale without forcing
the creation of a session; this involves the servlet and the engine storing
locale information in a javax.servlet.http.Cookie.
As of release 3.1, this servlet will also create a HiveMind Registry and manage it.
| Field Summary | |
static com.cortexeb.tools.clover.d |
__CLOVER_3_0
|
private org.apache.hivemind.Registry |
_registry
|
private org.apache.tapestry.services.RequestServicer |
_requestServicer
|
private org.apache.hivemind.ClassResolver |
_resolver
|
private org.apache.tapestry.spec.IApplicationSpecification |
_specification
The application specification, which is read once and kept in memory thereafter. |
static java.lang.String |
LOCALE_COOKIE_NAME
Name of the cookie written to the client web browser to identify the locale. |
private static org.apache.commons.logging.Log |
LOG
|
| Fields inherited from class javax.servlet.http.HttpServlet |
|
| Fields inherited from class javax.servlet.GenericServlet |
|
| Constructor Summary | |
ApplicationServlet()
|
|
| Method Summary | |
protected void |
close(java.io.InputStream stream)
Closes the stream, ignoring any exceptions. |
protected void |
constructRegistry()
Invoked from init(ServletConfig) 55 to construct the Registry to
be used by the application. |
protected org.apache.hivemind.ClassResolver |
createClassResolver()
Invoked from init(ServletConfig) 55 to create a resource resolver
for the servlet (which will utlimately be shared and used through the
application). |
void |
destroy()
Shuts down the registry (if it exists). |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Invokes doService(HttpServletRequest, HttpServletResponse) 55 . |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Invokes doService(HttpServletRequest, HttpServletResponse) 55 . |
protected void |
doService(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles the GET and POST requests. |
org.apache.tapestry.spec.IApplicationSpecification |
getApplicationSpecification()
Deprecated. Use RequestContext.getApplicationSpecification()> RequestContext.getApplicationSpecification() 55 instead. |
org.apache.hivemind.ClassResolver |
getClassResolver()
Returns a resource resolver that can access classes and resources related to the current web application context. |
org.apache.hivemind.Registry |
getRegistry()
Returns the Registry used by the application. |
void |
init(javax.servlet.ServletConfig config)
Reads the application specification when the servlet is first initialized. |
protected void |
initializeApplication()
Invoked from init(ServletConfig) 55 , after the registry has
been constructed, to bootstrap the application via the
tapestry.MasterApplicationInitializer service. |
protected void |
show(java.lang.Exception ex)
|
static void |
writeLocaleCookie(java.util.Locale locale,
IEngine engine,
org.apache.tapestry.request.RequestContext cycle)
Invoked from the engine, just prior to starting to render a response, when the locale has changed. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, 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 |
__CLOVER_3_0
public static com.cortexeb.tools.clover.d __CLOVER_3_0
LOG
private static final org.apache.commons.logging.Log LOG
LOCALE_COOKIE_NAME
public static final java.lang.String LOCALE_COOKIE_NAME
- Name of the cookie written to the client web browser to
identify the locale.
- See Also:
- Constant Field Values
_specification
private org.apache.tapestry.spec.IApplicationSpecification _specification
- The application specification, which is read once and kept in memory
thereafter.
_resolver
private org.apache.hivemind.ClassResolver _resolver
- Since:
- 2.3
_registry
private org.apache.hivemind.Registry _registry
- Since:
- 3.1
_requestServicer
private org.apache.tapestry.services.RequestServicer _requestServicer
- Since:
- 3.1
| Constructor Detail |
ApplicationServlet
public ApplicationServlet()
| Method Detail |
doGet
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
- Invokes
doService(HttpServletRequest, HttpServletResponse)55 .- Since:
- 1.0.6
doService
protected void doService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
- Handles the GET and POST requests. Performs the following:
- Construct a org.apache.tapestry.request.RequestContext
- Invoke
#getEngine(RequestContext)to get or create the IEngine - Invoke
IEngine.service(RequestContext)55 on the application
show
protected void show(java.lang.Exception ex)
doPost
public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
- Invokes
doService(HttpServletRequest, HttpServletResponse)55 .
getApplicationSpecification
public org.apache.tapestry.spec.IApplicationSpecification getApplicationSpecification()
- Deprecated. Use RequestContext.getApplicationSpecification()>
RequestContext.getApplicationSpecification()55 instead.- Returns the application specification, which is read by the
init(ServletConfig)55 method. - Returns the application specification, which is read by the
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
- Reads the application specification when the servlet is
first initialized. All engine instances
will have access to the specification via the servlet.
createClassResolver
protected org.apache.hivemind.ClassResolver createClassResolver() throws javax.servlet.ServletException
- Invoked from
init(ServletConfig)55 to create a resource resolver for the servlet (which will utlimately be shared and used through the application).This implementation constructs a
DefaultResourceResolver, subclasses may provide a different implementation.- Since:
- 2.3
close
protected void close(java.io.InputStream stream)
- Closes the stream, ignoring any exceptions.
writeLocaleCookie
public static void writeLocaleCookie(java.util.Locale locale, IEngine engine, org.apache.tapestry.request.RequestContext cycle)
- Invoked from the engine, just prior to starting to
render a response, when the locale has changed. The servlet writes a
javax.servlet.http.Cookie so that, on subsequent request cycles, an engine localized
to the selected locale is chosen.
At this time, the cookie is not persistent. That may change in subsequent releases.
- Since:
- 1.0.1
getClassResolver
public org.apache.hivemind.ClassResolver getClassResolver()
- Returns a resource resolver that can access classes and resources related
to the current web application context. Relies on
Thread.getContextClassLoader()>
Thread.getContextClassLoader()55 , which is set by most modern servlet containers.- Since:
- 2.3
constructRegistry
protected void constructRegistry()
- Invoked from
init(ServletConfig)55 to construct the Registry to be used by the application.- Since:
- 3.1
initializeApplication
protected void initializeApplication()
- Invoked from
init(ServletConfig)55 , after the registry has been constructed, to bootstrap the application via thetapestry.MasterApplicationInitializerservice.
getRegistry
public org.apache.hivemind.Registry getRegistry()
- Returns the Registry used by the application.
- Since:
- 3.1
destroy
public void destroy()
- Shuts down the registry (if it exists).
- Since:
- 3.1
|
|||||||||
| Home >> All >> org >> apache >> [ tapestry overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC