Man has to have his own HTTP abstraction in Java

I hate the fact that every project is building their own HTTP abstraction on top of some library, sometimes, sometimes commons-httpclient but always a custom implementation that depends on something different.

Currently I am trying to implement a Constaint on Alfresco that can get the allowed values from a controlled vocabulary service via HTTP. First I tried to use Alfresco’s own abstraction to deal with HTTP calls in order to facilitate the existing code-base. But it is not wise for two reasons;

  • First the implementation is not good at all
  • Second they have changed it with every major release, with 3.3 it is not even in Alfresco, it is in Spring Surf Webscript artifact. –I assume we are not supposed to use it, since it is an internal API–

That is why I am asking; “Does every developer need his/her own HTTP lib?”

I think it is logical to have one, a simple one at least, so that you don’t have to deal with these kind of problems.

It is not that difficult to build one for yourself, get inspired from an existing library. For example the one included in spring-web is very good.

Leave a Reply

Your email address will not be published.