I mean the code may remain in BinaryResponseWriter itself. But the problem with the solution is that you end up serializing all those objects and deserializing them.
If I am not wrong , we only need to recursively go through the NamedList and replace all Doclist and Document with SolrDocumentList and SolrDocument . Every other object remains same at both ends of the pipe.
So you can reuse the getDoc() method but you may need to replicate the writeDocList() method into a getDocList() method.