@Test(expected = ODataSystemException.class) public void testRenderException() throws ODataException, UnsupportedEncodingException { prepareRequestContextRenderException(GET, createODataUri()); renderer.render(context, QueryResult.from(exception), responseBuilderMock); }
@Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); JsonErrorResponseWriter writer = new JsonErrorResponseWriter(); try { responseBuilder.setContentType(JSON) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setBodyText(writer.getJsonError((ODataException) data.getData()), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); }
JsonErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); JsonErrorResponseWriter writer = new JsonErrorResponseWriter(); try { responseBuilder.setContentType(JSON) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setBodyText(writer.getJsonError((ODataException) data.getData()), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); } }
JsonErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); JsonErrorResponseWriter writer = new JsonErrorResponseWriter(); try { responseBuilder.setContentType(JSON) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setBodyText(writer.getJsonError((ODataException) data.getData()), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new ODataSystemException(e); } LOG.debug("End rendering error response for request: {}", requestContext); }  }
JsonErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); JsonErrorResponseWriter writer = new JsonErrorResponseWriter(); try { responseBuilder.setContentType(JSON) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setBodyText(writer.getJsonError((ODataException) data.getData()), 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); }
JsonErrorResponseRenderer extends AbstractRenderer { @Override public void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder) throws ODataException { LOG.debug("Start rendering error response for request: {}", requestContext); JsonErrorResponseWriter writer = new JsonErrorResponseWriter(); try { responseBuilder.setContentType(JSON) .setHeader(CONTENT_LANGUAGE, ENGLISH.getLanguage()) .setHeader("OData-Version", ODATA_VERSION_HEADER) .setBodyText(writer.getJsonError((ODataException) data.getData()), 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);  }