Creating images with J2EE
Hello everbody!
I use the Sun Java System Application Server 8.1 and I am interested in creating images with Servlets. Because the J2EE specification prohibits the use of the AWT (and the Sun Application Server enforces this restriction by installing a security manager), I want to know which possibilities exist to create images without the AWT.
Any comments are appreciated in advance!
Regards,
Stefan
What you mean exactly by creating images.
Do you wanna show images using servlet. Then copy the image in a bytestream format , Set the content type as image and simply write to the client.
byte[] rb = new byte[1024];
while (input.read(rb) != -1)
{
output.write(rb);
}
ava,
Hi ava,
I am sorry for being unprecise. By creating images I mean drawing my own images from scratch. I wanna start by something like
BufferedImage image = new BufferedImage( ... );
and then draw into that image, using the usual drawLine etc. methods from java.awt.Graphics or java.awt.Graphics2D.
But this is not possible, because the Application Server forbids using these methods.
I am sure someone encountered this problem before me. There must be a solution without AWT. Maybe there exists a library.
Any ideas?
Regards,
Stefan
A really very nice answer!!! Thank you very much!!!
I said I am interested in creating images without AWT (because the Sun Application Server forbids using it). But both of the mentioned URLs make heavily use of the AWT!
The author of the Javaworld article even writes "If you know of a way to create an image on Java 1.1 without an AWT component, please let me know.".
By the way I know how to use google; these URLs are well-known to me.
Stefan