-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Milestone
Description
Actual behavior
this windup logic should not appear here
Lines 74 to 123 in 4f2cb40
| public CompletionStage<Void> process(RequestContext context) { | |
| return super.process(context).whenComplete((v, th) -> { | |
| if (th != null) { | |
| DispatcherHandlerImpl.handleException(context, Futures.unwrapCompletionException(th)); | |
| } | |
| final HandlerMethod method = RouteTracking.matchedMethod(context); | |
| final List<MediaType> mediaTypes = ResponseEntityUtils.getMediaTypes(context); | |
| final ResponseEntity entity = new ResponseEntityImpl(method, context.response(), | |
| mediaTypes.isEmpty() ? null : mediaTypes.get(0)); | |
| HandlerResolverFactory resolverFactory = getResolverFactory(method); | |
| final ResponseEntityResolverContext rspCtx = new ResponseEntityResolverContextImpl(context, | |
| entity, channelFactory.create(context), resolverFactory.getResponseEntityResolvers(method), | |
| resolverFactory.getResponseEntityResolverAdvices(method)); | |
| setEntityTypeIfNecessary(rspCtx, context.response()); | |
| final HttpRequest request = context.request(); | |
| try { | |
| rspCtx.proceed(); | |
| if (!rspCtx.channel().isCommitted()) { | |
| logger.error("The response entity({}) of request(url={}, method={}) still haven't been committed" | |
| + " after all ResponseEntity advices, maybe the write operation was terminated by" | |
| + " an advice?", entity, request.path(), request.method()); | |
| rspCtx.context().response().status(HttpStatus.INTERNAL_SERVER_ERROR.code()); | |
| rspCtx.channel().end(); | |
| } | |
| } catch (Throwable ex) { | |
| if (!rspCtx.channel().isCommitted()) { | |
| logger.error("Error occurred when writing response entity({}) of request(url={}, method={})", | |
| entity, request.path(), request.method(), ex); | |
| final HttpStatus status; | |
| if (ex instanceof WebServerException) { | |
| status = ((WebServerException) ex).status(); | |
| } else { | |
| status = HttpStatus.INTERNAL_SERVER_ERROR; | |
| } | |
| rspCtx.context().response().status(status.code()); | |
| rspCtx.channel().end(); | |
| } else { | |
| logger.error("Unexpected error occurred after committing response entity({})" + | |
| " of request(url={}, method={})", entity, request.path(), request.method(), ex); | |
| } | |
| } | |
| if (logger.isDebugEnabled()) { | |
| logger.debug("Request(url={}, method={}) completed. {}", | |
| request.path(), request.method(), context.response().status()); | |
| } | |
| }); | |
| } |
Env
- Restlight version:
- JVM version:
- OS:
Metadata
Metadata
Assignees
Labels
No labels