Re: Insert PNG File from Servlet no go

"William L. Thomson Jr." <[email protected]> 23 Jan 2003 18:38:45 -0800
Newsgroups gmane.comp.java.jgenerator.devel
Message-ID <[email protected]>
Dmitry,

On Thu, 2003-01-23 at 14:19, Dmitry Skavish wrote:
> William,
> 
> > Now I am simply using the PrintWriter to write out png data, and the
> > content type has been set to image/png.
> 
> You cannot use PrintWriter to send binary data. Use something like this:

Ok, but it has worked so far for JPEGs?

>          res.setContentLength(<size of the binary stream>);
>          res.setContentType("image/png");
> 
>          ServletOutputStream sos = res.getOutputStream();
>          try {
>              sos.write(<byte buffer>, <buffer offset>, <buffer size>);
>          } finally {
>              sos.close();
>          }

Tried the above suggestion but still no go. Both ways seems to output
the same code. I can request the servlet from a browser and get what I
want back. Using either PrintWriter or ServletOutputStream output the
exact same binary data.

Although I keep getting the same error as before?

I can send you the url and params to see the images yourself?

I can also email the code behind the servlet, but will post neither to
the group. Only directly to your or Andrew.

-- 
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone  707.766.9509
Fax    707.766.8989
http://www.obsidian-studios.com



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com