parent
d7b0d547d4
commit
2f48be597e
|
@ -13,7 +13,7 @@ when looking at an ssh terminal, need compact and aligned text. The
|
||||||
cat API aims to meet this need.
|
cat API aims to meet this need.
|
||||||
|
|
||||||
All the cat commands accept a query string parameter `help` to see all
|
All the cat commands accept a query string parameter `help` to see all
|
||||||
the headers and info they provide, and the `/_cat?help` command lists all
|
the headers and info they provide, and the `/_cat` command alone lists all
|
||||||
the available commands.
|
the available commands.
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class RestCatAction extends BaseRestHandler {
|
||||||
super(settings, client);
|
super(settings, client);
|
||||||
controller.registerHandler(GET, "/_cat", this);
|
controller.registerHandler(GET, "/_cat", this);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(CAT).append(" try:\n");
|
sb.append(CAT_NL);
|
||||||
for (AbstractCatAction catAction : catActions) {
|
for (AbstractCatAction catAction : catActions) {
|
||||||
catAction.documentation(sb);
|
catAction.documentation(sb);
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,7 @@ public class RestCatAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
try {
|
try {
|
||||||
boolean helpWanted = request.paramAsBoolean("h", request.paramAsBoolean("help", false));
|
|
||||||
if (helpWanted) {
|
|
||||||
channel.sendResponse(new StringRestResponse(RestStatus.OK, HELP));
|
channel.sendResponse(new StringRestResponse(RestStatus.OK, HELP));
|
||||||
} else {
|
|
||||||
channel.sendResponse(new StringRestResponse(RestStatus.OK, CAT_NL));
|
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
try {
|
try {
|
||||||
channel.sendResponse(new XContentThrowableRestResponse(request, t));
|
channel.sendResponse(new XContentThrowableRestResponse(request, t));
|
||||||
|
|
Loading…
Reference in New Issue