diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-04-07 22:30:53 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-04-07 22:30:53 +1200 |
commit | 91a9a07188bf919f8ec92b139623dbd300e4f359 (patch) | |
tree | 0cef0ca410a2160a94d947ee99f1b4dbfdffbb13 /src/org/traccar/protocol | |
parent | ccdb325e4b14d0c09e809c43ea567b53f077710c (diff) | |
download | trackermap-server-91a9a07188bf919f8ec92b139623dbd300e4f359.tar.gz trackermap-server-91a9a07188bf919f8ec92b139623dbd300e4f359.tar.bz2 trackermap-server-91a9a07188bf919f8ec92b139623dbd300e4f359.zip |
Handle POST params in OsmAnd (fix #634)
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/OsmAndProtocolDecoder.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index 50903f52a..5cb6e6455 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -15,6 +15,7 @@ */ package org.traccar.protocol; +import java.nio.charset.Charset; import java.util.Date; import java.util.List; import java.util.Map; @@ -47,6 +48,11 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { HttpRequest request = (HttpRequest) msg; QueryStringDecoder decoder = new QueryStringDecoder(request.getUri()); Map<String, List<String>> params = decoder.getParameters(); + if (params.isEmpty()) { + decoder = new QueryStringDecoder( + request.getContent().toString(Charset.defaultCharset()), false); + params = decoder.getParameters(); + } // Create new position Position position = new Position(); @@ -58,6 +64,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); } catch(Exception error) { Log.warning("Unknown device - " + id); + return null; } // Decode position |