We are dealing with the following issue. We are using a tomcat server with Vyre to access source material that needs to be streamed, but since the client library / User-agent is identifying it self with the default Jakarta Commons-HttpClient/3.1 tag when connecting to the other site, the connection gets blocked and will not be unblocked unless we can send alternative User-Agent profile to the source. See relevant message from the the site admin :
"The client library your software is using to download the XML is identifying itself as "Jakarta Commons-HttpClient/3.1". This is the default User-Agent of a library commonly used with crawlers. You'll need to change the User-Agent to get unblocked. "
From searching for a solution and from item 5 in the things to try list on the apache.org site and other issues where this solution has been used, we know there is a way to do this. But have not found clear instruction on just what you need to do in order to make this change, just suggestions that you make the change without explaining how make this change in a straightforward manner. There are is a number of hints that I have found as to what text parameters you need to change, such as the one below, but have not been able to find exactly which file or scrip needs to be edited in order to make this change. Everything indicates this should be a reasonably simple procedure.
I would be grateful if someone that has successfully implemented this change could let us know what is the right procedure to do this. Is the only way to do this to edit the org/apache/commons/httpclient/params/HttpMethodParams.class file and recompile the source ? Or is there a simpler way of setting the User_Agent request header to masquerde the HttpClient that that ?
import org.apache.commons.httpclient.HttpClient;
import
org.apache.commons.httpclient.params.HttpMethodParams;
...
HttpClient
httpclient = new
HttpClient();
httpclient.getParams().setParameter(HttpMethodParams.USER_AGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1)");
...
Cheers,
Sveinn
Confucius said: "To study and not think is a waste. To think and not study is dangerous."
