Http in java

How do I send http request and know what to do in server according to the request it self??