Setting an HTTP timeout at runtime

For the Java project I'm working on, we're calling off to an external system via HTTP. We have a default timeout for this call, but in some cases that we can only identify at runtime, we need to adjust that timeout. Examples include cases where the caller of our application specifically wants to override the default timeout, or a particular parameter on our request indicates that we'll need to wait additional time. Currently, we're using the Cobalt Infra HTTP client. This doesn't seem to support this sort of functionality ([see earlier thread][1]); while it offers URL-matching, there are cases where the same URL might require different timeouts. We're looking around at some other JVM-based libraries that offer HTTP functionality. Does anybody already do this sort of timeout adjustment, and if so, what library do you use? Any problems with it? [1]:
http://techoverflow.int.westgroup.com/questions/1081/how-do-i-explicitly-set-the-timeout-for-an-http-request-via-the-infrastructure-http-client

Best Answer

  • mtaylor
    Answer ✓
    Brian, Instead of looking for an alternative to the HTTP Client, the best thing here would be to request that the infrastructure team that supports the HTTP Client add this as a capability. As a general architectural principle, the HTTP Client should be used across the board when making calls from Cobalt Modules.

Answers

  • Mark, do you happen to know the Exchange group that should be contacted for requesting enhancements? Do they have any documentation on HTTP Client anywhere?