Question

I have some Tomcat applications that perform REST lookups on other web services. These services are beginning to restrict access according to user agent. The user agent employed by Tomcat 7, by default, consists of the Java version, e.g., Java/1.6.0_21. Is there a way to change the default user agent in Tomcat?

It is of course possible to set the User Agent in a Java script, but I can find no documentation whatsoever for applying a User Agent across all Tomcat applications.

No correct solution

OTHER TIPS

You need to set the User-Agent header on your HTTP request.

I don't know how you do this call (HttpClient? JAX-RS?) but just to give you an idea:

HttpGet request = ...;
request.addHeader("User-Agent", "your user agent");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top