views:

24

answers:

1

Is there a way to configure default request headers for HttpClient (the newer version)? I've done a lot of searching but I can't find anything on the new version.

A: 

Assuming that you mean HttpClient 4.0.1 API (javadocs are here)...

Look at class HttpOptions. It inherits from HttpMessage, which has such methods as addHeader(...), setHeader(...), etc. It also inherits from HttpRequestBase, which seems to indicate that it is a request object in its own right. It has constructors that will accept a string or a URI.

Demi