zoukankan      html  css  js  c++  java
  • flink 获取上传的Jar源码



    package org.apache.flink.runtime.webmonitor.handlers;

    /**
    * Handles .jar file uploads.
    */
    public class JarUploadHandler extends
    AbstractRestHandler<RestfulGateway, EmptyRequestBody, JarUploadResponseBody, EmptyMessageParameters> {


    package org.apache.flink.runtime.rest;

    public abstract class AbstractHandler<T extends RestfulGateway, R extends RequestBody, M extends MessageParameters> extends RedirectHandler<T> {
    protected final Logger log = LoggerFactory.getLogger(getClass());
    protected static final ObjectMapper MAPPER = RestMapperUtils.getStrictObjectMapper();
    private final UntypedResponseMessageHeaders<R, M> untypedResponseMessageHeaders;
    protected AbstractHandler(
    @Nonnull CompletableFuture<String> localAddressFuture,
    @Nonnull GatewayRetriever<? extends T> leaderRetriever,
    @Nonnull Time timeout,
    @Nonnull Map<String, String> responseHeaders,
    @Nonnull UntypedResponseMessageHeaders<R, M> 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);
  • 相关阅读:
    EasyTransaction主要源码分析
    编程哲理小故事:Tina的运动会方阵
    多维扩展点的思考与设计——解决渠道、产品增加引发的腐化问题
    分布式事务框架Seata及EasyTransaction架构的比对思考
    设计,架构,框架之间是什么关系?
    你知道如何画好一幅架构图么?
    学会分享痛苦
    建立你自己的博客
    使用正确的工具软件
    掌握主动权
  • 原文地址:https://www.cnblogs.com/WCFGROUP/p/9779622.html
Copyright © 2011-2022 走看看