MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / validateHttpRpcPluginPath

Method validateHttpRpcPluginPath

src/tsd/RpcManager.java:396–412  ·  view source on GitHub ↗

Ensure that the given path for an HttpRpcPlugin is valid. This method simply returns for valid inputs; throws and exception otherwise. @param path a request path, no query parameters, etc. @throws IllegalArgumentException on invalid paths.

(final String path)

Source from the content-addressed store, hash-verified

394 * @throws IllegalArgumentException on invalid paths.
395 */
396 @VisibleForTesting
397 protected void validateHttpRpcPluginPath(final String path) {
398 Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
399 "Invalid HttpRpcPlugin path. Path is null or empty.");
400 final String testPath = path.trim();
401 Preconditions.checkArgument(!HAS_PLUGIN_BASE_WEBPATH.matcher(path).matches(),
402 "Invalid HttpRpcPlugin path %s. Path contains system's plugin base path.",
403 testPath);
404
405 URI uri = URI.create(testPath);
406 Preconditions.checkArgument(!Strings.isNullOrEmpty(uri.getPath()),
407 "Invalid HttpRpcPlugin path %s. Parsed path is null or empty.", testPath);
408 Preconditions.checkArgument(!uri.getPath().equals("/"),
409 "Invalid HttpRpcPlugin path %s. Path is equal to root.", testPath);
410 Preconditions.checkArgument(Strings.isNullOrEmpty(uri.getQuery()),
411 "Invalid HttpRpcPlugin path %s. Path contains query parameters.", testPath);
412 }
413
414 /**
415 * @param origPath a request path, no query parameters, etc.

Calls 5

matchesMethod · 0.45
createMethod · 0.45
getPathMethod · 0.45
equalsMethod · 0.45
getQueryMethod · 0.45