flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-7663) Allow AbstractRestHandler to handle bad requests
Date Wed, 27 Sep 2017 11:36:00 GMT

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

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

Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4699#discussion_r141316258
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/AbstractRestHandler.java
---
    @@ -117,11 +117,26 @@ protected void respondAsLeader(final ChannelHandlerContext ctx,
Routed routed, T
     				}
     			}
     
    +			final HandlerRequest<R, M> handlerRequest;
    +
    +			try {
    +				handlerRequest = new HandlerRequest<>(request, messageHeaders.getUnresolvedMessageParameters(),
routed.pathParams(), routed.queryParams());
    +			} catch (HandlerRequestException hre) {
    +				log.error("Could not create the handler request.", hre);
    +
    +				HandlerUtils.sendErrorResponse(
    +					ctx,
    +					httpRequest,
    +					new ErrorResponseBody(String.format("Could not create the handler request: %s",
hre.getMessage())),
    --- End diff --
    
    Sure, can change this.


> 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)

Mime
View raw message