package org.intermine.webservice.server.lists;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.intermine.api.InterMineAPI;
import org.intermine.web.context.InterMineContext;

public class AvailableListsServlet extends HttpServlet
{
    /**
     * Serialisation constant.
     */
    private static final long serialVersionUID = 1L;

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        getAvailableLists(request, response);
    }

    private void getAvailableLists(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new AvailableListsService(im).service(request, response);
    }

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        saveUploadedList(request, response);
    }

    private void saveUploadedList(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new ListUploadService(im).service(request, response);
    }

    @Override
    public void doDelete(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        deleteList(request, response);
    }

    private void deleteList(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new ListDeletionService(im).service(request, response);
    }

}

@@ -52,106 +52,50 @@
 ort 
-java.io.IOException;%0A%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.Http
+org.intermine.webservice.server.Web
 Serv
-let
+ice
 ;%0Aim
@@ -103,453 +103,318 @@
 ort 
-javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport org.intermine.api.InterMineAPI;%0Aimport org.intermine.web.context.InterMineContext;%0A%0Apublic class AvailableListsServlet extends HttpServlet%0A%7B%0A    /**%0A     * Serialisation constant.%0A     */%0A    private static final long serialVersionUID = 1L;%0A%0A    @Override%0A    public void doGet(HttpServletRequest request, HttpServletResponse response)%0A       
+org.intermine.webservice.server.core.NoServiceException;%0Aimport org.intermine.webservice.server.core.WebServiceServlet;%0A%0Apublic class AvailableListsServlet extends WebServiceServlet%0A%7B%0A    private static final long serialVersionUID = 1L;%0A%0A    @Override%0A    protected WebService getService(Method method)
  throws 
 Serv
@@ -409,36 +409,25 @@
  throws 
+No
 Serv
-letException, IO
+ice
 Exceptio
@@ -442,1123 +442,301 @@
     
-getAvailableLists(request, response);
+switch (method) %7B
 %0A    
-%7D%0A%0A
     
-private void getAvailableLists(HttpServletRequest request, HttpServletResponse response) %7B%0A        final InterMineAPI im = InterMineContext.getInterMineAPI();%0A        new AvailableListsService(im).service(request, response);%0A    %7D%0A%0A    @Override%0A    public void doPost(HttpServletRequest request, HttpServletResponse response)%0A        throws ServletException, IOException %7B%0A        saveUploadedList(request, response
+case GET:%0A            return new AvailableListsService(api);%0A        case POST:%0A            return new ListUploadService(api
 );%0A    
-%7D%0A%0A
     
-private void saveUploadedList(HttpServletRequest request, HttpServletResponse response) %7B%0A        final InterMineAPI im = InterMineContext.getInterMineAPI();%0A        new ListUploadService(im).service(request, response
+case DELETE:%0A            return new ListDeletionService(api
 );%0A    
-%7D%0A%0A
     
-@Override%0A    public void doDelete(HttpServletRequest request, HttpServletResponse response)%0A        throws ServletException, IOException %7B%0A        deleteList(request, response
+default:%0A            throw new NoServiceException(
 );%0A    
-%7D%0A%0A
     
-private void deleteList(HttpServletRequest request, HttpServletResponse response) %7B%0A        final InterMineAPI im = InterMineContext.getInterMineAPI();%0A        new ListDeletionService(im).service(request, response);
+%7D
 %0A   

Use the new WebServiceServlet framework