Struts2 아키텍처..

아래의 이미지는 Strut2의 아키텍처이고, 이 구조에서 사용자가 요청을 하면,

1. Request를 처리할 액션(Action)을 ActionMaper에서 찾아서 실행한다
2. Request가 처리되면서 Action의 Interceptor 전,후 처리를 한다.
3. Response를 한다. 

사용자 삽입 이미지

In the diagram, an initial request goes to the Servlet container (such as Jetty or Resin) which is passed through a standard filter chain. The chain includes the (optional) ActionContextCleanUp filter, which is useful when integrating technologies such as SiteMesh Plugin. Next, the required FilterDispatcher is called, which in turn consults the ActionMapper to determine if the request should invoke an action.

If the ActionMapper determines that an Action should be invoked, the FilterDispatcher delegates control to the ActionProxy. The ActionProxy consults the framework Configuration Files manager (initialized from the struts.xml file). Next, the ActionProxy creates an ActionInvocation, which is responsible for the command pattern implementation. This includes invoking any Interceptors (the before clause) in advance of invoking the Action itself.

Once the Action returns, the ActionInvocation is responsible for looking up the proper result associated with the Action result code mapped in struts.xml. The result is then executed, which often (but not always, as is the case for Action Chaining) involves a template written in JSP or FreeMarker to be rendered. While rendering, the templates can use the Struts Tags provided by the framework. Some of those components will work with the ActionMapper to render proper URLs for additional requests.

<!–[if !vml]–><!–[endif]–>

All
objects in this architecture (Actions, Results, Interceptors,
and so forth) are created by an ObjectFactory.
This ObjectFactory is pluggable. We can provide our own ObjectFactory for any
reason that requires knowing when objects in the framework are created. A
popular ObjectFactory implementation uses Spring as provided by the Spring
Plugin
.

Interceptors are executed again (in reverse order, calling the after clause). Finally, the response returns through the filters configured in the web.xml. If the ActionContextCleanUp filter is present, the FilterDispatcher will not clean up the ThreadLocal ActionContext. If the ActionContextCleanUp filter is
not present, the FilterDispatcher will cleanup all ThreadLocals.

답글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.