I would return something like IResponse with getMimeType() and getContent() -> byte[]  ...