I need to implement a web server in Java. The web server should download image files that were uploaded by the clients in an HTTP PUT request. What is the procedure for doing it? What Java classes should I use?
Also, if you can recommend a good book that covers these topics it would be great. But the specific question is more important right now.
You should read about Java servlets and servlet containers. Start by implementing a simple servlet that returns “Hello world” string.
Here is the shortest upload/download servlet ever:
First hit:
To store given text in a file named
test.txtsomewhere on your disk. Then simply enterlocalhost:8080/testin your browser. I think it is a good start.