2

I'd be amazed if nobody has ported the Basho WebMachine toolkit written in Erlang (http://wiki.basho.com/Webmachine.html) to Java, but I can't seem to find one!

I know there are various attempts at Java REST toolkits (JAX-RS, RESTlets, 1060 NetKernel, etc.), but I don't want someone's interpretation of the REST style - I just want an 'executable HTTP model', which is exactly what WebMachine seems to be, but I want it in Java (i.e. not the Ruby, Python, Clojure, etc. ports...!). Surely WebMachine is not so 'functional' that it can't be ported easily to Java, but maybe I'm wrong on that (I'm kinda suspecting that might actually be the case)...?

For the record, I implemented my own attempt at WebMachine in Java many years ago (built on top of Apache HTTPClient), but it only implemented a very small subset of the HTTP spec, and I really don't want to resurrect that code (written with JDK 1.4), and extend it for all the features of HTTP I never bothered to understand or implement back then.

Jonas
  • 121,568
  • 97
  • 310
  • 388
PMcB
  • 21
  • 2

5 Answers5

0

Have a look at Clothesline. It's written in Clojure but the description states that it is accesible for all JVM languages.

Collin
  • 11,977
  • 2
  • 46
  • 60
Willi Müller
  • 631
  • 1
  • 5
  • 13
0

I wrote a port based on the Ruby Webmachine port, it's called Bishop and stays pretty close to the port, for the most part.

GitHub project page

Miles
  • 1,561
  • 1
  • 15
  • 22
0

JAX-RS 2.0 is an "executable HTTP model," or whatever you want to call it. Go with Glassfish Jersey, you won't be disappointed. It is definitely RESTfulness and style agnostic. I contend that the annotation-based approach of JAX-RS/Jersey is much more powerful than the interface-based approach of Webmachine.

derekm
  • 429
  • 1
  • 4
  • 12
-1

I'm not familiar with anything exactly like that in java, but what about Netty?

As they label it:

Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

It is build on top of NIO and let you switch between protocols without the need to change the rest of your application.

Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
-1

In webmachine you have a lot of callbacks that you can defined and export like resource_exists, to_json, to_html etc and doing same in java would not be the best fit because you would end up with a lot of boilerplate code.

In java you can use things like spring mvc framework to build web resources.

Jakub Oboza
  • 5,291
  • 1
  • 19
  • 10
  • VM's aside, no boilerplate code in this case, basic object orientation design will help you. You will need only a DefaultResource class with all default implementations, your CustomResource will have to extend it and only override the methods he needs to customize (pretty much like the erlang version). – Jonas Fagundes Apr 15 '12 at 22:49