@Test public void testGetContentSerializerForContentType() throws Exception { assertThat(engine.getContentSerializerForContentType(null)).isNull(); assertThat(engine.getContentSerializerForContentType(MimeTypes.JSON)).isEqualTo(json); assertThat(engine.getContentSerializerForContentType(MimeTypes.XML)).isEqualTo(xml); }
@Override public ContentSerializer getContentSerializerForContentType(String contentType) { for (ContentSerializer renderer : serializers) { if (renderer.getContentType().equals(contentType)) { return renderer; } } LoggerFactory.getLogger(this.getClass()).info("Cannot find a content renderer handling " + contentType); return null; }
Engine implements ContentEngine { @Override public ContentSerializer getContentSerializerForContentType(String contentType) { for (ContentSerializer renderer : serializers) { if (renderer.getContentType().equals(contentType)) { return renderer; } } LoggerFactory.getLogger(this.getClass()).info("Cannot find a content renderer handling " + contentType); return null; } }
Engine implements ContentEngine { @Override public ContentSerializer getContentSerializerForContentType(String contentType) { for (ContentSerializer renderer : serializers) { if (renderer.getContentType().equals(contentType)) { return renderer; } } LoggerFactory.getLogger(this.getClass()).info("Cannot find a content renderer handling " + contentType); return null; }  }
Engine implements ContentEngine { @Override public ContentSerializer getContentSerializerForContentType(String contentType) { for (ContentSerializer renderer : serializers) { if (renderer.getContentType().equals(contentType)) { return renderer; } } LoggerFactory.getLogger(this.getClass()).info("Cannot find a content renderer handling " + contentType); return null; }  @Override BodyParser getBodyParserEngineForContentType(String contentType); @Override ContentSerializer getContentSerializerForContentType(String contentType); @Override ContentSerializer getBestSerializer(Collection<MediaType> mediaTypes); }
Engine implements ContentEngine { @Override public ContentSerializer getContentSerializerForContentType(String contentType) { for (ContentSerializer renderer : serializers) { if (renderer.getContentType().equals(contentType)) { return renderer; } } LoggerFactory.getLogger(this.getClass()).info("Cannot find a content renderer handling " + contentType); return null; }  @Override BodyParser getBodyParserEngineForContentType(String contentType); @Override ContentSerializer getContentSerializerForContentType(String contentType); @Override ContentSerializer getBestSerializer(Collection<MediaType> mediaTypes);  }