Releases: michaelgantman/Mgnt
1.7.0.1 Minor logging message bug fix for HttpClient
This very minor release contains just one big fix for a small logging message bug in HttpClient. For a particular case when an error occurs while sending an HTTP request and there is an HTTP response code but no response message, then there is a space missing in the error message in the log between the HTTP response code and the Exception error message. This is a minor bug. But... a bug is a bug and now it is fixed
1.7.0.0 Major HTTP client and stacktace filtering improvements
This release contains some significant improvements of existing features. Below is the list of changes:
- Class TimeInterval now implements Comparable interface. The instances are compared based on the length of time interval they represent.
- 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. - 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 itssendHttpRequest(...)
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 methodssendHttpRequest(...)
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 allsendHttpRequest(...)
methods). So, whileHttpClient
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)
1.6.0.6 Method chaining support for HttpClient
Added method chaining support for HttpClient for header setter methods. so now methods clearAllRequestProperties()
, removeRequestProperty()
, setContentType()
and setRequestHeader()
return the instance of HttpClient so they could be chained. So now it is possible to write:
new HttpClient()
.setContentType(...)
.setRequestHeader(...)
.setRequestHeader(...)
.setRequestHeader(...)
.sendHttpRequest(...);
1.6.0.5 Faster XML vulnerabilities fix
This release contains no new features or bug fixes. It upgrades Faster XML library to the newest version that fixes a recently discovered vulnerability
1.6.0.4 HttpClient fix for textual body
This is a bug fix release. It fixes a bug for HttpClient for methods sendHttpRequest(...)
and sendHttpRequestForBinaryResponse(...)
that allow passing a textual body content for request (those method that have the last parameter String data
). When Textual body content was converted into bytes just before sending request the conversion added some 0-value bytes at the end and that caused request to fail in some servers. This is fixed in this release.
Another change is that a new dependency was added:
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
This is to include classes such as javax.annotation.PostConstruct
and javax.annotation.PreDestroy
. Up until java version 11 those classes were part of JDK, but in the later versions they were excluded and for seamless use of the library the above dependency was added so it would work without the need to add such dependency externally with later java versions
1.6.0.3 Json-Jackson vulnerability fix
jackson-databind is a data-binding package for the Jackson Data Processor. jackson-databind allows a Java stack overflow exception and denial of service via a large depth of nested objects. So the upgrade to the latest version fixes the issue
1.6.0.2 HttpClient support for upload of binary payload
Http Client got new methods that allow uploading binary payload. There are 4 new methods that allow upload of binary payload and receive text/binary response. Below is the list of the new methods:
public java.lang.String sendHttpRequest(HttpClient.HttpMethod callMethod,
java.nio.ByteBuffer data)
throws java.io.IOException
public java.lang.String sendHttpRequest(java.lang.String requestUrl,
HttpClient.HttpMethod callMethod,
java.nio.ByteBuffer data)
throws java.io.IOException
public java.nio.ByteBuffer sendHttpRequestForBinaryResponse(HttpClient.HttpMethod callMethod,
java.nio.ByteBuffer data)
throws java.io.IOException
public java.nio.ByteBuffer sendHttpRequestForBinaryResponse(java.lang.String requestUrl,
HttpClient.HttpMethod callMethod,
java.nio.ByteBuffer data)
throws java.io.IOException
1.6.0.1 Javadoc fixes for JSON Parser
This release contains some javadoc fixes for previous release and no code changes.
1.6.0.0 Json Parser
In this release there is a brand new feature (hence major version change). And the feature is... Json Parser
The new class, JsonUtils, provides some simple methods to serialize any object into JSON String and parse (deserialize) JSON string back into the instance of the class. This class is a simplifying wrapper over basic functionality of Jason-Jackson library.
1.5.1.2 HttpClient method naming changes to comply with common conventions, and TimeUtils improvments
In this release, method setRequestProperty() of class HttpClient was deprecated, and a new method setRequestHeader() was added. The functionality of both those methods is identical, just the method name is more compliant with common conventions. Also in class TimeUtils method sleepFor() no longer just "swallows" and ignores InterruptedException, but if InterruptedException occurred, the method interrupts the current thread, so the thread interruption mechanism continues to work uninterrupted (pun intended).