Hessian—binary web service protocol
- 2019 年 10 月 6 日
- 筆記
在系統工程開發過程中,經常會用到遠程介面調用,今天給Hessian,一套輕量級遠程調用框架,相比WebService,Hessian更簡單、快捷!
含義
The Hessian binary web service protocol makes web services usable without requiring a large framework, and without learning yet another alphabet soup of protocols. Because it is a binary protocol, it is well-suited to sending binary data without any need to extend the protocol with attachments.
上面是官網給的Hessian的定義,基於二進位消息能夠擴展到其他非java的語言中。同時是基於Http協議傳輸的,對於數據包比較大的情況下比較友好,他的參數和返回值都需要實現Serializble介面。
hessian的執行流程
Hessian有著不同語言的版本,今天介紹下Hessian在springmvc中的工作流程。
Hessian通過servlet提供遠程服務,需要將匹配某個模式的請求映射到Hessian服務,Spring的DispatcherServlet可以完成該功能,DispatcherServlcet將匹配模式的請求轉發到Hessian服務。Hessian的server端提供一個servlet基類,用來處理髮送過來的請求,而Hessian這個RPC完全使用動態代理來實現,推薦採用面向介面編程,因此,Hessian服務建議通過介面暴露。
