views:

46

answers:

3

Hi there,

I am looking for advice on how to go about writing a small and simple application that will receive http GET and http PUT request, process the data (simple text files) and respond.

I have all ready done this using threads and sockets but there must be a simpler and more efficient way. Also when I run my application using wireshark I am not convince I am using the http protocol as I should be.

Thanks
Alexis

A: 

You can consider embedding a webserver like Jetty (start/stop it from java app) if you want to get the full benefits of HTTP parsing.

Sajid
A: 

Hi,

U can use http://tjws.sourceforge.net/ tiny java weberver

I u are using Java 6 you can use Http server api as well

Abdul Khaliq

Abdul Khaliq
Thanks for that. HttpServer API solved it. This example help me to get started: http://www.prasannatech.net/2008/10/simple-http-server-java.html
alexis
+1  A: 

I used HttpComponents for similar purposes - it provides functionality for HTTP server and client parts implementation. It's easy to learn and use.

Kel