In my web-app the client pings the server (tries to contact a ping servlet on the server) wheere the address / resource locator of the servlet is :
"192.168.43.187/server/ping?" + new ClientAddress().getNetworkIP();
Till now the client has been sending it’s network IP to the server with every ping. I wanted to add another piece of information with this URL,which is new GregorianCalendar().getTimeInMillis(); .
How do I send this along ?
Note :
In the URL, ping is a servlet
I would construct the URL thus:
and use the servlet request method ServletRequest.getParameter() to extract the values.
Note that ServletRequest.getRemoteAddr() gives you the client address. Do you need to pass it explicitly ? Additionally, constructing a URL by string concatenation works in this trivial scenario, but as soon as you pass values that include characters such as spaces etc. you’ll need to encode these values.