diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-08 19:34:42 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-08 19:34:42 +1200 |
commit | a169ff4eb6c1de110ddcedebdec77fb7aae05a33 (patch) | |
tree | f2a3482f0214d04ec31bd898c375d38c7b89a9be /src/org/traccar/notification/MultiPartEventForwarder.java | |
parent | ae1b5bd74b69a7e8222af39e3c62aa217ba94d29 (diff) | |
parent | 5a9811c3771d92832c9bba718b5ec935844978e8 (diff) | |
download | trackermap-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/notification/MultiPartEventForwarder.java')
-rw-r--r-- | src/org/traccar/notification/MultiPartEventForwarder.java | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/org/traccar/notification/MultiPartEventForwarder.java b/src/org/traccar/notification/MultiPartEventForwarder.java deleted file mode 100644 index 6227c66cc..000000000 --- a/src/org/traccar/notification/MultiPartEventForwarder.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.traccar.notification; - -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; - -import org.traccar.Context; -import org.traccar.model.Event; -import org.traccar.model.Position; - -import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder; -import com.ning.http.client.multipart.StringPart; - -public class MultiPartEventForwarder extends EventForwarder { - - private final String payloadParamName; - private final String additionalParams; - - public MultiPartEventForwarder() { - payloadParamName = Context.getConfig().getString("event.forward.paramMode.payloadParamName", "payload"); - additionalParams = Context.getConfig().getString("event.forward.paramMode.additionalParams"); - } - - @Override - protected String getContentType() { - return "multipart/form-data"; - } - - @Override - protected void setContent(Event event, Position position, Set<Long> users, BoundRequestBuilder requestBuilder) { - - if (additionalParams != null && !additionalParams.isEmpty()) { - Map<String, List<String>> paramsToAdd = splitIntoKeyValues(additionalParams, "="); - - for (Entry<String, List<String>> param : paramsToAdd.entrySet()) { - for (String singleParamValue : param.getValue()) { - requestBuilder.addBodyPart(new StringPart(param.getKey(), singleParamValue, null, - StandardCharsets.UTF_8)); - } - } - } - requestBuilder.addBodyPart(new StringPart(payloadParamName, - prepareJsonPayload(event, position, users), "application/json", StandardCharsets.UTF_8)); - } -} |