InfoWorld brings us news of serious and exciting changes in Java’s future. According to the article, most of Java will be open sourced. “Most” is left undefined for now. But most is better than not, so that’s goods new.
It gets even better. Java will also …
“The Ruby on Rails Web framework also may be supported.”
Can you say javax.rails?
And to show that Sun knows what the cool kids are up to these days, Java will also …
“Also at Sun, the company is eyeing the addition of lightweight REST (Representational State Transfer) Web services … An announcement is expected in four to six weeks.”
Finally! Sure, Java had java.net and javax.servlet for a few years now, but to do the real heavy lifting that is REST, you need a framework. All those resources don’t come for cheap, you know.
The details are a bit sketchy. (I still can’t get past the excitement that we’ll be able to use javax.rails!)
I can only imagine it may look something like this:
import javax.rest.*;
public class SimpleCall {
public void simpleCall() {
VerbFactory verbs = VerbFactory.newInstance();
Verb verb = verbs.createVerb("post");
ResourceRepository resRep = ResourceRepository.connect("rest-conf.xml");
Resource res = resRep.lookup("http://myserver.com");
Invocation inv = res.createInvocation(verb);
Request req = inv.createEmptyRequest();
Response res = inv.invoke(req);
inv.close();
res.release();
resRep.disconnect();
XMLUtils.output(res.getDocument(), System.out);
}
}
Ok. That was a cheap shot. But I just couldn’t resist.
Labnotes » Rounded Corners