Java Reference
In-Depth Information
13.6
The Stripes Life Cycle in More Detail
This section contains more nitty-gritty details about what happens dur-
ing the Stripes life-cycle stages. These details are good to know when
you're tapping deep into Stripes, but feel free to move on and come back
later if you find that all this information is a little too much to absorb
in one sitting.
So, here's the skinny. When a request arrives, the first thing Stripes
does is create the action bean context from the factory by calling get-
ContextInstance ( ) on the implementation of ActionBeanContextFactory (the
default is DefaultActionBeanContextFactory ). The servlet context is set on
the action bean context, which is in turn set on the execution context.
Next, Stripes goes through each life-cycle stage.
RequestInit
Nothing happens here. This stage exists solely to make it easy for inter-
ceptors to do something before the request-handling starts.
ActionBeanResolution
From the request URL, Stripes determines the corresponding action
bean. The work is done by the getActionBean ( ) method of the Action-
Resolver implementation (the default is NameBasedActionResolver ). Bind-
ings defined with @UrlBinding and @HandlesEvent have priority over nam-
ing conventions. Once the action bean has been resolved, it is set as
a request attribute with the name actionBean , a constant defined in
StripesConstants.REQ_ATTR_ACTION_BEAN . The action bean is also set on
the execution context.
HandlerResolution
The action bean's targeted event handler is resolved from the URL.
First, the getEventName ( ) method is called on the ActionResolver imple-
mentation (the default is defined in AnnotatedClassActionResolver ). 2 This
method looks for the event name in the URL using the rules we saw
on page 292 . Internally, Stripes also looks for the event name in the
"__stripes_event_name" request attribute (defined in StripesConstants.REQ_
ATTR_EVENT_NAME ).
2. To be clear, the default ActionResolver is NameBasedAnnotationResolver , but it extends
AnnotatedClassActionResolver , and that's where getEventName ( ) is implemented.
 
 
 
Search WWH ::




Custom Search