-3

I am using an application which send data to my local tomcat server.

So my question is, how to handle data received in tomcat with java ?

can some one give me an exemple how to use Listener.

kammoun
  • 23
  • 4

1 Answers1

0

Build a Java web application and deploy it to your tomcat server.

The web application will need to handle whatever request is being sent to Tomcat.

Do some reading: http://docs.oracle.com/javaee/1.4/tutorial/doc/WebApp.html

cowls
  • 24,013
  • 8
  • 48
  • 78
  • If the application send a file (.txt) to my tomcat, can i use a servlet to parse it? – kammoun Dec 11 '12 at 10:40
  • Yes you can. The request will need to be the correct format and the servlet will need to explicitly handle it. This question might help: http://stackoverflow.com/questions/2422468/how-to-upload-files-to-server-using-jsp-servlet – cowls Dec 11 '12 at 10:43
  • I am not uploading a file! i send it to my localhost http::/125.28.28.3:8080 from my phone. so how tomcat will "understand" that this file is for my appweb1? – kammoun Dec 11 '12 at 10:53
  • If you are sending a txt file you are uploading it ;). You will need to send the file to something like: http::/125.28.28.3:8080/my-app and then mount a web application on /my-app to handle the text file. – cowls Dec 11 '12 at 11:07
  • thx, can you give me an exemple. I am not obliged to use a listener because i recive a file evry 20sec? – kammoun Dec 11 '12 at 11:15
  • You will need to look into web apps. Its too big to simply give an example – cowls Dec 11 '12 at 11:24