org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders Java Examples

The following examples show how to use org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RouterHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpRequest httpRequest) {
	if (HttpHeaders.is100ContinueExpected(httpRequest)) {
		channelHandlerContext.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
		return;
	}

	// Route
	HttpMethod method = httpRequest.getMethod();
	QueryStringDecoder qsd = new QueryStringDecoder(httpRequest.uri());
	RouteResult<?> routeResult = router.route(method, qsd.path(), qsd.parameters());

	if (routeResult == null) {
		respondNotFound(channelHandlerContext, httpRequest);
		return;
	}

	routed(channelHandlerContext, routeResult, httpRequest);
}
 
Example #2
Source File: RouterHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpRequest httpRequest) {
	if (HttpHeaders.is100ContinueExpected(httpRequest)) {
		channelHandlerContext.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
		return;
	}

	// Route
	HttpMethod method = httpRequest.getMethod();
	QueryStringDecoder qsd = new QueryStringDecoder(httpRequest.uri());
	RouteResult<?> routeResult = router.route(method, qsd.path(), qsd.parameters());

	if (routeResult == null) {
		respondNotFound(channelHandlerContext, httpRequest);
		return;
	}

	routed(channelHandlerContext, routeResult, httpRequest);
}
 
Example #3
Source File: RouterHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpRequest httpRequest) {
	if (HttpHeaders.is100ContinueExpected(httpRequest)) {
		channelHandlerContext.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
		return;
	}

	// Route
	HttpMethod method = httpRequest.getMethod();
	QueryStringDecoder qsd = new QueryStringDecoder(httpRequest.uri());
	RouteResult<?> routeResult = router.route(method, qsd.path(), qsd.parameters());

	if (routeResult == null) {
		respondNotFound(channelHandlerContext, httpRequest);
		return;
	}

	routed(channelHandlerContext, routeResult, httpRequest);
}
 
Example #4
Source File: HandlerRedirectUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
public static HttpResponse getRedirectResponse(String redirectAddress, String path, HttpResponseStatus code) {
	checkNotNull(redirectAddress, "Redirect address");
	checkNotNull(path, "Path");

	String newLocation = String.format("%s%s", redirectAddress, path);

	HttpResponse redirectResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, code);
	redirectResponse.headers().set(HttpHeaders.Names.LOCATION, newLocation);
	redirectResponse.headers().set(HttpHeaders.Names.CONTENT_LENGTH, 0);

	return redirectResponse;
}
 
Example #5
Source File: ConstantTextHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, RoutedRequest routed) throws Exception {
	HttpResponse response = new DefaultFullHttpResponse(
		HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(encodedText));

	response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, encodedText.length);
	response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");

	KeepAliveWrite.flush(ctx, routed.getRequest(), response);
}
 
Example #6
Source File: HandlerRedirectUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
public static HttpResponse getResponse(HttpResponseStatus status, @Nullable String message) {
	ByteBuf messageByteBuf = message == null ? Unpooled.buffer(0)
		: Unpooled.wrappedBuffer(message.getBytes(ENCODING));
	FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status, messageByteBuf);
	response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain; charset=" + ENCODING.name());
	response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());

	return response;
}
 
Example #7
Source File: KeepAliveWrite.java    From flink with Apache License 2.0 5 votes vote down vote up
public static ChannelFuture flush(ChannelHandlerContext ctx, HttpRequest request, HttpResponse response) {
	if (!HttpHeaders.isKeepAlive(request)) {
		return ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
	} else {
		response.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
		return ctx.writeAndFlush(response);
	}
}
 
Example #8
Source File: KeepAliveWrite.java    From flink with Apache License 2.0 5 votes vote down vote up
public static ChannelFuture flush(Channel ch, HttpRequest req, HttpResponse res) {
	if (!HttpHeaders.isKeepAlive(req)) {
		return ch.writeAndFlush(res).addListener(ChannelFutureListener.CLOSE);
	} else {
		res.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
		return ch.writeAndFlush(res);
	}
}
 
Example #9
Source File: HandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends the given error response and status code to the given channel.
 *
 * @param channelHandlerContext identifying the open channel
 * @param httpRequest originating http request
 * @param errorMessage which should be sent
 * @param statusCode of the message to send
 * @param headers additional header values
 */
public static CompletableFuture<Void> sendErrorResponse(
		ChannelHandlerContext channelHandlerContext,
		HttpRequest httpRequest,
		ErrorResponseBody errorMessage,
		HttpResponseStatus statusCode,
		Map<String, String> headers) {

	return sendErrorResponse(
		channelHandlerContext,
		HttpHeaders.isKeepAlive(httpRequest),
		errorMessage,
		statusCode,
		headers);
}
 
Example #10
Source File: HandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends the given response and status code to the given channel.
 *
 * @param channelHandlerContext identifying the open channel
 * @param httpRequest originating http request
 * @param message which should be sent
 * @param statusCode of the message to send
 * @param headers additional header values
 */
public static CompletableFuture<Void> sendResponse(
		@Nonnull ChannelHandlerContext channelHandlerContext,
		@Nonnull HttpRequest httpRequest,
		@Nonnull String message,
		@Nonnull HttpResponseStatus statusCode,
		@Nonnull Map<String, String> headers) {

	return sendResponse(
		channelHandlerContext,
		HttpHeaders.isKeepAlive(httpRequest),
		message,
		statusCode,
		headers);
}
 
Example #11
Source File: HandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends the given response and status code to the given channel.
 *
 * @param channelHandlerContext identifying the open channel
 * @param keepAlive If the connection should be kept alive.
 * @param message which should be sent
 * @param statusCode of the message to send
 * @param headers additional header values
 */
public static CompletableFuture<Void> sendResponse(
		@Nonnull ChannelHandlerContext channelHandlerContext,
		boolean keepAlive,
		@Nonnull String message,
		@Nonnull HttpResponseStatus statusCode,
		@Nonnull Map<String, String> headers) {
	HttpResponse response = new DefaultHttpResponse(HTTP_1_1, statusCode);

	response.headers().set(CONTENT_TYPE, RestConstants.REST_CONTENT_TYPE);

	for (Map.Entry<String, String> headerEntry : headers.entrySet()) {
		response.headers().set(headerEntry.getKey(), headerEntry.getValue());
	}

	if (keepAlive) {
		response.headers().set(CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
	}

	byte[] buf = message.getBytes(ConfigConstants.DEFAULT_CHARSET);
	ByteBuf b = Unpooled.copiedBuffer(buf);
	HttpHeaders.setContentLength(response, buf.length);

	// write the initial line and the header.
	channelHandlerContext.write(response);

	channelHandlerContext.write(b);

	ChannelFuture lastContentFuture = channelHandlerContext.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT);

	// close the connection, if no keep-alive is needed
	if (!keepAlive) {
		lastContentFuture.addListener(ChannelFutureListener.CLOSE);
	}

	return toCompletableFuture(lastContentFuture);
}
 
Example #12
Source File: MesosArtifactServer.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Writes a simple  error response message.
 *
 * @param ctx    The channel context to write the response to.
 * @param status The response status.
 */
private static void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) {
	FullHttpResponse response = new DefaultFullHttpResponse(
		HTTP_1_1, status, Unpooled.copiedBuffer("Failure: " + status + "\r\n", CharsetUtil.UTF_8));
	HttpHeaders.setHeader(response, CONTENT_TYPE, "text/plain; charset=UTF-8");

	// close the connection as soon as the error message is sent.
	ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
}
 
Example #13
Source File: PipelineErrorHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
private void sendError(ChannelHandlerContext ctx, String error) {
	if (ctx.channel().isActive()) {
		DefaultFullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
			HttpResponseStatus.INTERNAL_SERVER_ERROR,
			Unpooled.wrappedBuffer(error.getBytes(ConfigConstants.DEFAULT_CHARSET)));

		response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
		response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());

		ctx.writeAndFlush(response);
	}
}
 
Example #14
Source File: HttpTestClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends a simple GET request to the given path. You only specify the $path part of
 * http://$host:$host/$path.
 *
 * @param path The $path to GET (http://$host:$host/$path)
 */
public void sendGetRequest(String path, Duration timeout) throws TimeoutException, InterruptedException {
	if (!path.startsWith("/")) {
		path = "/" + path;
	}

	HttpRequest getRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
			HttpMethod.GET, path);
	getRequest.headers().set(HttpHeaders.Names.HOST, host);
	getRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);

	sendRequest(getRequest, timeout);
}
 
Example #15
Source File: HttpTestClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends a simple DELETE request to the given path. You only specify the $path part of
 * http://$host:$host/$path.
 *
 * @param path The $path to DELETE (http://$host:$host/$path)
 */
public void sendDeleteRequest(String path, Duration timeout) throws TimeoutException, InterruptedException {
	if (!path.startsWith("/")) {
		path = "/" + path;
	}

	HttpRequest getRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
			HttpMethod.DELETE, path);
	getRequest.headers().set(HttpHeaders.Names.HOST, host);
	getRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);

	sendRequest(getRequest, timeout);
}
 
Example #16
Source File: HttpTestClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends a simple PATCH request to the given path. You only specify the $path part of
 * http://$host:$host/$path.
 *
 * @param path The $path to PATCH (http://$host:$host/$path)
 */
public void sendPatchRequest(String path, Duration timeout) throws TimeoutException, InterruptedException {
	if (!path.startsWith("/")) {
		path = "/" + path;
	}

	HttpRequest getRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
		HttpMethod.PATCH, path);
	getRequest.headers().set(HttpHeaders.Names.HOST, host);
	getRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);

	sendRequest(getRequest, timeout);
}
 
Example #17
Source File: HttpTestClient.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
	LOG.debug("Received {}", msg);

	if (msg instanceof HttpResponse) {
		HttpResponse response = (HttpResponse) msg;

		currentStatus = response.getStatus();
		currentType = response.headers().get(HttpHeaders.Names.CONTENT_TYPE);
		currentLocation = response.headers().get(HttpHeaders.Names.LOCATION);

		if (HttpHeaders.isTransferEncodingChunked(response)) {
			LOG.debug("Content is chunked");
		}
	}

	if (msg instanceof HttpContent) {
		HttpContent content = (HttpContent) msg;

		// Add the content
		currentContent += content.content().toString(CharsetUtil.UTF_8);

		// Finished with this
		if (content instanceof LastHttpContent) {
			responses.add(new SimpleHttpResponse(currentStatus, currentType,
					currentContent, currentLocation));

			currentStatus = null;
			currentType = null;
			currentLocation = null;
			currentContent = "";

			ctx.close();
		}
	}
}
 
Example #18
Source File: HandlerRedirectUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
public static HttpResponse getRedirectResponse(String redirectAddress, String path, HttpResponseStatus code) {
	checkNotNull(redirectAddress, "Redirect address");
	checkNotNull(path, "Path");

	String newLocation = String.format("%s%s", redirectAddress, path);

	HttpResponse redirectResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, code);
	redirectResponse.headers().set(HttpHeaders.Names.LOCATION, newLocation);
	redirectResponse.headers().set(HttpHeaders.Names.CONTENT_LENGTH, 0);

	return redirectResponse;
}
 
Example #19
Source File: HandlerRedirectUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
public static HttpResponse getResponse(HttpResponseStatus status, @Nullable String message) {
	ByteBuf messageByteBuf = message == null ? Unpooled.buffer(0)
		: Unpooled.wrappedBuffer(message.getBytes(ENCODING));
	FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status, messageByteBuf);
	response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain; charset=" + ENCODING.name());
	response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());

	return response;
}
 
Example #20
Source File: KeepAliveWrite.java    From flink with Apache License 2.0 5 votes vote down vote up
public static ChannelFuture flush(ChannelHandlerContext ctx, HttpRequest request, HttpResponse response) {
	if (!HttpHeaders.isKeepAlive(request)) {
		return ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
	} else {
		response.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
		return ctx.writeAndFlush(response);
	}
}
 
Example #21
Source File: KeepAliveWrite.java    From flink with Apache License 2.0 5 votes vote down vote up
public static ChannelFuture flush(Channel ch, HttpRequest req, HttpResponse res) {
	if (!HttpHeaders.isKeepAlive(req)) {
		return ch.writeAndFlush(res).addListener(ChannelFutureListener.CLOSE);
	} else {
		res.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
		return ch.writeAndFlush(res);
	}
}
 
Example #22
Source File: HandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends the given error response and status code to the given channel.
 *
 * @param channelHandlerContext identifying the open channel
 * @param httpRequest originating http request
 * @param errorMessage which should be sent
 * @param statusCode of the message to send
 * @param headers additional header values
 */
public static CompletableFuture<Void> sendErrorResponse(
		ChannelHandlerContext channelHandlerContext,
		HttpRequest httpRequest,
		ErrorResponseBody errorMessage,
		HttpResponseStatus statusCode,
		Map<String, String> headers) {

	return sendErrorResponse(
		channelHandlerContext,
		HttpHeaders.isKeepAlive(httpRequest),
		errorMessage,
		statusCode,
		headers);
}
 
Example #23
Source File: HandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends the given response and status code to the given channel.
 *
 * @param channelHandlerContext identifying the open channel
 * @param httpRequest originating http request
 * @param message which should be sent
 * @param statusCode of the message to send
 * @param headers additional header values
 */
public static CompletableFuture<Void> sendResponse(
		@Nonnull ChannelHandlerContext channelHandlerContext,
		@Nonnull HttpRequest httpRequest,
		@Nonnull String message,
		@Nonnull HttpResponseStatus statusCode,
		@Nonnull Map<String, String> headers) {

	return sendResponse(
		channelHandlerContext,
		HttpHeaders.isKeepAlive(httpRequest),
		message,
		statusCode,
		headers);
}
 
Example #24
Source File: HandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sends the given response and status code to the given channel.
 *
 * @param channelHandlerContext identifying the open channel
 * @param keepAlive If the connection should be kept alive.
 * @param message which should be sent
 * @param statusCode of the message to send
 * @param headers additional header values
 */
public static CompletableFuture<Void> sendResponse(
		@Nonnull ChannelHandlerContext channelHandlerContext,
		boolean keepAlive,
		@Nonnull String message,
		@Nonnull HttpResponseStatus statusCode,
		@Nonnull Map<String, String> headers) {
	HttpResponse response = new DefaultHttpResponse(HTTP_1_1, statusCode);

	response.headers().set(CONTENT_TYPE, RestConstants.REST_CONTENT_TYPE);

	for (Map.Entry<String, String> headerEntry : headers.entrySet()) {
		response.headers().set(headerEntry.getKey(), headerEntry.getValue());
	}

	if (keepAlive) {
		response.headers().set(CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
	}

	byte[] buf = message.getBytes(ConfigConstants.DEFAULT_CHARSET);
	ByteBuf b = Unpooled.copiedBuffer(buf);
	HttpHeaders.setContentLength(response, buf.length);

	// write the initial line and the header.
	channelHandlerContext.write(response);

	channelHandlerContext.write(b);

	ChannelFuture lastContentFuture = channelHandlerContext.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT);

	// close the connection, if no keep-alive is needed
	if (!keepAlive) {
		lastContentFuture.addListener(ChannelFutureListener.CLOSE);
	}

	return toCompletableFuture(lastContentFuture);
}
 
Example #25
Source File: KeepAliveWrite.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static ChannelFuture flush(Channel ch, HttpRequest req, HttpResponse res) {
	if (!HttpHeaders.isKeepAlive(req)) {
		return ch.writeAndFlush(res).addListener(ChannelFutureListener.CLOSE);
	} else {
		res.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
		return ch.writeAndFlush(res);
	}
}
 
Example #26
Source File: PipelineErrorHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void sendError(ChannelHandlerContext ctx, String error) {
	if (ctx.channel().isActive()) {
		DefaultFullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
			HttpResponseStatus.INTERNAL_SERVER_ERROR,
			Unpooled.wrappedBuffer(error.getBytes(ConfigConstants.DEFAULT_CHARSET)));

		response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
		response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());

		ctx.writeAndFlush(response);
	}
}
 
Example #27
Source File: HttpTestClient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Sends a simple GET request to the given path. You only specify the $path part of
 * http://$host:$host/$path.
 *
 * @param path The $path to GET (http://$host:$host/$path)
 */
public void sendGetRequest(String path, FiniteDuration timeout) throws TimeoutException, InterruptedException {
	if (!path.startsWith("/")) {
		path = "/" + path;
	}

	HttpRequest getRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
			HttpMethod.GET, path);
	getRequest.headers().set(HttpHeaders.Names.HOST, host);
	getRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);

	sendRequest(getRequest, timeout);
}
 
Example #28
Source File: HttpTestClient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Sends a simple DELETE request to the given path. You only specify the $path part of
 * http://$host:$host/$path.
 *
 * @param path The $path to DELETE (http://$host:$host/$path)
 */
public void sendDeleteRequest(String path, FiniteDuration timeout) throws TimeoutException, InterruptedException {
	if (!path.startsWith("/")) {
		path = "/" + path;
	}

	HttpRequest getRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
			HttpMethod.DELETE, path);
	getRequest.headers().set(HttpHeaders.Names.HOST, host);
	getRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);

	sendRequest(getRequest, timeout);
}
 
Example #29
Source File: HttpTestClient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Sends a simple PATCH request to the given path. You only specify the $path part of
 * http://$host:$host/$path.
 *
 * @param path The $path to PATCH (http://$host:$host/$path)
 */
public void sendPatchRequest(String path, FiniteDuration timeout) throws TimeoutException, InterruptedException {
	if (!path.startsWith("/")) {
		path = "/" + path;
	}

	HttpRequest getRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
		HttpMethod.PATCH, path);
	getRequest.headers().set(HttpHeaders.Names.HOST, host);
	getRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);

	sendRequest(getRequest, timeout);
}
 
Example #30
Source File: HttpTestClient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
	LOG.debug("Received {}", msg);

	if (msg instanceof HttpResponse) {
		HttpResponse response = (HttpResponse) msg;

		currentStatus = response.getStatus();
		currentType = response.headers().get(HttpHeaders.Names.CONTENT_TYPE);
		currentLocation = response.headers().get(HttpHeaders.Names.LOCATION);

		if (HttpHeaders.isTransferEncodingChunked(response)) {
			LOG.debug("Content is chunked");
		}
	}

	if (msg instanceof HttpContent) {
		HttpContent content = (HttpContent) msg;

		// Add the content
		currentContent += content.content().toString(CharsetUtil.UTF_8);

		// Finished with this
		if (content instanceof LastHttpContent) {
			responses.add(new SimpleHttpResponse(currentStatus, currentType,
					currentContent, currentLocation));

			currentStatus = null;
			currentType = null;
			currentLocation = null;
			currentContent = "";

			ctx.close();
		}
	}
}