What port did the request come in on?

I have a servlet that can possibly open a few ports to provide service on. When a request comes in, it is important to know which port the request came in on.
To do this, I'm using HttpServletRequest::getServerPort() which has been working beautifully. Up until now, at least.
I have a situation where someone (actually me) has set up an SSH client/server to sit between people's browsers and my servlet. The idea is that people will connect to the SSH server's port 81which is simply my servlet's port 80 that has been reverse port forwarded.
So what happens is this: someone connects to http://<someip>:81 which goes to the SSH server which simply transfers the bytes to my servlet's port 80. However, when I call getServerPort, it returns 81 and not 80! This is wrong and especially bad since tyhe servlet has no way to know that this port forwarding is even taking place.
Any ideas on how to fix this?
Sander Smith

You could always add the port to your web.xml as an init-parameter and then inspect those in the Servlet via ServletContext.getInitParameter();
- Saish

Similar Messages

  • What version did the drummer come with?

    what version did the drummer come with?

    Randy RR wrote:
    what version did the drummer come with?
    the newest, v10

  • Which port did a request come in on?

    I have a servlet that can possibly open a few ports to provide service on. When a request comes in, it is important to know which port the request came in on.
    To do this, I'm using HttpServletRequest::getServerPort() which has been working beautifully. Up until now, at least.
    My problem is this isn't working if the servlet sits behind a firewall, and non-standard port forwarding is taking place. For instance, if port 8888 on the firewall is forwarded to port 80 on my servlet machine, then to interact with the servlet, users will type:
    http://www.somedomain.com:8888
    getServerPort() seems to just parse this and says that the servlet sits on port 8888. But this isn't true, it is really listening on port 80, which is what I want to know. The servlet has no way to know or control if port forwarding is taking place, so is there a better way to determine the REAL port a HttpServletRequest came in on?
    Sander Smith

    Why would you need to know the port number?Without going into too much detail, the application opens several ports to service and listens to all of them. Depending on which port a request comes in on, the application knows something about the requestor. Think of it as a cheap and easy way to demultiplex a request. I'm aware that there are alternative ways to do this, but they're not available to me because of the type of application I've got. All I want to know is what is the real port that something came in on - shouldn't be rocket science.
    Sander

  • My iPOD classic (last generation) shuts off when jostled--like what happens when the headphones come out.  Any fix for this?

    My iPOD class (last generation) shuts off when jostled--like what
    happens when the headphones come out.  Is there any fix for this?

    I finally resolved my problem after spending way too much time on it. I simply handed my 160GB iPod to my husband to put his fav Stones & Beatles songs on and I went back to my 80GB Microsoft Zune which has never disappointed me.
    After spending so much time trying to figure this out I did finally take it back to Apple Store who performed a diagnostic and found there was a problem with the device. They replaced it with a refurbished one which has similar issues. All I wanted to do was listen to my music. Was that too much to ask? So I am happy to be free of this problematic device. No more Apple for me!!

  • WakeOnLan Service...where do the requests come from?

    I can remotely wakeup a computer from ConsoleOne with the WakeOnLan
    service unloaded from the server.
    That being the case, can someone tell me if the requests come directly
    from the PC or are they 'bounced' off of the zen server?
    Thank you,
    Troy

    Troy,
    yeah the magic packet isn't routable, so you need either a) a WOL
    server on each subnet, or b) enable directed subnet broadcasts for port
    1761
    Shaun Pond

  • How to know wher the request come from??

              I have 2 JSP's forwarding to same 3rd JSP. Now from the 3rd JSP how can I know
              where the request comes from..without using and HTTP parameters
              Can any one help me in this..
              Thanks
              Perianayagam.T
              

    Perianayagam.T wrote:
              >
              > I have 2 JSP's forwarding to same 3rd JSP. Now from the 3rd JSP how can I
              > know where the request comes from..without using and HTTP parameters
              Set a request attribute in the source jsp. In Servlet 2.4 containers, this
              will be done automatically; you will find attributes similar to
              javax.servlet.include.* today.
              Matthias
              Matthias Ernst
              Software Engineer
              CoreMedia - Smart Content Technology
              

  • From which device the request come

    How can we identify, from which device the request come ie; mobile phone, browser etc

    Thanks a lot
    String accept = request.getHeader("accept");
            String user_agent = request.getHeader("user-agent");
            String accept_charset = request.getHeader("accept-charset");
            String accept_language = request.getHeader("accept-language");
            String x_wap_profile = request.getHeader("x-wap-profile");
            String profile = request.getHeader("profile");

  • What day will the iPhone come to tmobile in 2013.if it does

    What day will the iPhone come to tmobile in 2013.if it does come

    Really?
    There is no possible way for anyone here to know this unless Apple announces.

  • Where did the iTunes COM SDK go?

    I was going to go download the iTunes COM SDK, originally at http://developer.apple.com/sdk/, but it appears that when you click on the link to get it, it redirects you to the ADC site... which doesn't have the iTunes COM SDK anywhere in there. Does anyone know where it went?

    You now need to have an ADC membership to download the SDKs. You can sign up for the free Online Developer membership here:
    http://developer.apple.com/products/membership.html

  • Is there a possibility to know mobile device from which the request comes?

    Hi Experts,
    Iam developing mobile UI and I have the following requirement.
    Mobile user launches my application with the help of a URL. I need to know what is the name of the mobile
    device from which user is launching the application. For eg. i need to know if he is using blackberry, nokia etc.
    Is there any way to find this?
    Thanks,
    Satish Challa

    you can get this info from the useragent header info that most web browser include in there http header.  Here is some more info in the case of BlackBerry.
    http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800878/800733/How_To_-_Retrieve_information_about_the_BlackBerry_Browser.html?nodeid=1033750&vernum=0
    cheers
    ed

  • What colors will the s6 come in? Looking for the blue

    I am going to preorder the s6 but i'm wondering what colors it is going to come in. I am looking to get the blue that is available for the regular s6

       I agree they need to sell it in blue there's only four colors to choose from. When something in life don't make sense I usually put a $ sign in front of it, then it usually does. Maybe the blue would cost them $3 bucks more. If that is the case it is stooping pretty low, lol. Maybe they will offer it in blue.
      The Galaxy s6 has good specs except for the battery. The s5 has a 2800 mAh the s6 drops to a 2550 mAh battery, whats up with that? They have some battery saving setting, but so what. The Droid Maxx has a 3500 mAh and the Turbo has a 3900 mAh battery. The battery strength is important with a smartphone.
      But we need it in blue, black phones are boring.

  • Did the requested upgrade and now iTunes won't open for anything

    I upgraded to the newest version and now iTunes wont open, no error message, nothing. It looks as if it's going to launch when I click on it but nothing happens. This Happened last time I upgraded but it worked itself out after a few mins but this has been all day... nothing is working.
    I tried to plug my iPod in and not even that will launch iTunes.
    In a similar topic it was asked if QuickTime would launch, my QuickTime will open but it has been loading for 2hrs now.... WHATS GOING ON?!!???
    Dell dimension desktop   Windows XP  

    Me too... The other post relating to this was with a PC but the same is happening for macs too by the look of it. Has anyone got an idea of how to sort this out? I don't suppose it's possible to find an earlier version of iTunes to download? I'm going to have a search now cos I need iTunes to be working!

  • How to trace IP address ports and request comming to network interfaces

    Hi all,
    I am using Solaris IP filter. I need to check the requests that is comming to a patiquler interfaces.
    Is there any possibilities to get the IP address: Port, weather the request is Deny from the server etc....
    Thanks.
    Viraj

    Lian,
    Did you find a solution?? If still looking, talk to Triometric, they can monitor and log this, a side effect of performance monitoring.
    Have fun

  • Did the ipad 3 come out yet?

    Did the ipad3 come out yet?

    Actually the latest ipad is actually a 4th generation machine, and the marketing spin doctors at apple are calling this the "New iPad", whereas the iPad 3 came out earlier this year circa March 2012, and it seems that you can't even buy the 3 anymore as you only get the 2nd gen and New iPad as available on the apple store.

  • What firmware does the new 8gb iphone comes in?

    i need to buy an iphone and wants to know what firmware does the 8gb comes with? i want to buy it in the apple store near my work. after hearing all the bad news about the 1.1.1 update i may want to older 1.0.2 verison and update it later when a beter debugged 1.1.1 or better comes out.
    thanks.

    1.1.1 - there are other forum topics on this exact same topic.
    If you by a phone that uses 1.0.2 you will NOT be able to activate it until you update to 1.1.1 - you get a prompt right on the activation screen that says update and will not proceed until you do.
    You have no choice.

Maybe you are looking for