Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B4893200D08 for ; Thu, 21 Sep 2017 18:27:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B2FD61609E4; Thu, 21 Sep 2017 16:27:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 035F01609B8 for ; Thu, 21 Sep 2017 18:27:04 +0200 (CEST) Received: (qmail 58439 invoked by uid 500); 21 Sep 2017 16:27:04 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 58430 invoked by uid 99); 21 Sep 2017 16:27:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Sep 2017 16:27:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id AEB6B18FA15 for ; Thu, 21 Sep 2017 16:27:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id r_C8q8vnP2ax for ; Thu, 21 Sep 2017 16:27:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id EDC295FBDF for ; Thu, 21 Sep 2017 16:27:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 2C3EFE0F02 for ; Thu, 21 Sep 2017 16:27:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4F4BB241D9 for ; Thu, 21 Sep 2017 16:27:00 +0000 (UTC) Date: Thu, 21 Sep 2017 16:27:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-7663) Allow AbstractRestHandler to handle bad requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 21 Sep 2017 16:27:05 -0000 [ https://issues.apache.org/jira/browse/FLINK-7663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16175050#comment-16175050 ] ASF GitHub Bot commented on FLINK-7663: --------------------------------------- GitHub user tillrohrmann opened a pull request: https://github.com/apache/flink/pull/4699 [FLINK-7663] [flip6] Return BAD_REQUEST if HandlerRequest cannot be created ## What is the purpose of the change This commit changes the behaviour such that a failure in creating a `HandlerRequest` will result in a BAD_REQUEST response by the AbstractRestHandler. ## Brief change log - Introduce the `HandlerRequestException` indicating that the `HandlerRequest` could not be created - Introduce a checked `ConversionException` for `MessageParameter#convertFromString` to let conversions fail explicitly - Send `BAD_REQUEST` response in case that the `HandlerRequest` could not be created ## Verifying this change - Added `RestEndpointITCase#testBadHandlerRequest` ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (no) - 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) ## Documentation - Does this pull request introduce a new feature? (no) - If yes, how is the feature documented? (not applicable) R @zentol You can merge this pull request into a Git repository by running: $ git pull https://github.com/tillrohrmann/flink supportBadRestRequests Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/4699.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 #4699 ---- commit 38c8a188ad72a1ce48129077b71df971ade44354 Author: Till Rohrmann Date: 2017-09-21T16:14:45Z [FLINK-7663] [flip6] Return BAD_REQUEST if HandlerRequest cannot be created This commit changes the behaviour such that a failure in creating a HandlerRequest will result in a BAD_REQUEST response by the AbstractRestHandler. ---- > Allow AbstractRestHandler to handle bad requests > ------------------------------------------------ > > Key: FLINK-7663 > URL: https://issues.apache.org/jira/browse/FLINK-7663 > Project: Flink > Issue Type: Bug > Components: REST > Affects Versions: 1.4.0 > Reporter: Till Rohrmann > Assignee: Till Rohrmann > Labels: flip-6 > > The {{AbstractRestHandler}} parses the request and tries to generate a {{HandlerRequest}}. If this fails, then the server answers with an internal server error. Instead we should allow the {{AbstractRestHandler}} to be able to return a BAD_REQUEST status code. In order to do that, I would like to introduce a {{HandlerRequestException}} which can be thrown while creating the {{HandlerRequest}}. If this exception is thrown, then we return an error message with {{BAD_REQUEST}} {{HttpResponseStatus}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)