使用objective-c进行Web应用程序编程? [英] Web application programming using objective-c?

查看:23
本文介绍了使用objective-c进行Web应用程序编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您有一个相当大且复杂的桌面应用程序,用 Objective-c/cocoa 编写,并在 MVC 中正确编写.那么您希望将 V 和 C 替换为 Web 应用程序吗?

Just say you have a quite large and complicated desktop application written in objective-c/cocoa written properly in MVC. You then wish to replace the V and C so that it is a web application?

除了目标 c 之外,还有没有像 Tomcat 一样的东西?我能想到的最接近的事情是以某种方式将模型代码转换为 apache 模块以加载到 apache 中?

Is there anything like Tomcat but for objective c? The closest thing I can think of is somehow convert the Model code into an apache module to load in apache?

显然我可以嵌入某种 HTTP 服务器并编写一大堆代码来管理会话、请求和响应等,但可能有更简单的方法吗?

Obviously I could embed some sort of HTTP server and write a whole pile of code to manage sessions and requests and responses and so on, but might there be a simpler way?

推荐答案

您几乎可以保持服务器原样.我会在后台将它作为守护进程运行.

You can leave the server almost as-is. I'd run it as a daemon in the background.

我会拆分控制器部分.它的一部分驻留在服务器上,作为 HTTP 请求和守护进程之间的连接.

I'd split the controller part. One part of it resides on the server as a connection between HTTP requests and the daemon.

  • 你可以运行一个自制的 http 服务器.
  • 您可以将其构建到您提到的 Apache 模块中.
  • 您可以通过 CGI 访问您的控制器.在我看来,这是最简单的选择.

控制器的第二部分在浏览器中用 Javascript 编写,与服务器交换数据并更新 GUI.

The second part of the controller is written in Javascript in the browser, exchanging data with the server and updating the GUI.

视图部分完全用javascript编写.

The view part is written completely in javascript.

  • 如果您愿意,您可以省略服务器上的控制器并使模型理解 HTTP 请求.

  • You could - if you want - leave out the controller on the server and make the model understand HTTP requests.

对于控制器/视图部分,请考虑使用框架.

For the Controller / View part consider using a framework.

  • jQuery 仅用于轻量级界面.(或类似的框架.)
  • 我还没有找到将所有模型内容都留给服务器的框架.也许您可以相应地使用 SproutCore 或 Cappuccino.
  • SproutCore,Apple 使用的全支持 MVC 框架.(至少这么认为.)
  • Cappuccino,另一个完全支持的 MVC 框架.
  • jQuery for only a light interface. (Or a similar framework.)
  • I haven't yet found a framework that leaves all the model stuff to the server. Maybe you can use SproutCore or Cappuccino accordingly.
  • SproutCore, the full-backed MVC framework that is used by Apple. (Think so at least.)
  • Cappuccino, another full-backed MVC framework.

这篇关于使用objective-c进行Web应用程序编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆