[轉]Struts2工作原理

來源:互聯網
上載者:User

標籤:cat   let   傳遞   doc   proxy   config   manager   工作   資訊   

Struts2請求響應流程:

 

在struts2的應用中,從使用者請求到伺服器返回相應響應給使用者端的過程中,包含了許多組件如:Controller、ActionProxy、ActionMapping、Configuration Manager、ActionInvocation、Inerceptor、Action、Result等。下面我們來具體看看這些組件有什麼聯絡,它們之間是怎樣在一起工作的。

 

 

(1)  用戶端(Client)向Action發用一個請求(Request)

(2)  Container通過web.xml映射請求,並獲得控制器(Controller)的名字

(3)  容器(Container)調用控制器(StrutsPrepareAndExecuteFilter或FilterDispatcher)。在Struts2.1以前調用FilterDispatcher,Struts2.1以後調用StrutsPrepareAndExecuteFilter

(4)  控制器(Controller)通過ActionMapper獲得Action的資訊

(5)  控制器(Controller)調用ActionProxy

(6)  ActionProxy讀取struts.xml檔案擷取action和interceptor stack的資訊。

(7)  ActionProxy把request請求傳遞給ActionInvocation

(8)  ActionInvocation依次調用action和interceptor

(9)  根據action的配置資訊,產生result

(10) Result資訊返回給ActionInvocation

(11) 產生一個HttpServletResponse響應

(12) 產生的響應行為發送給客服端。

[轉]Struts2工作原理

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.