Given for example this Post request:
Using port: 8080
Using Webroot: /tmp
POST /registrazione HTTP/1.1
Content-Type: application/json
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Postman-Token: a628e69a-9ab1-4ef1-8b1d-7634e4dbbeab
Host: 127.0.0.1:8080
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 150
{"id":0,"nome":"Rocco","cognome":"I nandu","username":"roccuzzu","email":"rock@gmail.com","password":"test123","foto":"myphoto.jpg","partecipanti":[]}
I want to take just the body of this request which in this case is a json. I'm my java code I can read all the request in this way:
BufferedReader in = null;
String call = null;
try {
inputStream = socket.getInputStream();
outputStream = socket.getOutputStream();
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
int bytes;
while((bytes = in.read()) >=0){
System.out.print((char) bytes);
}
But i'm not able to take just the body. Can someone help me to do this?