How to use Post Method using Apache HttpClient 4

HttpClient is an apache java library that can be used to read pages over http. It can be used mainly for webpages and provide a well defined API that can handle Cookies, Sessions,… It offers support for both Get and Post methods, so it’s very useful for writing http java clients that can login and perform different actions on webpages.

Starting with the version 4 the classes were drastically changed. Old tutorials don’t works anymore and the class names and methods were changed to some degree which makes old code pretty useless if you want to switch to a version 4.
Continue reading