org.apache.flink.runtime.webmonitor.handlers.ProgramArgQueryParameter Java Examples

The following examples show how to use org.apache.flink.runtime.webmonitor.handlers.ProgramArgQueryParameter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JarHandlerUtils.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/** Parse program arguments in jar run or plan request. */
private static <R extends JarRequestBody, M extends MessageParameters> List<String> getProgramArgs(
		HandlerRequest<R, M> 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;
	}
}
 
Example #2
Source File: JarHandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/** Parse program arguments in jar run or plan request. */
private static <R extends JarRequestBody, M extends MessageParameters> List<String> getProgramArgs(
		HandlerRequest<R, M> 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;
	}
}
 
Example #3
Source File: JarHandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/** Parse program arguments in jar run or plan request. */
private static <R extends JarRequestBody, M extends MessageParameters> List<String> getProgramArgs(
		HandlerRequest<R, M> 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;
	}
}