Is HTTP PUT supported in J2ME?

时光怂恿深爱的人放手 提交于 2019-12-07 07:03:38

问题


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?


回答1:


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




回答2:


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.




回答3:


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,

Full implementation of all HTTP methods (GET, POST, PUT, DELETE, HEAD, OPTIONS, and TRACE) in an extensible OO framework.



来源:https://stackoverflow.com/questions/1588046/is-http-put-supported-in-j2me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!