I have BufferedImage buffer.
I know how to send this image to a client: And it works.
But i'd like to save this image to file and send to a client link to the file.
My following code doesn't work:
I don't see any png-file on the HD (in the application directory) and the link: <img src=\"out.png"></img> leads nowhere. I'd like to have an embedded image in html.
When i use above code i have next html:
when i click the src link (i see page source) i have next message:
The address wasn't understood
Firefox doesn't know how to open this address, because the protocol (c) isn't associated with any program.
C:\jpr\MyWeb\DynamicImg\build\web\out.png is on the filesystem of the server. It won't be the client's c drive. The URL would be something like
I've seen this on UNIX and not windows so I'm not sure how the c: part works. More importantly, most servers are configured to prevent clients from directly accessing files on the file system. Could you offer a download or put it on a network share instead?
Bear Bibeault wrote:You need to use an HTTP uRL to address the image, not the file protocol.
OK. What have i got at the moment?!
As a result i have such a link:
I understand this is a wrong approach because each odd client will receive html code and each even client will receive only one png image. (I call this servlet twice and produce a different responce).
This instance only for my training and this approach is good for only one client (for my own education).
But I'd like to pass to a client the link to the image file (not the repeated request to the servlet).
When i do like that i receive NullPointerException: