aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseHttpProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 21:58:26 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 21:58:26 +1200
commit1d04cfbd052946ac8eb00cd4c8045a31d4d75da3 (patch)
tree84b0705737639860c6655dd3f479d2d913a5f7a8 /src/org/traccar/BaseHttpProtocolDecoder.java
parent6a3d70c2e591edbb34af15dcaa45a9a7114c1dd3 (diff)
downloadtrackermap-server-1d04cfbd052946ac8eb00cd4c8045a31d4d75da3.tar.gz
trackermap-server-1d04cfbd052946ac8eb00cd4c8045a31d4d75da3.tar.bz2
trackermap-server-1d04cfbd052946ac8eb00cd4c8045a31d4d75da3.zip
Update OsmAnd protocol
Diffstat (limited to 'src/org/traccar/BaseHttpProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseHttpProtocolDecoder.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/org/traccar/BaseHttpProtocolDecoder.java b/src/org/traccar/BaseHttpProtocolDecoder.java
index dbc6b087b..57a68acac 100644
--- a/src/org/traccar/BaseHttpProtocolDecoder.java
+++ b/src/org/traccar/BaseHttpProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 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,18 +15,25 @@
*/
package org.traccar;
-public abstract class BaseHttpProtocolDecoder /*extends BaseProtocolDecoder*/ { // TODO implement later
+import io.netty.channel.Channel;
+import io.netty.handler.codec.http.DefaultFullHttpResponse;
+import io.netty.handler.codec.http.HttpHeaderNames;
+import io.netty.handler.codec.http.HttpResponse;
+import io.netty.handler.codec.http.HttpResponseStatus;
+import io.netty.handler.codec.http.HttpVersion;
- /*public BaseHttpProtocolDecoder(Protocol protocol) {
+public abstract class BaseHttpProtocolDecoder extends BaseProtocolDecoder {
+
+ public BaseHttpProtocolDecoder(Protocol protocol) {
super(protocol);
}
public void sendResponse(Channel channel, HttpResponseStatus status) {
if (channel != null) {
- HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
- response.headers().add(HttpHeaders.Names.CONTENT_LENGTH, 0);
- channel.write(response);
+ HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status);
+ response.headers().add(HttpHeaderNames.CONTENT_LENGTH, 0);
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
- }*/
+ }
}