public HttpResponseWriter getResponseWriter ( Class returnType , RouteDefinition definition , InjectionProvider provider , RoutingContext routeContext , MediaType accept ) { try { HttpResponseWriter writer = null ; if ( accept != null ) { writer = get ( returnType , definition . getWriter ( ) , provider , routeContext , new MediaType [ ] { accept } ) ; } if ( writer == null ) { writer = get ( returnType , definition . getWriter ( ) , provider , routeContext , definition . getProduces ( ) ) ; } return writer != null ? writer : new GenericResponseWriter ( ) ; } catch ( ClassFactoryException e ) { log . error ( "Failed to provide response writer: " + returnType + ", for: " + definition + ", falling back to GenericResponseWriter() instead!" ) ; return new GenericResponseWriter ( ) ; } catch ( ContextException e ) { log . error ( "Could not inject context to provide response writer: " + returnType + ", for: " + definition + ", falling back to GenericResponseWriter() instead!" ) ; return new GenericResponseWriter ( ) ; } }
Finds assigned response writer or tries to assign a writer according to produces annotation and result type