package org.apache.flink.runtime.webmonitor.handlers; /** * Handles .jar file uploads. */ public class JarUploadHandler extends AbstractRestHandler {
package org.apache.flink.runtime.rest; public abstract class AbstractHandler extends RedirectHandler { protected final Logger log = LoggerFactory.getLogger(getClass()); protected static final ObjectMapper MAPPER = RestMapperUtils.getStrictObjectMapper(); private final UntypedResponseMessageHeaders untypedResponseMessageHeaders; protected AbstractHandler( @Nonnull CompletableFuture localAddressFuture, @Nonnull GatewayRetriever leaderRetriever, @Nonnull Time timeout, @Nonnull Map responseHeaders, @Nonnull UntypedResponseMessageHeaders untypedResponseMessageHeaders) { super(localAddressFuture, leaderRetriever, timeout, responseHeaders); this.untypedResponseMessageHeaders = Preconditions.checkNotNull(untypedResponseMessageHeaders); } @Override protected void respondAsLeader(ChannelHandlerContext ctx, RoutedRequest routedRequest, T gateway) { HttpRequest httpRequest = routedRequest.getRequest(); if (log.isTraceEnabled()) { log.trace("Received request " + httpRequest.uri() + '.'); } FileUploads uploadedFiles = null; try { if (!(httpRequest instanceof FullHttpRequest)) { // The RestServerEndpoint defines a HttpObjectAggregator in the pipeline that always returns // FullHttpRequests. log.error("Implementation error: Received a request that wasn't a FullHttpRequest."); throw new RestHandlerException("Bad request received.", HttpResponseStatus.BAD_REQUEST); } final ByteBuf msgContent = ((FullHttpRequest) httpRequest).content(); uploadedFiles = FileUploadHandler.getMultipartFileUploads(ctx);