Hmm, I thought I talked about this in the book.  If you want to send
images you have to send them in an encoded form (GIF, JPEG, TIFF, PNG,
etc).  So in your case, either your servlet has to retrieve just the
image bytes from the other server and pass them on to the client
(keeping them encoded), or if you servlet has to get the image as a
java.awt.Image object then it has to encode it before sending it to the
client.

Glad you liked the book.  :-)

-jh-

John C Cartwright wrote:
>
> Hello All,
>
> I'm trying to build a simple servlet that will provide images to an
> applet.  Essentially trying to get around the applet's limitation of
> only reading files from it's host.
>
> I started with the example in Chapter of Jason Hunter's "Java Servlet
> Programming" (excellent book, by the way!).  The servlet reads an image
> from a URL into an java.awt.image object.  The applet then retrieves
> that object from the servlet using com.oreilly.servlet.HttpMessage class.
>
> The applet is throwing a java.io.FileNotFoundException, but experiments
> lead me to believe that the problem is due to the fact that the
> java.awt.Image class does not implement serializable interface.
> The servlet can correctly determine the width and height of the image
> and successfully transfer that information to the applet as a String object.
>
> So, is there a better way to achieve my objective than to transfer an
> java.awt.Image object from the servlet to the applet?  Does the object
> being transferred have to be serializable?
>
> Thanks for your help!
>
> -- john
>
> --
> =====================================================
> John Cartwright
> Professional Research Assistant / Associate Scientist
> CIRES, SEG/NGDC/NOAA
> (303) 497-6284
> [EMAIL PROTECTED]
> =====================================================
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to