/** * Get a REST request handler */ public RestHandler getRestHandler(String path, String method) { method = method.toUpperCase(); if (path != null) { if (path.startsWith("/")) { path = path.substring(1); } String[] pathParts = StringUtils.splitPreserveAllTokens(path, '/'); Map<String, SortedSet<RestPath>> methods = serviceMethodPathMap.get(pathParts[0]); if (methods != null) { SortedSet<RestPath> paths = methods.get(method); if (paths != null) { for (RestPath restPath : paths) { RestHandler handler = restPath.accept(pathParts); if (handler != null) { return handler; } } } } } return new ErrorRestHandler(new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "No service defined for path " + path)); }
/** * Get a REST request handler */ public RestHandler getRestHandler(String path, String method) { method = method.toUpperCase(); if (path != null) { if (path.startsWith("/")) { path = path.substring(1); } String[] pathParts = StringUtils.splitPreserveAllTokens(path, '/'); Map<String, SortedSet<RestPath>> methods = serviceMethodPathMap.get(pathParts[0]); if (methods != null) { SortedSet<RestPath> paths = methods.get(method); if (paths != null) { for (RestPath restPath : paths) { RestHandler handler = restPath.accept(pathParts); if (handler != null) { return handler; } } } } } return new ErrorRestHandler(new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "No service defined for path " + path)); }
/** * Get a REST request handler */ public RestHandler getRestHandler(String path, String method) { method = method.toUpperCase(); if (path != null) { if (path.startsWith("/")) { path = path.substring(1); } String[] pathParts = StringUtils.splitPreserveAllTokens(path, '/'); Map<String, SortedSet<RestPath>> methods = serviceMethodPathMap.get(pathParts[0]); if (methods != null) { SortedSet<RestPath> paths = methods.get(method); if (paths != null) { for (RestPath restPath : paths) { RestHandler handler = restPath.accept(pathParts); if (handler != null) { return handler; } } } } } return new ErrorRestHandler(new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "No service defined for path " + path)); }
/** * Get a REST request handler */ public RestHandler getRestHandler(String path, String method) { method = method.toUpperCase(); if (path != null) { if (path.startsWith("/")) { path = path.substring(1); } String[] pathParts = StringUtils.splitPreserveAllTokens(path, '/'); Map<String, SortedSet<RestPath>> methods = serviceMethodPathMap.get(pathParts[0]); if (methods != null) { SortedSet<RestPath> paths = methods.get(method); if (paths != null) { for (RestPath restPath : paths) { RestHandler handler = restPath.accept(pathParts); if (handler != null) { return handler; } } } } } return new ErrorRestHandler(new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "No service defined for path " + path)); }
/** * Get a REST request handler */ public RestHandler getRestHandler(String path, String method) { method = method.toUpperCase(); if (path != null) { if (path.startsWith("/")) { path = path.substring(1); } String[] pathParts = StringUtils.splitPreserveAllTokens(path, '/'); Map<String, SortedSet<RestPath>> methods = serviceMethodPathMap.get(pathParts[0]); if (methods != null) { SortedSet<RestPath> paths = methods.get(method); if (paths != null) { for (RestPath restPath : paths) { RestHandler handler = restPath.accept(pathParts); if (handler != null) { return handler; } } } } } return new ErrorRestHandler(new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "No service defined for path " + path)); }