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;
}
}
Aggregations