package codeOrchestra.colt.core.rpc;

import codeOrchestra.colt.core.loading.LiveCodingHandlerManager;
import codeOrchestra.colt.core.logging.Logger;
import com.googlecode.jsonrpc4j.JsonRpcServer;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Alexander Eliseyev
 */
public class COLTRemoteServiceServlet extends HttpServlet {
  
  private static final Logger LOG = Logger.getLogger(COLTRemoteServiceServlet.class);
  
  private COLTRemoteService coltRemoteService;
  private JsonRpcServer jsonRpcServer;
  
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    doPost(req, resp);
  }
  
  protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
    try {
      jsonRpcServer.handle(req, resp);
    } catch (IOException e) {
      LOG.error(e);
    }
  }

  public void init(ServletConfig config) {
    this.coltRemoteService = LiveCodingHandlerManager.getInstance().getCurrentHandler().getRPCService();
    this.jsonRpcServer = new JsonRpcServer(this.coltRemoteService, COLTRemoteService.class);
  }

}

@@ -66,38 +66,21 @@
 ore.
-loading.LiveCodingHandlerManag
+ServiceProvid
 er;%0A
@@ -1105,81 +1105,51 @@
 e = 
-LiveCodingHandlerManager.getInstance().getCurrentHandler().getRPC
+ServiceProvider.get(COLTRemote
 Service
-(
+.class
 );%0A 

Revert "Revert "[COLT-392]""