RESTEasy (a JAX-RS implementation) has a nice client framework, eg:
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
SimpleClient client = Proxy
In your client proxy interface, use the @HeaderParam
annotation:
public interface SimpleClient
{
@PUT
@Path("basic")
@Consumes("text/plain")
public void putBasic(@HeaderParam("Greeting") String greeting);
}
The call in your example above would add an HTTP header that looks like this:
Greeting: hello world