Вопрос

I have String data and image files to send in an HttpServletResponse. How can this be done? i know how to send String and image separately. Couldn't see a MIME format to send both.

TIA.

Это было полезно?

Решение

This is not possible, as a single HTTP response can only send a single file. However, you can embed an image using the data: URI scheme by creating an image similar to:

<img src = "data:image/png;base64,<data>" />

where <data> is the image encoded as base-64.

Of course, you can always store the image and serve it in a separate request initiated by the browser when it comes across your image tag, especially for large images.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top