How to code a simple,light weight web server in java which can take HTTP requests, runs HTML forms and returns requested pages. Im trying to integrate this server as a part of run time library of a newly developed language. I have got this one called nanohtpd which is just one java file, i scan compile at and run the server but when I open a html form,and click submit, the page which is put as the parameter for action ( action="some_name.php") ,the page gets downloaded instead of showing up in the browser. I mean the parameters are to be passed to the php file and the php file has the code to show the parameters in html form. but the page gets downloaded.
Asked
Active
Viewed 954 times
1 Answers
1
The page gets downloaded instead of being rendered by the browser, probably because the server does not add the Content-Type http header with value: text/html.

Nitzan Tomer
- 155,636
- 47
- 315
- 299