The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


REST and Java ME

Posted by brunogh on August 12, 2008 at 8:45 PM PDT

REST (Representational State Tranfer) is an architecture. Basically, it refers to the way the resources, commonly called URIs (Uniform Resource Identifier), are organized in the World Wide Web to be accessed and manipulated over the HTPP, using its default characteristics, like, for example, been stateless, specifying mime types, etc. The REST concept is not a new thing. Roy Fielding, one of the fathers of HTTP, has described it in his thesis.

Java people, lately, has started talking about RESTful Web Services after JSR 311. They, like other developers, were motivated by the fact that conventional Web Services (WS-*), that uses SOAP, WSDL, UDDI, whateverXYZ, can be heavy. Also, can be much heavier in a mobile! Just imagine you parsing a SOAP envelop that contains an encoded image and transfering (paying) all this overhead.

I have noticed two groups of REST developers: the ones who defend the use of the 4 HTPP methods (PUT, DELETE, GET, POST) and the others who prefer the browser way (GET, POST). I am not going to discuss this here (although I think the first way is more interesting), but in Java ME you will have problems with the first approach. The interface javax.microedition.io.HttpConnection, used by GCF (Generic Connection Framework), just allows GET, POST and HEAD. Urgghh?!

RESTful Web Services are usually consumed in JSON and/or XML. You can use both in Java ME, mixing together some interesting available solutions:

  • Awesome project called Moble Ajax that contains a JSON parser (org.json.me), an expression language for it, streaming Atom implementation and an Asynchronous I/O with GET, POST and HTTP Basic Authentication.
  • You can use JSR 280 or JSR 172 (available in MSA) for parsing the XML. Also, you can try the kXML 2 or some other solutions available in this old and still updated post.

That's it for today! Let's take a rest!

Have a nice week!



Bruno Ghisi

Related Topics >> Mobile and Embedded      
Comments
Comments are listed in date ascending order (oldest first)

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n

RED EYE OWNZ - by Z4i0n