use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse in project jocean-http by isdom.
the class RxNettys method response404NOTFOUND.
public static Observable<HttpObject> response404NOTFOUND(final HttpVersion version) {
final HttpResponse response = new DefaultFullHttpResponse(version, HttpResponseStatus.NOT_FOUND);
response.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0);
return Observable.<HttpObject>just(response);
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse in project cdap by caskdata.
the class HttpRequestRouter method createPipeliningNotSupported.
private HttpResponse createPipeliningNotSupported() {
FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.NOT_IMPLEMENTED);
response.content().writeCharSequence("HTTP pipelining is not supported", StandardCharsets.UTF_8);
HttpUtil.setContentLength(response, response.content().readableBytes());
return response;
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse in project cdap by caskdata.
the class AuthenticationChannelHandler method exceptionCaught.
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
LOG.error("Got exception: {}", cause.getMessage(), cause);
// TODO: add WWW-Authenticate header for 401 response - REACTOR-900
HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.UNAUTHORIZED);
HttpUtil.setContentLength(response, 0);
HttpUtil.setKeepAlive(response, false);
ctx.channel().writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse in project sidewinder by srotya.
the class HTTPDataPointDecoder method writeResponse.
private boolean writeResponse(HttpObject httpObject, ChannelHandlerContext ctx) {
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, httpObject.decoderResult().isSuccess() ? OK : BAD_REQUEST, Unpooled.copiedBuffer(responseString.toString().toString(), CharsetUtil.UTF_8));
response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8");
response.headers().set(CONTENT_LENGTH, response.content().readableBytes());
response.headers().set(CONNECTION, HttpHeaderValues.KEEP_ALIVE);
responseString = new StringBuilder();
// Write the response.
ctx.write(response);
return true;
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse in project sidewinder by srotya.
the class HTTPDataPointDecoder method send100Continue.
private static void send100Continue(ChannelHandlerContext ctx) {
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, CONTINUE);
ctx.write(response);
}
Aggregations