First of all: I have a need for an abstraction for http-clients and was about to start my own, but then I found http-requests - wow, exactly what I had in mind, very nice job 👍
However, the EntityConverterManager is a bit unaccommodating. More specifically with the EntityReader and EntityWriter interfaces: they don't expose the type to be marshaled to/from. This prevents you from fully delegating this to another library, like for example Jackson.
When I implement the EntityReader interface, it looks like I have to hard-code what the marshaling type is ?
I should be able to deserialize json into a custom POJO, without writing a specialized EntityReader for this POJO, etc ...
EntityConverterManager converter = new EntityConverterManager(Arrays.asList(
new JacksonEntityReader(new ObjectMapper())
));
HttpEntity httpEntity = new HttpEntity(someInputStreamWithJson);
MyCustomPojo response = converters.read(MyCustomPojo.class, httpEntity);
I have this actually working locally, by subclassing EntityConverterManager, overriding some methods and introducing new -Reader/-Writer interfaces that actually expose the type in the read/write methods. That is of course not ideal, it would be a lot nicer to have this in http-requests-core.
Are you interested in a PR that fixes all of that ?
It is fully possible to do this without losing backwards compatibility, but it makes the current EntityConverterManager, EntityWriter and EntityReader eventually @Deprecated.
First of all: I have a need for an abstraction for http-clients and was about to start my own, but then I found
http-requests- wow, exactly what I had in mind, very nice job 👍However, the
EntityConverterManageris a bit unaccommodating. More specifically with theEntityReaderandEntityWriterinterfaces: they don't expose the type to be marshaled to/from. This prevents you from fully delegating this to another library, like for example Jackson.When I implement the
EntityReaderinterface, it looks like I have to hard-code what the marshaling type is ?I should be able to deserialize json into a custom POJO, without writing a specialized
EntityReaderfor this POJO, etc ...I have this actually working locally, by subclassing
EntityConverterManager, overriding some methods and introducing new-Reader/-Writerinterfaces that actually expose the type in theread/writemethods. That is of course not ideal, it would be a lot nicer to have this inhttp-requests-core.Are you interested in a PR that fixes all of that ?
It is fully possible to do this without losing backwards compatibility, but it makes the current
EntityConverterManager,EntityWriterandEntityReadereventually@Deprecated.