I-码头或码头

发布于 2024-09-12 21:35:46 字数 484 浏览 10 评论 0原文

我有一个要在 Android 设备上托管的网络应用程序。我目前正在使用 android sdk 提供的模拟器。我的应用程序将同时提供静态和动态数据。我目前使用的是jetty版本6.1.22。我想问什么是更好的选择。 1. Jetty 网络服务器,代码已被剥离。 2. I-码头。

我的应用程序使用以下功能 -

  • ResourceHandler 来提供静态资源。
  • 用于服务同步数据请求的通用 servlet。
  • CometServlet 的扩展,用于服务异步数据请求。

我期待以下比较标准。

  • 应用程序大小。包含代码的 apk 的大小。
  • 最大负载为 30 个请求/秒时的内存和 CPU 使用情况。这些是短暂的爆发,在应用程序生命周期中很少出现。平均负载约为每秒 5 个请求。
  • 易于维护。包括Jetty在应用方面的重要升级。
  • 我可能错过的任何其他副作用。

I have a web application to be hosted on android device. I am currently using the emulator available with android sdk. My application will serve both static as well as dynamic data. I am currently using jetty version 6.1.22. I wanted to ask what will be a better option to be used.
1. Jetty webserver with stripped off code.
2. I-Jetty.

My application uses following features-

  • ResourceHandler to serve static resources.
  • A Generic servlet to serve synchronous data requests.
  • An extension to CometServlet to serve asynchronous data requests.

I am looking forward to following criteria for comparison.

  • Application size. Size of apk which will contain the code.
  • Memory and CPU usage under a maximum load of 30 requests/sec. These are short bursts which occur very few times in app-life cycle. The average load would be approximately 5 requests/sec.
  • Ease of maintenance. Including important upgrades of Jetty in application.
  • Any other side-effects which I probably am missing out at.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

抱猫软卧 2024-09-19 21:35:46

我也一直在寻找有关在应用程序中嵌入 i-Jetty 服务器的信息。像原始海报一样,我需要提供静态和动态资源。我发现以下帖子是一个有用的开始:

http://puregeekjoy.blogspot.com/2011/06/running-embedded-jetty-in-android-app.html

我注意到,在搜​​索有关在 Android 应用程序中嵌入 Web 服务器的答案时,许多响应者,而不是提供有用的答案,而是责备原始发帖人想要“在手机中”做这样的事情。然后他们开始给出所有不这样做的理由。除了手机之外,还有更多的 Android 设备。我的项目就涉及这样一个设备。感谢本网站和其他网站上所有指导我努力的有用答案。我希望我提供的链接可以帮助其他搜索者。

I too have been searching for information on embedding the i-Jetty server in an application. Like the original poster, I need to serve both static and dynamic resources. I found the following post to be a helpful start:

http://puregeekjoy.blogspot.com/2011/06/running-embedded-jetty-in-android-app.html

I notice that in searching for answers about embedding a web server in an Android app that many responders, rather than providing a helpful answer, chide the original poster for wanting to do such a thing "in a phone". They then proceed to give all the reasons not to. There are more Android devices out there than just phones. My project involves just such a device. Thanks for all the helpful answers on this and other sites that guided me in my efforts. I hope the link I provided helps other searchers.

徒留西风 2024-09-19 21:35:46

在您的应用程序中嵌入 Web 服务器有充分的理由。可能不是最好的方法,但当 Android 束缚你的手脚时你必须这样做。一个例子是当您想要在运行时动态解密视频并使用媒体播放器播放它时。 Android 媒体播放器不允许我向它提供来自解密管道的内存流。

在这种情况下,一个解决方案(请帮我想想其他解决方案!)是嵌入一个可以提供流的 Web 服务器 - 因为 Android 确实接受来自 URL 的流!

另一种解决方案是移植一些本机库并为其编写 JNI 接口。工作量太大,充其量也不稳定。

关键是,有足够充分的理由。

There are good reasons for embedding a web server in your app. May not be the best way but you have to do it when Android ties your hands. An example is when you want to decrypt video on the fly at runtime and use the media player to play it. Android media player does not allow me to feed it an in-memory stream as would come from a decryption pipe.

In this case, one solution (help me think of others please!) is to embed a web server that would serve up the stream - because Android does accept a stream from a URL!!

The other solution would be port some native library over and write a JNI interface to it. Too much work and unstable at best.

The point is, there are valid enough reasons out there.

岁月无声 2024-09-19 21:35:46

如果您需要解密视频或提供内容,您可能会考虑自己编写一个简单的 Web 服务器,它可以专门处理您的应用程序的需求,而不会造成任何臃肿。添加现有的 Web 服务器或 Web 容器可能超出您的需要。但这在很大程度上取决于您的应用程序的需求。

It you need to decrypt video or serve content, you might consider just writing a simple web server yourself that can specifically handle your application's needs without any bloat. Adding an existing web server or web container might be more than you need. It very much depends on your application's needs though.

岁月染过的梦 2024-09-19 21:35:46

我有一个要托管的 Web 应用程序
在 Android 设备上。

为什么?它无法使用,除非在 WiFi LAN 上。它不会运行太久,因为服务不可能永远运行。等等。

无论您认为通过在 Android 上使用 Web 服务器来解决什么技术问题,都可以通过其他方式更好地解决。

我想问一下有什么更好的
要使用的选项。 1.Jetty网络服务器
与剥离代码。 2.I-码头。

可以说“两者都不是”,不仅是因为技术问题,还因为 Greg Wilkins(Jetty 的创建者)不太喜欢Android。不过,在这两者中,i-jetty 至少定期在 Android 上进行测试。

最大内存和CPU使用率
每秒 30 个请求的负载。这些都是
很少发生的短突发
应用程序生命周期中的时间。平均
负载约为 5
请求/秒。

运行时,电池寿命会很短,因为您要保持 CPU 和 WiFi 一直运行以支持 Web 服务器,更不用说负载了。

I have a web application to be hosted
on android device.

Why? It won't be usable, except maybe on a WiFi LAN. It won't be able to run terribly long, because services cannot run forever. Etc.

Whatever technical problem you think you're solving by using a Web server on Android can be better solved by other means.

I wanted to ask what will be a better
option to be used. 1. Jetty webserver
with stripped off code. 2. I-Jetty.

Arguably "neither", not only due to the technical issues, but that Greg Wilkins (creator of Jetty) does not like Android much. Of the two, though, i-jetty is at least regularly tested on Android.

Memory and CPU usage under a maximum
load of 30 requests/sec. These are
short bursts which occur very few
times in app-life cycle. The average
load would be approximately 5
requests/sec.

While running, battery life will suck, because you are going to keep the CPU and WiFi running all of the time to support the Web server, let alone the load.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文