remove unused http services
authorKonstantin Bulenkov <kb@jetbrains.com>
Tue, 19 Apr 2016 21:55:44 +0000 (23:55 +0200)
committerKonstantin Bulenkov <kb@jetbrains.com>
Tue, 19 Apr 2016 21:55:44 +0000 (23:55 +0200)
platform/built-in-server/src/org/jetbrains/ide/ActivateApplicationHttpService.java [deleted file]
platform/built-in-server/src/org/jetbrains/ide/JetBrainsProtocolHandlerHttpService.java [deleted file]
platform/platform-resources/src/META-INF/built-in-server.xml

diff --git a/platform/built-in-server/src/org/jetbrains/ide/ActivateApplicationHttpService.java b/platform/built-in-server/src/org/jetbrains/ide/ActivateApplicationHttpService.java
deleted file mode 100644 (file)
index 27fc0ee..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.jetbrains.ide;
-
-import com.intellij.openapi.wm.IdeFocusManager;
-import com.intellij.openapi.wm.IdeFrame;
-import com.intellij.ui.AppIcon;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.http.FullHttpRequest;
-import io.netty.handler.codec.http.HttpMethod;
-import io.netty.handler.codec.http.HttpResponseStatus;
-import io.netty.handler.codec.http.QueryStringDecoder;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-import java.awt.*;
-import java.io.IOException;
-
-/**
- * @author Konstantin Bulenkov
- */
-public class ActivateApplicationHttpService extends RestService {
-  @NotNull
-  @Override
-  protected String getServiceName() {
-    return "show";
-  }
-
-  @Override
-  protected boolean isMethodSupported(@NotNull HttpMethod method) {
-    return method == HttpMethod.GET;
-  }
-
-  @Nullable
-  @Override
-  public String execute(@NotNull QueryStringDecoder urlDecoder, @NotNull FullHttpRequest request, @NotNull ChannelHandlerContext context)
-    throws IOException {
-    final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame();
-    if (frame instanceof Window) {
-      sendOk(request, context);
-      Runnable runnable = new Runnable() {
-        @Override
-        public void run() {
-          Window window = (Window)frame;
-          window.toFront();
-          window.requestFocusInWindow();
-
-          AppIcon.getInstance().requestFocus(frame);
-
-        }
-      };
-      //noinspection SSBasedInspection
-      SwingUtilities.invokeLater(runnable);
-      return "Success";
-    }
-    sendStatus(HttpResponseStatus.NOT_FOUND, false, context.channel());
-    return "Can't find IDE Frame";
-  }
-}
diff --git a/platform/built-in-server/src/org/jetbrains/ide/JetBrainsProtocolHandlerHttpService.java b/platform/built-in-server/src/org/jetbrains/ide/JetBrainsProtocolHandlerHttpService.java
deleted file mode 100644 (file)
index b6005cc..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.jetbrains.ide;
-
-import com.google.gson.stream.JsonReader;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.JBProtocolCommand;
-import com.intellij.openapi.application.JetBrainsProtocolHandler;
-import com.intellij.openapi.application.ModalityState;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.http.FullHttpRequest;
-import io.netty.handler.codec.http.HttpMethod;
-import io.netty.handler.codec.http.QueryStringDecoder;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.IOException;
-
-/**
- * @author Konstantin Bulenkov
- */
-public class JetBrainsProtocolHandlerHttpService extends RestService {
-  private static final String URL_PARAM_NAME = "url";
-
-  @NotNull
-  @Override
-  protected String getServiceName() {
-    return "internal";
-  }
-
-  @Override
-  protected boolean isMethodSupported(@NotNull HttpMethod method) {
-    return method == HttpMethod.POST;
-  }
-
-  @Nullable
-  @Override
-  public String execute(@NotNull QueryStringDecoder urlDecoder, @NotNull FullHttpRequest request, @NotNull ChannelHandlerContext context) throws IOException {
-    final JsonReader reader = createJsonReader(request);
-    reader.beginObject();
-    final String name = reader.nextName();
-    final String url = reader.nextString();
-    reader.endObject();
-
-    activateLastFocusedFrame();
-
-    if (URL_PARAM_NAME.equals(name) && url != null && url.startsWith(JetBrainsProtocolHandler.PROTOCOL)) {
-      JetBrainsProtocolHandler.processJetBrainsLauncherParameters(url);
-      ApplicationManager.getApplication().invokeLater(JBProtocolCommand::handleCurrentCommand, ModalityState.any());
-    }
-
-    sendOk(request, context);
-    return null;
-  }
-}
index 63a623f6086a439fe076826d2bf563f87bab7450..b38e318efdefa5e079bec4bb2760c28f29653a11 100644 (file)
     <httpRequestHandler implementation="org.jetbrains.ide.XmlRpcServerImpl$XmlRpcRequestHandler"/>
     <httpRequestHandler implementation="org.jetbrains.ide.ProjectSetRequestHandler"/>
     <httpRequestHandler implementation="org.jetbrains.ide.DiffHttpService"/>
-    <httpRequestHandler implementation="org.jetbrains.ide.ActivateApplicationHttpService"/>
     <httpRequestHandler implementation="org.jetbrains.ide.OpenFileHttpService"/>
     <httpRequestHandler implementation="org.jetbrains.ide.AboutHttpService"/>
-    <httpRequestHandler implementation="org.jetbrains.ide.JetBrainsProtocolHandlerHttpService"/>
     <httpRequestHandler implementation="org.jetbrains.builtInWebServer.BuiltInWebServer"/>
   </extensions>
   <extensions defaultExtensionNs="org.jetbrains">