Hello all,
I'm trying to receive data in a B4J server using a POST method. To do this I created a local form like this:
html>
<html>
<body>
<form action="http://127.0.0.1:51042/pushserver" method="post" id="usrform">
idUser: <input type="text" name="username"><br>
Token: <input type="text" name="token"><br>
sessionId: <input type="text" name="sessionid"><br>
<input type="submit">
</form>
<textarea name="data" form="usrform"></textarea>
</body>
</html>
</html>
Open this form in Chrome and, running the java server, it receives the POST call in this code:
req As ServletRequest
Dim postMap As Map
postMap.Initialize
postMap = req.GetMultipartData(File.DirApp,1000000000)
Log( "sessionid -> " & req.GetParameter("sessionid") )
The POST event is arriving, the req.ContentType is correct (application/x-www-form-urlencoded), the req.method is POST but I can't recover the POST fields or values, doesn't matter what method I use (postMap is empty and GetParameter - that I know that should be used for GET method, but tested...) .
What am I doing wrong?