package org.zstack.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.zstack.header.rest.RESTConstant;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

/**
 * Created by xing5 on 2016/12/7.
 */
@Controller
public class RestServerController {
    @Autowired
    private RestServer server;

    @RequestMapping(
            value = RestConstants.ALL_PATH,
            method = {
                    RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.GET,
                    RequestMethod.HEAD, RequestMethod.OPTIONS, RequestMethod.PATCH, RequestMethod.TRACE
            }
    )
    public void api(HttpServletRequest request, HttpServletResponse response) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        server.handle(request, response);
    }
}

@@ -260,52 +260,8 @@
 hod;
-%0Aimport org.zstack.header.rest.RESTConstant;
 %0A%0Aim
@@ -741,27 +741,8 @@
 ETE,
- RequestMethod.GET,
 %0A   
@@ -776,77 +776,32 @@
 hod.
-HEAD, RequestMethod.OPTIONS, RequestMethod.PATCH, RequestMethod.TRACE
+GET, RequestMethod.HEAD,
 %0A   

remove unused methods from controller