object -> servlet
Hello
Sorry for the sophistication of this question, however what interfaces do implement and just direction of how I have an object make a POST connection with a servlet and retrieve the returned data stream as an image/byte[]? I know this is what a browser does when the servlet is put in the img tag. I just want to do it programatically. Thank you.
# 1
If I understood it well, you can't do it.
You want your servlet to return a byte[] which is actually you image, but how would you display it in thhe browser, as far as I know javascript can handle this kind of objects in a way you would like, but even if it was possible you would have to store the image on the clients' disk, but that would go into permission issues.
What I sometimes do is, if for eg I have an image store in a database, I save that image in the server root, and I send the url of that Image to the client.
The other you could do it, is point an img src to a servlet which actually return the byte[].
I hope this helps you,
MeTitus
# 2
Hi Titus
My difficulty, among many, grin, is that this class alone must make the connection, call the servlet/jsp (which works fine as tested with an img tag) and retrieve/accumulate the data from the servlet in a image/byte[]. I am extending another class so I can only use interfaces. I know it can be done as the browser does it. Unfortunately I cant implement even a stripped down version of a browser. I have to do it "organically" or rather in my class entirely by implementing interfaces. Ideas? tia.