Search in sources :

Example 1 with JarRequestBody

use of org.apache.flink.runtime.webmonitor.handlers.JarRequestBody in project flink by apache.

the class JarHandlerUtils method getProgramArgs.

/**
 * Parse program arguments in jar run or plan request.
 */
private static <R extends JarRequestBody, M extends MessageParameters> List<String> getProgramArgs(HandlerRequest<R> request, Logger log) throws RestHandlerException {
    JarRequestBody requestBody = request.getRequestBody();
    @SuppressWarnings("deprecation") List<String> programArgs = tokenizeArguments(fromRequestBodyOrQueryParameter(emptyToNull(requestBody.getProgramArguments()), () -> getQueryParameter(request, ProgramArgsQueryParameter.class), null, log));
    List<String> programArgsList = fromRequestBodyOrQueryParameter(requestBody.getProgramArgumentsList(), () -> request.getQueryParameter(ProgramArgQueryParameter.class), null, log);
    if (!programArgsList.isEmpty()) {
        if (!programArgs.isEmpty()) {
            throw new RestHandlerException("Confusing request: programArgs and programArgsList are specified, please, use only programArgsList", HttpResponseStatus.BAD_REQUEST);
        }
        return programArgsList;
    } else {
        return programArgs;
    }
}
Also used : ProgramArgQueryParameter(org.apache.flink.runtime.webmonitor.handlers.ProgramArgQueryParameter) JarRequestBody(org.apache.flink.runtime.webmonitor.handlers.JarRequestBody) RestHandlerException(org.apache.flink.runtime.rest.handler.RestHandlerException)

Aggregations

RestHandlerException (org.apache.flink.runtime.rest.handler.RestHandlerException)1 JarRequestBody (org.apache.flink.runtime.webmonitor.handlers.JarRequestBody)1 ProgramArgQueryParameter (org.apache.flink.runtime.webmonitor.handlers.ProgramArgQueryParameter)1