Skip to content

Commit

Permalink
method first then path
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymode committed Feb 7, 2020
1 parent 2b69b84 commit 2653271
Show file tree
Hide file tree
Showing 241 changed files with 482 additions and 482 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public class RestNoopBulkAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_noop_bulk", POST),
new Route("/_noop_bulk", PUT),
new Route("/{index}/_noop_bulk", POST),
new Route("/{index}/_noop_bulk", PUT)));
new Route(POST, "/_noop_bulk"),
new Route(PUT, "/_noop_bulk"),
new Route(POST, "/{index}/_noop_bulk"),
new Route(PUT, "/{index}/_noop_bulk")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public class RestNoopSearchAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_noop_search", GET),
new Route("/_noop_search", POST),
new Route("/{index}/_noop_search", GET),
new Route("/{index}/_noop_search", POST)));
new Route(GET, "/_noop_search"),
new Route(POST, "/_noop_search"),
new Route(GET, "/{index}/_noop_search"),
new Route(POST, "/{index}/_noop_search")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static class RestAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_ingest/processor/grok", GET));
return singletonList(new Route(GET, "/_ingest/processor/grok"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public RestMultiSearchTemplateAction(Settings settings) {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_msearch/template", GET),
new Route("/_msearch/template", POST),
new Route("/{index}/_msearch/template", GET),
new Route("/{index}/_msearch/template", POST)));
new Route(GET, "/_msearch/template"),
new Route(POST, "/_msearch/template"),
new Route(GET, "/{index}/_msearch/template"),
new Route(POST, "/{index}/_msearch/template")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public class RestRenderSearchTemplateAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_render/template", GET),
new Route("/_render/template", POST),
new Route("/_render/template/{id}", GET),
new Route("/_render/template/{id}", POST)));
new Route(GET, "/_render/template"),
new Route(POST, "/_render/template"),
new Route(GET, "/_render/template/{id}"),
new Route(POST, "/_render/template/{id}")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public class RestSearchTemplateAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_search/template", GET),
new Route("/_search/template", POST),
new Route("/{index}/_search/template", GET),
new Route("/{index}/_search/template", POST)));
new Route(GET, "/_search/template"),
new Route(POST, "/_search/template"),
new Route(GET, "/{index}/_search/template"),
new Route(POST, "/{index}/_search/template")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public static class RestAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_scripts/painless/_context", GET));
return singletonList(new Route(GET, "/_scripts/painless/_context"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ public static class RestAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_scripts/painless/_execute", GET),
new Route("/_scripts/painless/_execute", POST)));
new Route(GET, "/_scripts/painless/_execute"),
new Route(POST, "/_scripts/painless/_execute")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public class RestRankEvalAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/" + ENDPOINT, GET),
new Route("/" + ENDPOINT, POST),
new Route("/{index}/" + ENDPOINT, GET),
new Route("/{index}/" + ENDPOINT, POST)));
new Route(GET, "/" + ENDPOINT),
new Route(POST, "/" + ENDPOINT),
new Route(GET, "/{index}/" + ENDPOINT),
new Route(POST, "/{index}/" + ENDPOINT)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public RestDeleteByQueryAction() {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/{index}/_delete_by_query", POST));
return singletonList(new Route(POST, "/{index}/_delete_by_query"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public RestReindexAction() {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_reindex", POST));
return singletonList(new Route(POST, "/_reindex"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public RestRethrottleAction(Supplier<DiscoveryNodes> nodesInCluster) {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_update_by_query/{taskId}/_rethrottle", POST),
new Route("/_delete_by_query/{taskId}/_rethrottle", POST),
new Route("/_reindex/{taskId}/_rethrottle", POST)));
new Route(POST, "/_update_by_query/{taskId}/_rethrottle"),
new Route(POST, "/_delete_by_query/{taskId}/_rethrottle"),
new Route(POST, "/_reindex/{taskId}/_rethrottle")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public RestUpdateByQueryAction() {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/{index}/_update_by_query", POST));
return singletonList(new Route(POST, "/{index}/_update_by_query"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class ExampleCatAction extends AbstractCatAction {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_cat/example", GET),
new Route("/_cat/example", POST)));
new Route(GET, "/_cat/example"),
new Route(POST, "/_cat/example")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class RestDieWithDignityAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_die_with_dignity", GET));
return singletonList(new Route(GET, "/_die_with_dignity"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public TestDeprecationHeaderRestAction(Settings settings) {
@Override
public List<DeprecatedRoute> deprecatedRoutes() {
return singletonList(
new DeprecatedRoute("/_test_cluster/deprecated_settings", GET, DEPRECATED_ENDPOINT, deprecationLogger));
new DeprecatedRoute(GET, "/_test_cluster/deprecated_settings", DEPRECATED_ENDPOINT, deprecationLogger));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class TestResponseHeaderRestAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_protected", GET));
return singletonList(new Route(GET, "/_protected"));
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions server/src/main/java/org/elasticsearch/rest/RestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Route {
private final String path;
private final Method method;

public Route(String path, Method method) {
public Route(Method method, String path) {
this.path = path;
this.method = method;
}
Expand All @@ -117,8 +117,8 @@ class DeprecatedRoute extends Route {
private final String deprecationMessage;
private final DeprecationLogger logger;

public DeprecatedRoute(String path, Method method, String deprecationMessage, DeprecationLogger logger) {
super(path, method);
public DeprecatedRoute(Method method, String path, String deprecationMessage, DeprecationLogger logger) {
super(method, path);
this.deprecationMessage = deprecationMessage;
this.logger = logger;
}
Expand All @@ -143,7 +143,7 @@ class ReplacedRoute extends Route {
private final DeprecationLogger logger;

public ReplacedRoute(Method method, String path, Method deprecatedMethod, String deprecatedPath, DeprecationLogger logger) {
super(path, method);
super(method, path);
this.deprecatedMethod = deprecatedMethod;
this.deprecatedPath = deprecatedPath;
this.logger = logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public class RestFieldCapabilitiesAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_field_caps", GET),
new Route("/_field_caps", POST),
new Route("/{index}/_field_caps", GET),
new Route("/{index}/_field_caps", POST)));
new Route(GET, "/_field_caps"),
new Route(POST, "/_field_caps"),
new Route(GET, "/{index}/_field_caps"),
new Route(POST, "/{index}/_field_caps")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class RestMainAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/", GET),
new Route("/", HEAD)));
new Route(GET, "/"),
new Route(HEAD, "/")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String getName() {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_cluster/voting_config_exclusions/{node_name}", POST));
return singletonList(new Route(POST, "/_cluster/voting_config_exclusions/{node_name}"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public String getName() {

@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(new Route("/_tasks/_cancel", POST),
new Route("/_tasks/{task_id}/_cancel", POST)));
return unmodifiableList(asList(new Route(POST, "/_tasks/_cancel"),
new Route(POST, "/_tasks/{task_id}/_cancel")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class RestCleanupRepositoryAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_snapshot/{repository}/_cleanup", POST));
return singletonList(new Route(POST, "/_snapshot/{repository}/_cleanup"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class RestClearVotingConfigExclusionsAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_cluster/voting_config_exclusions", DELETE));
return singletonList(new Route(DELETE, "/_cluster/voting_config_exclusions"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class RestClusterAllocationExplainAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_cluster/allocation/explain", GET),
new Route("/_cluster/allocation/explain", POST)));
new Route(GET, "/_cluster/allocation/explain"),
new Route(POST, "/_cluster/allocation/explain")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public RestClusterGetSettingsAction(Settings settings, ClusterSettings clusterSe

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_cluster/settings", GET));
return singletonList(new Route(GET, "/_cluster/settings"));
}
@Override
public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class RestClusterHealthAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(new Route("/_cluster/health", GET),
new Route("/_cluster/health/{index}", GET)));
return unmodifiableList(asList(new Route(GET, "/_cluster/health"),
new Route(GET, "/_cluster/health/{index}")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public RestClusterRerouteAction(SettingsFilter settingsFilter) {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_cluster/reroute", POST));
return singletonList(new Route(POST, "/_cluster/reroute"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public class RestClusterSearchShardsAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_search_shards", GET),
new Route("/_search_shards", POST),
new Route("/{index}/_search_shards", GET),
new Route("/{index}/_search_shards", POST)));
new Route(GET, "/_search_shards"),
new Route(POST, "/_search_shards"),
new Route(GET, "/{index}/_search_shards"),
new Route(POST, "/{index}/_search_shards")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public String getName() {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_cluster/state", GET),
new Route("/_cluster/state/{metric}", GET),
new Route("/_cluster/state/{metric}/{indices}", GET)));
new Route(GET, "/_cluster/state"),
new Route(GET, "/_cluster/state/{metric}"),
new Route(GET, "/_cluster/state/{metric}/{indices}")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public class RestClusterStatsAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_cluster/stats", GET),
new Route("/_cluster/stats/nodes/{nodeId}", GET)));
new Route(GET, "/_cluster/stats"),
new Route(GET, "/_cluster/stats/nodes/{nodeId}")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_cluster/settings", PUT));
return singletonList(new Route(PUT, "/_cluster/settings"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class RestCreateSnapshotAction extends BaseRestHandler {
@Override
public List<Route> handledRoutes() {
return unmodifiableList(asList(
new Route("/_snapshot/{repository}/{snapshot}", PUT),
new Route("/_snapshot/{repository}/{snapshot}", POST)));
new Route(PUT, "/_snapshot/{repository}/{snapshot}"),
new Route(POST, "/_snapshot/{repository}/{snapshot}")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class RestDeleteRepositoryAction extends BaseRestHandler {

@Override
public List<Route> handledRoutes() {
return singletonList(new Route("/_snapshot/{repository}", DELETE));
return singletonList(new Route(DELETE, "/_snapshot/{repository}"));
}

@Override
Expand Down
Loading

0 comments on commit 2653271

Please sign in to comment.