@Test public void testRender() throws Exception { prepareRequestContextRender(GET, createODataUri(XML)); renderer.render(context, QueryResult.from(exception), responseBuilder); responseBuilder.setStatus(OK); ODataResponse response = responseBuilder.build(); assertResponse(response, XML, ERROR_RESPONSE_PATH); assertThat(response.getHeader(CONTENT_LANGUAGE), is("en")); }
@Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); XMLErrorResponseWriter writer = new XMLErrorResponseWriter(); writer.startDocument(); writer.writeError((ODataException) data.getData()); writer.endDocument(); try { responseBuilder .setContentType(XML) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setBodyText(writer.getXml(), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); }
XMLErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); XMLErrorResponseWriter writer = new XMLErrorResponseWriter(); writer.startDocument(); writer.writeError((ODataException) data.getData()); writer.endDocument(); try { responseBuilder .setContentType(XML) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setBodyText(writer.getXml(), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); } }
XMLErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); XMLErrorResponseWriter writer = new XMLErrorResponseWriter(); writer.startDocument(); writer.writeError((ODataException) data.getData()); writer.endDocument(); try { responseBuilder .setContentType(XML) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setBodyText(writer.getXml(), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); }  }
XMLErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); XMLErrorResponseWriter writer = new XMLErrorResponseWriter(); writer.startDocument(); writer.writeError((ODataException) data.getData()); writer.endDocument(); try { responseBuilder .setContentType(XML) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setBodyText(writer.getXml(), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); }  @Override int score(ODataRequestContext requestContext, QueryResult data); @Override void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder); @Override ChunkedActionRenderResult renderStart(ODataRequestContext requestContext, QueryResult result,
                                                 OutputStream outputStream); }
XMLErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); XMLErrorResponseWriter writer = new XMLErrorResponseWriter(); writer.startDocument(); writer.writeError((ODataException) data.getData()); writer.endDocument(); try { responseBuilder .setContentType(XML) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setBodyText(writer.getXml(), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); }  @Override int score(ODataRequestContext requestContext, QueryResult data); @Override void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder); @Override ChunkedActionRenderResult renderStart(ODataRequestContext requestContext, QueryResult result,
                                                 OutputStream outputStream);  }