+
+ public static void onWriteProgress(WebTarget target, Function1<Long, Tuple0> callback) {
+ target.register(new WriteProgressInterceptor(callback));
+ }
+
+ public static void onReadProgress(WebTarget target, Function1<Long, Tuple0> callback) {
+ target.register(new ReadProgressInterceptor(callback));
+ }
+
+ public static Long possibleContentLengthOf(Response response) {
+ String lengthStr = response.getHeaderString("Content-Length");
+ if (lengthStr != null) {
+ try {
+ return Long.parseLong(lengthStr);
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+