Mike Duffy wrote:
>
> Is there a problem using running AWT classes on an
> application server?
>
I'm assuming you mean using the AWT in headless mode
by setting "-Djava.awt.headless=true"? It works, but
you can't use most of the heavyweight components,
like Frames. You'll get an "java.awt.HeadlessException"
You can use code like this, though:
BufferedImage bi = new BufferedImage(128,128,BufferedImage.TYPE_INT_RGB);
Graphics2D g = bi.createGraphics();
g.drawLine(0, 0, 120, 120);
Raster r = bi.getData();
rsp.setContentType("image/jpeg");
JPEGImageEncoder ie = JPEGCodec.createJPEGEncoder(rsp.getOutputStream());
ie.encode(bi);
where "rsp" is the servlet response argument in doGet()
or doPost(). There's documentation in the JDK 1.4
doc bundle:
docs/guide/awt/AWTChanges.html
If you're stuck with legacy code that uses heavyweight
components, you'll still need to run xvfb or use one
of the AWT replacement toolkits (check the list archives
for details, a search on "xvfb" will get you the
relevant threads)
Or do you mean something completely different?
--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com
___________________________________________________________________________
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