code: 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();
  		}
  	}
docs: Finds assigned response writer or tries to assign a writer according to produces annotation and result type
  
  @param returnType   type of response
  @param definition   method definition
  @param provider     injection provider if any
  @param routeContext routing context
  @param accept       accept media type header
  @return writer to be used to produce response, or {@link GenericResponseWriter} in case no suitable writer could be found