/*
 * Copyright 2000-2015 JetBrains s.r.o.
 *
 * Licensed 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.jetbrains.builtInWebServer;

import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import io.netty.channel.Channel;
import io.netty.handler.codec.http.FullHttpRequest;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

public abstract class WebServerFileHandler {
  static final ExtensionPointName<WebServerFileHandler> EP_NAME = ExtensionPointName.create("org.jetbrains.webServerFileHandler");

  public abstract boolean process(@NotNull PathInfo pathInfo,
                                  @NotNull CharSequence canonicalRequestPath,
                                  @NotNull Project project,
                                  @NotNull FullHttpRequest request,
                                  @NotNull Channel channel,
                                  boolean isCustomHost) throws IOException;
}
@@ -632,17 +632,16 @@
 ebServer
-;
 %0A%0Aimport
@@ -691,17 +691,16 @@
 ointName
-;
 %0Aimport 
@@ -735,17 +735,16 @@
 .Project
-;
 %0Aimport 
@@ -767,17 +767,16 @@
 .Channel
-;
 %0Aimport 
@@ -822,182 +822,85 @@
 uest
-;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport java.io.IOException;%0A%0Apublic abstract class WebServerFileHandler %7B%0A  static final ExtensionPointName%3CWebServerFileHandler%3E
+%0A%0Aabstract class WebServerFileHandler %7B%0A  companion object %7B%0A    internal val
  EP_
@@ -931,16 +931,38 @@
 e.create
+%3CWebServerFileHandler%3E
 (%22org.je
@@ -995,19 +995,112 @@
 er%22)
-;%0A%0A  public
+%0A  %7D%0A%0A  /**%0A   * canonicalRequestPath contains index file name (if not specified in the request)%0A   */%0A 
  abs
@@ -1105,22 +1105,18 @@
 bstract 
-boolea
+fu
 n proces
@@ -1121,27 +1121,19 @@
 ess(
-@NotNull P
+p
 athInfo
- p
+: P
 athI
@@ -1164,61 +1164,35 @@
     
-           @NotNull CharSequence canonicalRequestPath
+canonicalPath: CharSequence
 ,%0A  
@@ -1216,37 +1216,18 @@
     
-           @NotNull P
+p
 roject
- p
+: P
 roje
@@ -1253,35 +1253,24 @@
         
-           @NotNull
+request:
  FullHtt
@@ -1277,24 +1277,16 @@
 pRequest
- request
 ,%0A      
@@ -1306,37 +1306,18 @@
     
-           @NotNull C
+c
 hannel
- c
+: C
 hann
@@ -1347,58 +1347,248 @@
     
-           boolean isCustomHost) throws IOException;%0A%7D
+projectNameIfNotCustomHost: String?): Boolean%0A%7D%0A%0Afun getRequestPath(canonicalPath: CharSequence, projectNameIfNotCustomHost: String?) = if (projectNameIfNotCustomHost == null) %22/$canonicalPath%22 else %22/$projectNameIfNotCustomHost/$canonicalPath%22

convert WebServerFileHandler to kotlin