aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/StatisticsManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-08 19:34:42 +1200
committerGitHub <noreply@github.com>2018-06-08 19:34:42 +1200
commita169ff4eb6c1de110ddcedebdec77fb7aae05a33 (patch)
treef2a3482f0214d04ec31bd898c375d38c7b89a9be /src/org/traccar/database/StatisticsManager.java
parentae1b5bd74b69a7e8222af39e3c62aa217ba94d29 (diff)
parent5a9811c3771d92832c9bba718b5ec935844978e8 (diff)
downloadtrackermap-server-a169ff4eb6c1de110ddcedebdec77fb7aae05a33.tar.gz
trackermap-server-a169ff4eb6c1de110ddcedebdec77fb7aae05a33.tar.bz2
trackermap-server-a169ff4eb6c1de110ddcedebdec77fb7aae05a33.zip
Merge pull request #3920 from traccar/remove-http-client
Remove async HTTP client dependency
Diffstat (limited to 'src/org/traccar/database/StatisticsManager.java')
-rw-r--r--src/org/traccar/database/StatisticsManager.java37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/org/traccar/database/StatisticsManager.java b/src/org/traccar/database/StatisticsManager.java
index 9a3ff06bd..452cdffa0 100644
--- a/src/org/traccar/database/StatisticsManager.java
+++ b/src/org/traccar/database/StatisticsManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,13 +15,13 @@
*/
package org.traccar.database;
-import com.ning.http.client.Request;
-import com.ning.http.client.RequestBuilder;
import org.joda.time.format.ISODateTimeFormat;
import org.traccar.Context;
import org.traccar.helper.Log;
import org.traccar.model.Statistics;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Form;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
@@ -70,22 +70,21 @@ public class StatisticsManager {
String url = Context.getConfig().getString("server.statistics");
if (url != null) {
String time = ISODateTimeFormat.dateTime().print(statistics.getCaptureTime().getTime());
- Request request = new RequestBuilder("POST")
- .setUrl(url)
- .addHeader("Content-Type", "application/x-www-form-urlencoded")
- .addFormParam("version", Log.getAppVersion())
- .addFormParam("captureTime", time)
- .addFormParam("activeUsers", String.valueOf(statistics.getActiveUsers()))
- .addFormParam("activeDevices", String.valueOf(statistics.getActiveDevices()))
- .addFormParam("requests", String.valueOf(statistics.getRequests()))
- .addFormParam("messagesReceived", String.valueOf(statistics.getMessagesReceived()))
- .addFormParam("messagesStored", String.valueOf(statistics.getMessagesStored()))
- .addFormParam("mailSent", String.valueOf(statistics.getMailSent()))
- .addFormParam("smsSent", String.valueOf(statistics.getSmsSent()))
- .addFormParam("geocoderRequests", String.valueOf(statistics.getGeocoderRequests()))
- .addFormParam("geolocationRequests", String.valueOf(statistics.getGeolocationRequests()))
- .build();
- Context.getAsyncHttpClient().prepareRequest(request).execute();
+
+ Form form = new Form();
+ form.param("version", Log.getAppVersion());
+ form.param("captureTime", time);
+ form.param("activeUsers", String.valueOf(statistics.getActiveUsers()));
+ form.param("activeDevices", String.valueOf(statistics.getActiveDevices()));
+ form.param("requests", String.valueOf(statistics.getRequests()));
+ form.param("messagesReceived", String.valueOf(statistics.getMessagesReceived()));
+ form.param("messagesStored", String.valueOf(statistics.getMessagesStored()));
+ form.param("mailSent", String.valueOf(statistics.getMailSent()));
+ form.param("smsSent", String.valueOf(statistics.getSmsSent()));
+ form.param("geocoderRequests", String.valueOf(statistics.getGeocoderRequests()));
+ form.param("geolocationRequests", String.valueOf(statistics.getGeolocationRequests()));
+
+ Context.getClient().target(url).request().async().post(Entity.form(form));
}
users.clear();