• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Request server port methods

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the following methods used for: request.getServerPort(), request.getRemotePort() & request.getLocalPort()? What's the difference between these methods?
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getRemoteport() and getLocalPort() are new mehtods of javax.servlet.ServletRequest interface in Servlet 2.4:

getServerName and getServerPort methods returned values that getLocalName and getLocalPort now do. In version 2.4, getServerName and getServerPort have been redefined. Check the API documentation for more information.

for more description of these methods check this..
New Features in Servlet 2.4
 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
When type a url in the browser's address bar, for example
http://www.YourServletIsMyServlet.com:8082
The browser opens a socket connection to the server at port 8082, (The port on which the server is listening.Then the browser redirects you to another port because that port is especially for listening to requests and then making redirection

getServerPort returns the port on which the web server is listening
getRemotePort returns the port at which the client is connection with you
getLocalPort returns the the port after redirection.

Hope that the information was useful
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic