I am creating a Java Server using Socket. I would like to print the URL the client applciation requested when contacting the server. That is, if the client requests: https://your.server.com?usr=user_name, I would like to read this url from the server's end.
Thanks!
It looks like everyone is doing this these days ;)
Have a look at this guy, he is doing the same: URL Parsing with Java server using Runnable class
You cannot have the complete url that client request. Look at the HTTP protocol RFC. On the first line of your message you have
GET /pub/WWW/ HTTP/1.1
so the first value is the request method and the second value is the part of the url without
http://myhost:myport
then in the header fields, sometimes, you can find only the host
Host: myhost