J2ME 支持 HTTP PUT 吗?
我刚刚注意到 MIDP 2.0 API 中的一个奇怪的事情:HttpConnection 类 apidocs 明确引用了方法 GET、POST 和 HEAD,但没有其他方法。这是否意味着它们不受支持?
http://java.sun.com/ javame/reference/apis/jsr118/javax/microedition/io/HttpConnection.html
我还尝试检查 MIDP 2.0 规范,但找不到任何关于此的硬事实。
我可以在某些手机上尝试一下,但无法全部尝试。有谁知道实现 MIDP 2.0 规范的手机需要支持哪些 HTTP 方法?或者有寻找支持/不支持 HTTP PUT 的手机的经验吗?
如果不支持 PUT,是否有任何(可移植的)解决方法来实现它?在 SocketConnection 之上实现 HTTP?
I just noticed a strange thing in MIDP 2.0 API: The HttpConnection class apidocs make explicit references to methods GET, POST and HEAD, but no other methods. Does this mean that they are not supported?
http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/io/HttpConnection.html
I also tried checking the MIDP 2.0 spec, but couldn't find any hard facts about this.
I can give this a try on some phone(s), but can't try them all. Does anyone know which HTTP methods are required to be supported by phones implementing the MIDP 2.0 spec? Or any experience in finding phones that support/don't support e.g. HTTP PUT?
If PUT is not supported, are there any (portable) workarounds for implementing it? Implement HTTP on top of SocketConnection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
规范在技术上不支持它。我确信有包装类,但我确信他们会引入自己的一组错误和解决方法。
编写一个简单包装器并不难,编写一个像样的、可用的、无错误的包装器则要复杂得多
It is not technically supported by the spec. I am sure there are wrapper classes but I am sure they would introduce their own set of bugs and work arounds.
Writing a simple wrapper isn't hard, writing a decent usable bug free one is way mmore complicated
在 SocketConnection 之上实现它可能会遇到一些困难,因为许多(大多数?)实现不允许您使用 SocketConnection 连接到端口 80 或 8080,除非您受到信任/签名。
You may experience some difficulty implementing it on top of SocketConnection as many (most?) implementations won't let you connect to port 80 or 8080 using SocketConnection unless you're trusted/signed.
是的,HttpConnection 仅限于这些动词。我认为使用其他方法修补它是不可行的。您需要使用 Apache HttpClient。在许多其他功能中,
Right, HttpConnection is limited to those verbs. I don't think it's feasible to patch it to use some other method. You'll want to use Apache HttpClient. Among many other features,