Forums Register Login

getServerPort() vs getLocalPort()

+Pie Number of slices to send: Send
In which context these two methods are used on request object? Whats the difference?
Thanks
+Pie Number of slices to send: Send
getServerPost() says, "to which port was the request originally sent?"
getLocalPost() says, "on which port did the request end up with?"

all request are send to a single port(server port), where the server is listening. then the server find another port(Local port) to handle this thread, so that the app server can handle many client at the sametime.
+Pie Number of slices to send: Send
It means this is useful when we configure Apache & Tomcat together.

Lets say I configure Apache at port 80 and Tomcat at port 8080, can i say getServerPost() refers to port 80 and getLocalPost() refers to 8080 port.

Am I right in understanding this?

Lets say I use only Tomcat at port 80 in this case I cannot use getLocalPost() rite?

Thanks
Evil is afoot. But this tiny ad is just an ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 683 times.
Similar Threads
getServerPort() vs getLocalPort()
confusion about request's API...
How can I get port number and server host name by java code in my JSP
Regarding method getLocalPort()
getLocalPort()
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:29:18.