Github user uce commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3460#discussion_r104407277
  
    --- Diff: 
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/files/AbstractStaticFileServerHandler.java
 ---
    @@ -0,0 +1,350 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.flink.runtime.webmonitor.files;
    +
    
+/*****************************************************************************
    + * This code is based on the "HttpStaticFileServerHandler" from the
    + * Netty project's HTTP server example.
    + *
    + * See http://netty.io and
    + * 
https://github.com/netty/netty/blob/4.0/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java
    + 
*****************************************************************************/
    +
    +import io.netty.buffer.Unpooled;
    +import io.netty.channel.ChannelFuture;
    +import io.netty.channel.ChannelFutureListener;
    +import io.netty.channel.ChannelHandlerContext;
    +import io.netty.channel.DefaultFileRegion;
    +import io.netty.channel.SimpleChannelInboundHandler;
    +import io.netty.handler.codec.http.DefaultFullHttpResponse;
    +import io.netty.handler.codec.http.DefaultHttpResponse;
    +import io.netty.handler.codec.http.FullHttpResponse;
    +import io.netty.handler.codec.http.HttpChunkedInput;
    +import io.netty.handler.codec.http.HttpHeaders;
    +import io.netty.handler.codec.http.HttpRequest;
    +import io.netty.handler.codec.http.HttpResponse;
    +import io.netty.handler.codec.http.HttpResponseStatus;
    +import io.netty.handler.codec.http.LastHttpContent;
    +import io.netty.handler.codec.http.router.Routed;
    +import io.netty.handler.ssl.SslHandler;
    +import io.netty.handler.stream.ChunkedFile;
    +import io.netty.util.CharsetUtil;
    +import org.apache.flink.util.Preconditions;
    +import org.slf4j.Logger;
    +
    +import java.io.File;
    +import java.io.FileNotFoundException;
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.io.RandomAccessFile;
    +import java.net.URI;
    +import java.net.URL;
    +import java.nio.file.Files;
    +import java.text.ParseException;
    +import java.text.SimpleDateFormat;
    +import java.util.Calendar;
    +import java.util.Date;
    +import java.util.GregorianCalendar;
    +import java.util.Locale;
    +import java.util.TimeZone;
    +
    +import static io.netty.handler.codec.http.HttpHeaders.Names.CACHE_CONTROL;
    +import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION;
    +import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;
    +import static io.netty.handler.codec.http.HttpHeaders.Names.DATE;
    +import static io.netty.handler.codec.http.HttpHeaders.Names.EXPIRES;
    +import static 
io.netty.handler.codec.http.HttpHeaders.Names.IF_MODIFIED_SINCE;
    +import static io.netty.handler.codec.http.HttpHeaders.Names.LAST_MODIFIED;
    +import static 
io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR;
    +import static io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
    +import static io.netty.handler.codec.http.HttpResponseStatus.NOT_MODIFIED;
    +import static io.netty.handler.codec.http.HttpResponseStatus.OK;
    +import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
    +
    +/**
    + * Simple file server handler that serves requests to web frontend's 
static files, such as
    + * HTML, CSS, or JS files.
    + *
    + * <p>This code is based on the "HttpStaticFileServerHandler" from the 
Netty project's HTTP server
    + * example.</p>
    + */
    +public abstract class AbstractStaticFileServerHandler extends 
SimpleChannelInboundHandler<Routed> {
    --- End diff --
    
    Could you please update the comments to reflect your refactorings for the 
"request life cycle"? BTW You can remove the closing `</p>` tag, too (I know 
it's copied from `master`).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to