Skip to content

Commit

Permalink
Rollback Fixes for #153
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed May 16, 2022
1 parent a55ec9a commit d7480db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import io.netty.util.AttributeKey;
import io.netty.util.CharsetUtil;
import org.atmosphere.nettosphere.util.MimeType;
import org.atmosphere.nettosphere.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -201,9 +200,7 @@ public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) thr
}
request.headers().add(SERVICED, "true");

if (Utils.isJersey()) {
ctx.pipeline().addBefore(BridgeRuntime.class.getName(), "encoder", new HttpResponseEncoder());
}
ctx.pipeline().addBefore(BridgeRuntime.class.getName(), "encoder", new HttpResponseEncoder());

// Cache Validation
String ifModifiedSince = request.headers().get(IF_MODIFIED_SINCE);
Expand All @@ -219,7 +216,7 @@ public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) thr
sendNotModified(ctx);
return;
}
}
} fdsfsd

long fileLength = raf.length();
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
Expand Down Expand Up @@ -269,9 +266,9 @@ public void operationComplete(ChannelProgressiveFuture future) {
});

if (!keepAlive) {
// Close the connection when the whole content is written out.
lastContentFuture.addListener(ChannelFutureListener.CLOSE);
}
// Close the connection when the whole content is written out.
lastContentFuture.addListener(ChannelFutureListener.CLOSE);
}
}

@Override
Expand Down Expand Up @@ -353,8 +350,7 @@ public void sendError(ChannelHandlerContext ctx, HttpResponseStatus status, Full
/**
* When file timestamp is the same as what the browser is sending up, send a "304 Not Modified"
*
* @param ctx
* Context
* @param ctx Context
*/
private static void sendNotModified(ChannelHandlerContext ctx) {
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED);
Expand All @@ -367,8 +363,7 @@ private static void sendNotModified(ChannelHandlerContext ctx) {
/**
* Sets the Date header for the HTTP response
*
* @param response
* HTTP response
* @param response HTTP response
*/
private static void setDateHeader(FullHttpResponse response) {
SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US);
Expand All @@ -381,10 +376,8 @@ private static void setDateHeader(FullHttpResponse response) {
/**
* Sets the Date and Cache headers for the HTTP Response
*
* @param response
* HTTP response
* @param fileToCache
* file to extract content type
* @param response HTTP response
* @param fileToCache file to extract content type
*/
private static void setDateAndCacheHeaders(HttpResponse response, File fileToCache) {
SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US);
Expand All @@ -405,10 +398,8 @@ private static void setDateAndCacheHeaders(HttpResponse response, File fileToCac
/**
* Sets the content type header for the HTTP Response
*
* @param response
* HTTP response
* @param file
* file to extract content type
* @param response HTTP response
* @param file file to extract content type
*/
private static void setContentTypeHeader(HttpResponse response, File file) {
MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ protected void initChannel(Channel ch) throws Exception {
pipeline.addLast("ssl", config.nettySslContext().newHandler(ch.alloc()));
}

// For backward compatibility
if (Utils.isJersey()) {
pipeline.addLast("decoder", new HttpRequestDecoder());
} else {
pipeline.addLast(new HttpServerCodec());
}
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpObjectAggregator(config.maxChunkContentLength()));

if (config.supportChunking()) {
Expand Down

0 comments on commit d7480db

Please sign in to comment.