Skip to content

1.7.0.0 Major HTTP client and stacktace filtering improvements

Compare
Choose a tag to compare
@michaelgantman michaelgantman released this 25 Jun 15:44
· 3 commits to master since this release

This release contains some significant improvements of existing features. Below is the list of changes:

  1. Class TimeInterval now implements Comparable interface. The instances are compared based on the length of time interval they represent.
  2. Stacktrace filtering feature in class TextUtils now supports multiple "relevant package" prefixes. This is a major improvement That some clients have been asking for. (See method description public static java.lang.String getStacktrace(java.lang.Throwable e, boolean cutTBS, java.lang.String... relevantPackages). Previously stacktrace filtering was based on a single prefix only that determined which parts of the stacktrace are relevant and which are not. Starting from this version multiple prefixes are supported. It is a corner-case scenario but it is an important one.
  3. And last but certainly not least is HttpClient improvement. In previous versions, this class was not thread-safe both because it stored state (pre-set headers) and because its sendHttpRequest(...) methods returned only the actual content of the response but the metadata (such as response headers, error code, and message) were stored as state as well, and thus every subsequent request would override that data making this class (up until this version) only suitable for a single request at the time (even in the same thread). Now methods sendHttpRequest(...) return not just a response content (String or binary data) but a class that contains both content and metadata (response headers, error code, and message) for this particular response (See class ResponseHolder used as return value for all sendHttpRequest(...) methods). So, while HttpClient class is still, strictly speaking, not thread-safe it is by design and it is now more mature special purpose HTTP client. It holds the state that is shared by requests such as request headers. This class is intended for multiple repeated requests that share the same state. So, once this class is instantiated and its state is set - as long as the state is not changed it is thread-safe for issuing multiple requests from multiple threads. (See details in Javadoc description for HttpClient)