I'm developing a web server in java using ServerSocket.
But I have some issues I can't address them, I do not how, I've been stuck for a long time.
The first one is:
When I make a post petition using a form from Chrome. Im reading in the server something like:
POST /something.htm HTTP/1.1 List of headers CRLF ítem=value
When I finish of read all the header, comes 'CRLF', but happend 2 things.
1.chrome waits that I send a response with the page.
2.I wait to read the CRLF to start to read the 'mesage body' with the content "ítem=value"
Thus and as you can imagine my App stay there for a long time, waiting for a stream.
I mean I can not read the "messagge body". I can just if I send a response with a new page.
But this make me feel confused, because should I not read everythig? instead of read until the CRLF?
The protocol doest say that I have to read until the CRLF, send a response from the server and then read the message body.
This web server is a practice of school.
The profesor told us that we need provide GET and POST methods.
I've been reading and I found that when we use POST we need to use a CGI (commong gateway interface)
Here comes my second issue.
I need to use CGI? and probably this is why Im having troubles reading the message body? Or I can In some way use jsp?
Sorry if my my cuestion is dumb.
If there are some references you know, where you feel I need to accomplish my task I will be very grateful.
Aucun commentaire:
Enregistrer un commentaire