Embeding a Web Server in a Cocoa Application
I want to embed a simple web server into a cocoa application that can support dynamic operations, like processing form submissions. It should all be contained in the app. My first thought would be to include a Rails server, but somet开发者_如何学JAVAhing about that seemed wrong. Are there any examples of people integrating a web server in their app?
More info: I've been looking at cocoahttpserver (http://code.google.com/p/cocoahttpserver/) but it would be nice to have an embeddable server which supported output templates like rails, php, django, etc.
I've prototyped somethign that uses a combination of CocoaHTTPServer and MGTemplateEngine. Here's the current GIT repo for the full app in progress: http://github.com/jgillick/Ganzbot-Controller
Look at GanzbotServer.m for how I wired those two libraries together. (FYI: You need to install RegexKit to get MGTemplateEngine to compile)
ComicFlow is an open-source comic reader for iPad which embeds a web server so you can see exactly how it's done.
精彩评论