use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project dubbo by alibaba.
the class HttpProcessHandler method http_200.
private static final FullHttpResponse http_200(String result) {
FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(result.getBytes()));
HttpHeaders httpHeaders = response.headers();
httpHeaders.set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
httpHeaders.set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());
return response;
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project dubbo by alibaba.
the class HttpProcessHandler method http_500.
private static final FullHttpResponse http_500(String errorMessage) {
FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.INTERNAL_SERVER_ERROR, Unpooled.wrappedBuffer(errorMessage.getBytes()));
HttpHeaders httpHeaders = response.headers();
httpHeaders.set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
httpHeaders.set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());
return response;
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project tesla by linking12.
the class HttpFiltersRunner method createResponse.
private HttpResponse createResponse(HttpResponseStatus httpResponseStatus, HttpRequest originalRequest) {
HttpHeaders httpHeaders = new DefaultHttpHeaders();
httpHeaders.add("Transfer-Encoding", "chunked");
HttpResponse httpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, httpResponseStatus);
httpResponse.headers().add(httpHeaders);
return httpResponse;
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project tesla by linking12.
the class ClientToProxyConnection method modifyRequestHeadersToReflectProxying.
private void modifyRequestHeadersToReflectProxying(HttpRequest httpRequest) {
LOG.debug("Modifying request headers for proxying");
HttpHeaders headers = httpRequest.headers();
ProxyUtils.removeSdchEncoding(headers);
switchProxyConnectionHeader(headers);
stripConnectionTokens(headers);
stripHopByHopHeaders(headers);
ProxyUtils.addVia(httpRequest, proxyServer.getProxyAlias());
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project tesla by linking12.
the class ClientToProxyConnection method modifyResponseHeadersToReflectProxying.
private void modifyResponseHeadersToReflectProxying(HttpResponse httpResponse) {
if (!proxyServer.isTransparent()) {
HttpHeaders headers = httpResponse.headers();
stripConnectionTokens(headers);
stripHopByHopHeaders(headers);
ProxyUtils.addVia(httpResponse, proxyServer.getProxyAlias());
if (!headers.contains(HttpHeaderNames.DATE)) {
headers.set(HttpHeaderNames.DATE, new Date());
}
}
}
Aggregations