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

[434 byte] By [Stefan.Friedricha] at [2007-10-2 9:45:50]
# 1

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,

garavaa at 2007-7-16 23:51:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

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

Stefan.Friedricha at 2007-7-16 23:51:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
I have never tried it myself. But I guess Applet should solve the problem.__AVA
garavaa at 2007-7-16 23:51:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
do you know how to use GOOGLE ? http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-servlets.html http://www.cs.bham.ac.uk/~tmw/servlet_tutorial/image.shtml
Maris_Orbidansa at 2007-7-16 23:51:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

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

Stefan.Friedricha at 2007-7-16 23:51:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
http://www.jguru.com/faq/view.jsp?EID=121936
garavaa at 2007-7-16 23:51:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...