use of org.apache.flink.runtime.rest.handler.async.AsynchronousOperationStatusMessageHeaders in project flink by apache.
the class RestAPIDocGenerator method createHtmlEntry.
private static String createHtmlEntry(MessageHeaders<?, ?, ?> spec) {
Class<?> nestedAsyncOperationResultClass = null;
if (spec instanceof AsynchronousOperationStatusMessageHeaders) {
nestedAsyncOperationResultClass = ((AsynchronousOperationStatusMessageHeaders<?, ?>) spec).getValueClass();
}
String requestEntry = createMessageHtmlEntry(spec.getRequestClass(), null, EmptyRequestBody.class);
String responseEntry = createMessageHtmlEntry(spec.getResponseClass(), nestedAsyncOperationResultClass, EmptyResponseBody.class);
String pathParameterList = createPathParameterHtmlList(spec.getUnresolvedMessageParameters().getPathParameters());
String queryParameterList = createQueryParameterHtmlList(spec.getUnresolvedMessageParameters().getQueryParameters());
StringBuilder sb = new StringBuilder();
{
sb.append("<table class=\"rest-api table table-bordered\">\n");
sb.append(" <tbody>\n");
sb.append(" <tr>\n");
sb.append(" <td class=\"text-left\" colspan=\"2\"><h5><strong>" + spec.getTargetRestEndpointURL() + "</strong></h5></td>\n");
sb.append(" </tr>\n");
sb.append(" <tr>\n");
sb.append(" <td class=\"text-left\" style=\"width: 20%\">Verb: <code>" + spec.getHttpMethod() + "</code></td>\n");
sb.append(" <td class=\"text-left\">Response code: <code>" + spec.getResponseStatusCode() + "</code></td>\n");
sb.append(" </tr>\n");
sb.append(" <tr>\n");
sb.append(" <td colspan=\"2\">" + escapeCharacters(spec.getDescription()) + "</td>\n");
sb.append(" </tr>\n");
}
if (!pathParameterList.isEmpty()) {
sb.append(" <tr>\n");
sb.append(" <td colspan=\"2\">Path parameters</td>\n");
sb.append(" </tr>\n");
sb.append(" <tr>\n");
sb.append(" <td colspan=\"2\">\n");
sb.append(" <ul>\n");
sb.append(pathParameterList);
sb.append(" </ul>\n");
sb.append(" </td>\n");
sb.append(" </tr>\n");
}
if (!queryParameterList.isEmpty()) {
sb.append(" <tr>\n");
sb.append(" <td colspan=\"2\">Query parameters</td>\n");
sb.append(" </tr>\n");
sb.append(" <tr>\n");
sb.append(" <td colspan=\"2\">\n");
sb.append(" <ul>\n");
sb.append(queryParameterList);
sb.append(" </ul>\n");
sb.append(" </td>\n");
sb.append(" </tr>\n");
}
int reqHash = spec.getTargetRestEndpointURL().hashCode() + spec.getHttpMethod().name().hashCode() + spec.getRequestClass().getCanonicalName().hashCode();
int resHash = spec.getTargetRestEndpointURL().hashCode() + spec.getHttpMethod().name().hashCode() + spec.getResponseClass().getCanonicalName().hashCode();
{
sb.append(" <tr>\n");
sb.append(" <td colspan=\"2\">\n");
sb.append(" <div class=\"book-expand\">\n");
sb.append(" <label>\n");
sb.append(" <div class=\"book-expand-head flex justify-between\">\n");
sb.append(" <span>Request</span>\n");
sb.append(" ");
sb.append(" <span>▾</span>\n");
sb.append(" </div>\n");
sb.append(" <input type=\"checkbox\" class=\"hidden\">\n");
sb.append(" <div class=\"book-expand-content markdown-inner\">\n");
sb.append(" <pre>\n");
sb.append(" <code>\n");
sb.append(requestEntry);
sb.append(" </code>\n");
sb.append(" </pre>\n");
sb.append(" </div>\n");
sb.append(" </label>\n");
sb.append(" </div>\n");
sb.append(" </td>\n");
sb.append(" </tr>\n");
sb.append(" <tr>\n");
sb.append(" <td colspan=\"2\">\n");
sb.append(" <div class=\"book-expand\">\n");
sb.append(" <label>\n");
sb.append(" <div class=\"book-expand-head flex justify-between\">\n");
sb.append(" <span>Response</span>\n");
sb.append(" ");
sb.append(" <span>▾</span>\n");
sb.append(" </div>\n");
sb.append(" <input type=\"checkbox\" class=\"hidden\">\n");
sb.append(" <div class=\"book-expand-content markdown-inner\">\n");
sb.append(" <pre>\n");
sb.append(" <code>\n");
sb.append(responseEntry);
sb.append(" </code>\n");
sb.append(" </pre>\n");
sb.append(" </div>\n");
sb.append(" </label>\n");
sb.append(" </div>\n");
sb.append(" </td>\n");
sb.append(" </tr>\n");
sb.append(" </tbody>\n");
sb.append("</table>\n");
}
return sb.toString();
}
Aggregations