This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes getRemotePort(), getLocalPort() methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "getRemotePort(), getLocalPort() methods" Watch "getRemotePort(), getLocalPort() methods" New topic
Author

getRemotePort(), getLocalPort() methods

PNS Subramanian
Ranch Hand

Joined: Jul 13, 2004
Posts: 150
Tried finding out the client port number used in a servlet using getRemotePort() - gives a compilation error. Also, getLocalPort() doesnt seem to work while getServerPort() works. Am i missing something here ?

Env. Tomcat5.0.30/Win XP
John Wolf
Ranch Hand

Joined: Feb 18, 2002
Posts: 64
PNS,

I don't have any problems with it. I used it in a filter as a test. Can you include the code here?
PNS Subramanian
Ranch Hand

Joined: Jul 13, 2004
Posts: 150
The following is the code that i had used - i override the service method in my servlet that extends HttpServlet.
The lines have been commented since it resulted in a compilation error otherwise.


Besides, what ever the action method other than POST i specify in my jsp page calling this servlet, the first log statement gives me an output of GET.Don't understand why it works this way.
John Wolf
Ranch Hand

Joined: Feb 18, 2002
Posts: 64
PNS,

I still don't get any errors. Are you using J2EE 1.4 implementation?
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: getRemotePort(), getLocalPort() methods
 
It's not a secret anymore!