--- Revision None +++ Revision 623763306433 @@ -0,0 +1,33 @@ +Index: RestViewJsonService.java +=================================================================== +--- RestViewJsonService.java (revision 334) ++++ RestViewJsonService.java (working copy) +@@ -55,18 +55,22 @@ + + @Override + public void renderService() throws ServiceException { +- if ("GET".equalsIgnoreCase(getHttpRequest().getMethod())) { ++ String method = getHttpRequest().getMethod(); ++ if ("GET".equalsIgnoreCase(method)) { + renderServiceJSONGet(); +- } else if ("POST".equalsIgnoreCase(getHttpRequest().getMethod())) { +- renderServiceJSONUpdate(0); +- } else if ("PUT".equalsIgnoreCase(getHttpRequest().getMethod())) { ++ } else if ("POST".equalsIgnoreCase(method)) { ++ String override = getHttpRequest().getHeader("X-HTTP-Method-Override"); ++ if ("PUT".equalsIgnoreCase(override)) renderServiceJSONUpdate(1); ++ else if ("DELETE".equalsIgnoreCase(override)) renderServiceJSONUpdate(2); ++ else renderServiceJSONUpdate(0); ++ } else if ("PUT".equalsIgnoreCase(method)) { + renderServiceJSONUpdate(1); +- } else if ("DELETE".equalsIgnoreCase(getHttpRequest().getMethod())) { ++ } else if ("DELETE".equalsIgnoreCase(method)) { + renderServiceJSONUpdate(2); + } else { + // Use a different status for an error? + //HttpServletResponse.SC_METHOD_NOT_ALLOWED; +- throw new ServiceException(null,"Method {0} is not allowed with JSON Rest Service",getHttpRequest().getMethod()); ++ throw new ServiceException(null,"Method {0} is not allowed with JSON Rest Service",method); + } + } +