private Permission permissionForMethod ( String method ) { switch ( method . toUpperCase ( ) ) { case "GET" : return Permission . READ ; case "PUT" : case "DELETE" : return Permission . UPDATE ; case "POST" : return Permission . APPEND ; default : throw new RuntimeException ( "Unexpected REST method: " + method ) ; } }
Map an HTTP method to the permission needed to execute it .