You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/06/18 13:22:00 UTC

[jira] [Commented] (FLINK-9599) Implement generic mechanism to receive files via rest

    [ https://issues.apache.org/jira/browse/FLINK-9599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16515689#comment-16515689 ] 

ASF GitHub Bot commented on FLINK-9599:
---------------------------------------

GitHub user zentol opened a pull request:

    https://github.com/apache/flink/pull/6178

    [FLINK-9599][rest] Implement generic mechanism to access uploaded files

    ## What is the purpose of the change
    
    This PR extends the existing multipart handling to also support mixed multipart message (i.e. requests  containing both JSON and files), and generalizes the `FileUpload` handling to provide access to all handlers extending `AbstractHandler`
    
    Handlers may access uploaded files via `HandlerRequest#getFileUploads`. File uploads must be explicitly allowed by returning true in `MessageHeaders#acceptsFileUploads`.
    The files and JSON payload are forwarded to the handler by the `FileUploadHandler` via channel attributes. If a JSON payload is forwarded this way a handler will ignore the content of the received `HttpRequest`.
    
    This PR only covers the server-side; the `RestClient` remains unchanged. This will be done in a follow-up.
    
    ## Brief change log
    * add `MessageHeaders#acceptsFileUploads` to signal that a handler accepts file uploads (default=false)
    * add `FileUploads` class as a container for uploaded files
    * extend `FileUploadHandler` to
      * accept multiple files in one request
      * also accept a JSON payload
      * forward both files and json via channel attributes
    * extend `AbstractHandler` to retrieve files/json from channel attributes
      * remove special case for `JarRunHandler` in `AbstractHandler`
    * extend `HandlerRequest` to accept a `FileUploads` object
    * add `OkHttp` dependency to `flink-runtime` for testing purposes
    * update `JarUploadHandler/Headers`
    
    ## Verifying this change
    
    added tests:
    * FileUploadsTest
    * FileUploadHandlerTest
    * manually verified via WebUI job submission
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): (yes)
      - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
      - The serializers: (no)
      - The runtime per-record code paths (performance sensitive): (no)
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
      - The S3 file system connector: (no)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (yes)
      - If yes, how is the feature documented? (not documented)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zentol/flink 9280_beta

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/6178.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #6178
    
----
commit c2adb3880180d8426697c33035d2b31d57d93952
Author: zentol <ch...@...>
Date:   2018-06-18T08:54:42Z

    [FLINK-9599][rest] Implement generic mechanism to access uploaded files

----


> Implement generic mechanism to receive files via rest
> -----------------------------------------------------
>
>                 Key: FLINK-9599
>                 URL: https://issues.apache.org/jira/browse/FLINK-9599
>             Project: Flink
>          Issue Type: New Feature
>          Components: REST
>            Reporter: Chesnay Schepler
>            Assignee: Chesnay Schepler
>            Priority: Major
>             Fix For: 1.6.0
>
>
> As a prerequisite for a cleaner implementation of FLINK-9280 we should
>  * extend the RestClient to allow the upload of Files
>  * extend FileUploadHandler to accept mixed multi-part requests (json + files)
>  * generalize mechanism for accessing uploaded files in {{AbstractHandler}}
> Uploaded files can be forwarded to subsequent handlers as an attribute, similar to the existing special case for the {{JarUploadHandler}}. The JSON body can be forwarded by replacing the incoming http requests with a simple {{DefaultFullHttpRequest}}.
> Uploaded files will be retrievable through the {{HandlerRequest}}.
> I'm not certain if/how we can document that a handler accepts files.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)