public static void verifyRequest(WebService.Action action, Request request) { switch (request.method()) { case "GET": if (action.isPost()) { throw new ServerException(SC_METHOD_NOT_ALLOWED, "HTTP method POST is required"); } return; case "PUT": case "DELETE": throw new ServerException(SC_METHOD_NOT_ALLOWED, String.format("HTTP method %s is not allowed", request.method())); default: // Nothing to do } } }
public static void verifyRequest(WebService.Action action, Request request) { switch (request.method()) { case "GET": if (action.isPost()) { throw new ServerException(SC_METHOD_NOT_ALLOWED, "HTTP method POST is required"); } return; case "PUT": case "DELETE": throw new ServerException(SC_METHOD_NOT_ALLOWED, String.format("HTTP method %s is not allowed", request.method())); default: // Nothing to do } } }