views:

282

answers:

3

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?

A: 

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

drubin
Ok, thanks. I'll have to check out if there are already any libraries available to do this, but I would guess not.
hvuoltee
A: 

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.

funkybro
That restriction is more for listening on a socket than making an outbound connection
Sam Barnum
Thanks for the pointer. I found some documentation related to this, it looks like JSR 185 (JTWI) requires this behavior. I have no idea why they would require this, though. Pretty strange.
hvuoltee
A: 

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.

Sam Barnum
Unfortunately HttpClient is not an option on Java Microedition.
hvuoltee