2

I am using Backbone.js to build a 'hybrid' web app, which will be served as a native app using Phonegap. One thing I need is offline support for a large amount of data, and so we are considering using native code to synchronise the offline data with the server, and just transfer the bits of data we need to the web app when necessary. (An alternative approach we considered was using the Phonegap storage plugin but this is backed by WebSQL which seems to have a 5MB quota, which is too small for what we need).

As the app is based on Backbone.js, which expects a RESTful API as its backend, we are toying with the idea of embedding a RoutingHTTPServer into the native layer - essentially this allows us to embed a local web server in the app, so that the web layer can request data using standard RESTful calls to the local server. The beauty here is that the Backbone app doesn't know any different - the workflow is entirely the same as requesting data from a remote server.

I was wondering if there is an equivalent of RoutingHTTPServer for Android? I have seen projects like iJetty, but ideally I would like something which gives the REST-API bit out of the box too (like RoutingHTTPServer does). Would something like Spark work on Android?

4

1 回答 1

0

试试MiniWeb Java Embedded Webserver。它是为 Android 构建的,非常容易设置 JSON REST 请求和开源。

于 2014-09-21T03:25:13.877 回答