I'm new in Java.
I'm trying to do
import org.apache.http.Header;
Header<NameValuePair> nvps = new HeaderList<NameValuePair>();
//....adding some headers
httppost.setHeaders(nvps);
but said
The type Header is not generic; it cannot be parameterized with arguments <NameValuePair>
how I can do it?
I found the answer
Header[] headers = {
new BasicHeader("Content-type", "application/x-www-form-urlencoded")
,new BasicHeader("Content-type", "application/x-www-form-urlencoded")
,new BasicHeader("Accep", "text/html,text/xml,application/xml")
,new BasicHeader("Connection", "keep-alive")
,new BasicHeader("keep-alive", "115")
,new BasicHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2")
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With