Hi,
In doing a post I use:
post.addRequestHeader("Content-type", "text/xml; charset=utf-8");
in looking at the java docs it appears there is something similar for
the get method.
I would take a look at
http://commons.apache.org/httpclient/apidocs/org/apache/commons/httpclie
nt/methods/GetMethod.html
Probably something like method.addRequestHeader(headerName,
headerValue);
but that's untested.
Greg.
-----Original Message-----
From: ying lcs [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 08, 2007 9:30 AM
To: [email protected]
Subject: How can I set HTTP header in httpclient
Hi,
How can I set HTTP header name and value in httpclient?
i have the following example, I would like to know how can setup http
header name and value?
String loadUrl = "http://127.0.0.1:8080/video";
GetMethod method = new GetMethod(loadUrl);
try {
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " +
method.getStatusLine());
}
} catch (Throwable e) {
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message and any attachments are intended only for the use of the addressee
and may contain information that is privileged and confidential. If the reader
of the message is not the intended recipient or an authorized representative of
the intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication
in error, please notify us immediately by e-mail and delete the message and any
attachments from your system.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]