diff options
Diffstat (limited to 'src/org/traccar/BaseHttpProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/BaseHttpProtocolDecoder.java | 21 |
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())); } - }*/ + } } |