The Artima Developer Community
Sponsored Link

Java Answers Forum
Java Image processing and Servlets

3 replies on 1 page. Most recent reply: Aug 12, 2002 6:36 AM by Jay Kandy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
MadanGopal Mathur

Posts: 3
Nickname: mgm
Registered: Aug, 2002

Java Image processing and Servlets Posted: Aug 8, 2002 11:08 PM
Reply to this message Reply
Advertisement
Hi all,

I need help. Right now, I have a java program which is creating,manipulating and displaying images on the screen.
What I want to do next is to use servlets(tomcat) to send this image to a web browser to be displayed there using either a doGet() or doPost().

I am confused as to how I would compile this code, if I cannot have a main() which is very necessary for image generation...,I am lost.

If you guys can let me know any ideas on how to go about it, I will really appreciate it.

Any links or example code is very welcome.

Thanks
MGM


Don Hill

Posts: 70
Nickname: ssswdon
Registered: Jul, 2002

Re: Java Image processing and Servlets Posted: Aug 9, 2002 1:09 PM
Reply to this message Reply
You will need to do a servlet mapping in the web.xml, this is a mapping from the java class to a url.The servlet container will call the goGet, doPost. You will need to write the html to the response outputstream.

HTH

MadanGopal Mathur

Posts: 3
Nickname: mgm
Registered: Aug, 2002

Re: Java Image processing and Servlets Posted: Aug 10, 2002 12:04 AM
Reply to this message Reply
Hi Don,

Thanks a lot for a reply.I will look up on servlet mapping some more.It would help me to a great extent, if u could send me an example code if any or point me to a link to such examples on the web. Because I am using Java Servlet Programming text by Hunter & Crawford and I didn't see much about servlet mapping in it to solve my problem.

Thanks
MGM

Jay Kandy

Posts: 77
Nickname: jay
Registered: Mar, 2002

Re: Java Image processing and Servlets Posted: Aug 12, 2002 6:36 AM
Reply to this message Reply
Mathur,

Heres what you need to do:

You said you have code to "manipulate" images. My guess is since images are binary, you write to an OutputStream to display on the screen (using a Panel or a container).

What you need to do is, set this stream to servlet's stream:
OutputStream ostream = response.getOutputStream();

get the stream and draw onto it.

and set the content type as the image type. For example, if you draw a PNG,
response.setContentType("image/png");

If you posted a piece of code, it would be easy to show!

Jay

Flat View: This topic has 3 replies on 1 page
Topic: great place to find answers for new users with applets Previous Topic   Next Topic Topic: JFrames

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use