-
Notifications
You must be signed in to change notification settings - Fork 1
Http Server
Stefan Tirea edited this page Jan 2, 2021
·
3 revisions
-
Socket Server
- Reading the whole response is not possible with
readLine()
orlines()
(Stream)- Problem: The request stays open until the response is coming from the server
- Solution: extract the
Content-Length
and read only char by char!
- Postman sends 2 requests towards
localhost
. The first one acts like a ping and is cancelled shortly after- Problem: The server crashed because of the wrong handling of the client request
- Solution: Proper Exception handling at every level
- Reading the whole response is not possible with
-
Reflections
- First time using it so I had to read a bit into it
- One important feature was automatically knowing which parameter in the method belongs to which path variable in the url
- So I just use the parameter name and compare it to the path (ex. "/api/{username}"). Problem: Method Parameter names are generalized by the compiler by default (String username => String arg1).
- Solution: Add Compiler Argument
-parameters
=> does not change the parameter name (since Java 8).