jollen.org

Jollen 的 Blog
Jollen's email: jollen # jollen.org
more:  Jollen's Training

嵌入式Linux的Web Application Framework

.作者:jollen/
.日期:September 19, 2006 9:37 PM


今天在survey與初步build所謂的"a web application framework in an embedded Linux system",這是8月份在LinuxDevices.com的一篇文章介紹的題目。Web-application或者是"Application Web化"是近幾年來非常明顯的一個趨勢,思考 Embedded System 的 Web Application (Embedded Web Applications ?) 是一個頗為有趣的主題,也有許多的 paper 在討論這個題目。

目前嵌入式Linux上的web application與desktop (PC) 的web application並無太大差異,許多文件也是只以"embedded web server"做為核心的出發點,這篇在linuxdevices.com上看到的文章也是。不過這篇文章倒值得對這個題目有興趣的朋友一讀。

作者開場白就點出了這個題目的主軸:

As devices are increasingly more networked, an embedded web server is becoming a standard way for users to interact with and configure an embedded device using a standard web browser.

對於web application in an embedded linux system的研究範疇,就 Jollen 目前的認知來講,可以分成幾個層級來探討:

(1) 低階做法:設計一個 "monolithic" 應用程式來處理 HTTP 並輸出 HTML,例如在 Jollen 的 "Embedded Linux 嵌入式系統原理與實務 ,3e" 書上給的 web.c (a dirty embedded web server) 範例。
(2) 中階做法:建構 embedded web server 的 root filesystem,例如加入 thttpd 的使用,如此一來便能透過 CGI 規範來設計 web application;thttpd 的 CGI 大多以 C 語言撰寫。
(3) 高階做法:建構 "framework" 來設計與實作 web application,linuxdevices.com 上的這篇文章就是在討論這種做法。

實作上,要建構 "web appication framework" 的基礎平臺 (aka root filesystem),能選擇的 open source 解決方案其實很多 (各種排列組合);不過 Jollen 把此文作者建議的 "components" for web appication framework 實際 build 後,發現還真的不賴說,大家可以試試!以下是該作者建議的 solution:

1. Web Server: Cherokee (1MiB)
2. Model: SQLite (290KB)
3. View: Clearsilver (170KB)
4. Controller: Python (2-3MB)

看到 Model/View/Controller 了!這就是 "framework" 的重點-以MVC模式設計與實作web applications!


Figure-source (引用自): linuxdevices.com, http://www.linuxdevices.com/articles/AT5550934609.html.

這個Cherokee也是一個open source的embedded web server,試用後覺得還不賴,可以列入 thttpd/boa外的其它選擇。Cherokee還真的挺強大的,讚讚讚,列入10月份Jollen-Kit! Builder Training Edition的更新roadmap,與所有學員分享!

節錄 Cherokee 的介紹:

Cherokee is a very fast, flexible and easy to configure Web Server. It supports the widespread technologies nowadays: FastCGI, SCGI, PHP, CGI, TLS and SSL encrypted connections, Virtual hosts, Authentication, on the fly encoding, Apache compatible log files, and much more.

目前 Jollen 把基本的環境 build 好了,10月份的Jollen-Kit! Builder Training Edition也會加入,目前則是還在拼湊demo架構 (應用程式) 中。因為 Python 初學中,程式寫的哩哩辣辣的 (why not PHP >_<")。

* "Must enable us to implement a clean MVC type architecture," I think this is good.
* "Must support a high level language like python for rapid development," Good but I'd like to think more.

Tags:

純手工打造說明:技術專欄文章為 Jollen 原創,內容皆為人工撰寫,無 AI 生成。轉載請註明出處與作者,並全文引用。轉載時請在文章開頭或結尾明顯處註明「本文出處:https://www.jollen.org,已取得原作者同意並授權使用。」
訂閱電子報:不定期 Jollen's Blog 精選文章隨 Moko365 電子報寄送;請透過 Moko365 電子報訂閱(可隨時取消)。

Copyright(c) 2001–2006 www.jollen.org. All rights reserved.
Last update: 2026-07-22