the servlet specification allows only GET , HEAD , POST , PUT , DELETE , OPTIONS or TRACE HTTP. This can be seen in the Apache Tomcat implementation of the servlet API .
And this is reflected in the Spring API RequestMethod enumeration .
You can trick them by implementing your own DispatcherServlet , overriding the service method to enable the HTTP COPY method - change it to the POST method and configure the RequestMappingHandlerAdapter bean to allow this.
Something like this using spring-boot:
@Controller @EnableAutoConfiguration @Configuration public class HttpMethods extends WebMvcConfigurationSupport { public static class CopyMethodDispatcher extends DispatcherServlet { private static final long serialVersionUID = 1L; @Override protected void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { if ("COPY".equals(request.getMethod())) { super.doPost(request, response); } else { super.service(request, response); } } } public static void main(final String[] args) throws Exception { SpringApplication.run(HttpMethods.class, args); } @RequestMapping("/method") @ResponseBody public String customMethod(final HttpServletRequest request) { return request.getMethod(); } @Override @Bean public RequestMappingHandlerAdapter requestMappingHandlerAdapter() { final RequestMappingHandlerAdapter requestMappingHandlerAdapter = super.requestMappingHandlerAdapter(); requestMappingHandlerAdapter.setSupportedMethods("COPY", "POST", "GET");
Now you can invoke the endpoint /method using the COPY HTTP method. Using curl , this will be:
curl -v -X COPY http:
source share