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