server: small refactoring, JsonMethodHandler