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

Similar Messages

  • 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

  • How Vlan identifies from which port the data has come ?

    Hi ,
    We know that more number of ports can be configured to same vlan. How vlan distinguish between the ports ? How vlan knows from which port this frame has come ? in tagging we add the vlan id to the frame and not any other info ? little confused on how this haapens ??

    Disclaimer
    The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
    Liability Disclaimer
    In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
    Posting
    A VLAN doesn't really distinguish between ports.  A switch does, though, "remember" (for some time) the source MAC as frames enter its ports.
    Tagged frames may contain more than VLAN ID, such as L2 CoS.

  • As soon as I open Firefox there appears a page, in German, which I did not request. it is there permanently and I cannot get rid of it. Can someone help? Thank you.

    when i go into firefox there is a page from a German Institute, in German, site which I never requested and I don't have any use for. The page is there everytime I open firefox and I cannot get rid of it. I have tried everything I know (which is not much) and it will not go away. It is stuck there and I see it everytime I open the browser

    Hello Dave69X, try with ClamXav : http://www.clamxav.com/download.php
    thank you

  • Which repository did my program come from?

    Hello.  I would like to post a feature request for gnucash.  Unfortunately, I cannot determine the repository from whence it came.  Generally speaking, how do I determine a program's repository?  The --info switch for pacman doesn't seem to cover it and I can't find anything in the pacman or yaourt man pages.  Is there some magical pacman switch that I missed?

    As Mr.Elendig said, pacman does not track where a package originated from.  If the output of -Qi included the repo, it could quite possibly be incorrect information, as could -Si.  Example:  I could have a custom version of program X compiled with the same package name as in the repos.  I install it with -U.  The output of -Si tells me this package comes from [extra] when in fact it came from no repo at all.  The same happens if you have custom repositories that have packages with the same name as arch repos.

  • After resetting ipad, unable to get to home screen. Only displays request to attach to Itunes, which I did. What next?

    after resetting ipad and removing all programs, cannot get to home screen. Only get request to plug in to itumes,which I did, and it still goes back to that, and the apple logo.

    The message means that you need to restore the iPad using iTunes. When you connect the iPad to your computer and launch iTunes, if you cannot see the iPad under the devices heading in the sidebar of iTunes, you wll have to restore using recovery mode. If you see the iPad under the devices heading, click on it and then click on the summary tab on the right and click on restore.
    If that doesn't work, this is how to restore with recovery mode.
    Disconnect the USB cable from the iPad, but leave the other end of the cable connected to your computer's USB port.
    Turn off iPad: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for iPad to turn off.
    If you cannot turn off iPad using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the iPad turns off, release the Sleep/Wake and Home buttons.
    While pressing and holding the Home button, reconnect the USB cable to iPad. When you reconnect the USB cable, iPad should power on.
    Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears you can release the Home button.
    If necessary, open iTunes. You should see the recovery mode alert that iTunes has detected an iPad in recovery mode.
    Use iTunes to restore iPad.
    If you are running iTunes 11 - and you can't see the sidebar - to to View>Show Sidebar from the iTunes menu at the top of the screen.

  • 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

  • JDBC Driver com.ibm.as400.access.AS400JDBCDriver - which port?

    Hi
    We are trying to connect to an AS400 from SAP XI 3.0 using JDBC.
    I am currently getting a Connection Timeout error;
    Error during database connection to the database URL 'jdbc:as400://xxxxxDEV;Fxxxxx.LIB/Fxxxxx.LIB' using the JDBC driver 'com.ibm.as400.access.AS400JDBCDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:as400://xxxxxDEV;Fxxxxx.LIB/Fxxxxx.LIB': SQLException: The application requester cannot establish the connection. (Connection timed out: connect)'
    Can anyone tell me how to find which Port this is trying to connect on?
    We already have successful connections to a different AS400 within our own network, so there is no issues with the driver not being deployed in XI.
    Thanks in advance.

    >
    Andy Cliff wrote:
    > Hi
    > We are trying to connect to an AS400 from SAP XI 3.0 using JDBC.
    >
    > I am currently getting a Connection Timeout error;
    >
    > Error during database connection to the database URL 'jdbc:as400://xxxxxDEV;Fxxxxx.LIB/Fxxxxx.LIB' using the JDBC driver 'com.ibm.as400.access.AS400JDBCDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:as400://xxxxxDEV;Fxxxxx.LIB/Fxxxxx.LIB': SQLException: The application requester cannot establish the connection. (Connection timed out: connect)'
    >
    > Can anyone tell me how to find which Port this is trying to connect on?
    >
    > We already have successful connections to a different AS400 within our own network, so there is no issues with the driver not being deployed in XI.
    >
    > Thanks in advance.
    What are the JDBC settings in CC? The DB that you are trying to connect, have the same dbs version of AS400 that successful connected?

  • I'm trying to open files which are telling me to instal Adobe Reader.  Which I did but the agreement which needs to be ticked off so this reader can open doesn't come up.  Please could you be of some assistance.

    I'm trying to open files which are telling me to instal Adobe Reader.  Which I did but the agreement which needs to be ticked off so this reader can open doesn't come up.  Please could you be of some assistance.

    Select one of the files, Choose GetInfo from the Finder's File menu, look for the field named "Open With", and choose Preview from the adjacent menu. Accept that ALL such files will Open with Preview, and your major problems should be solved.
    Occasionally, a particularly complex .pdf file or one that needs to be modified and re-written will not work quite right with Preview, but such issues are rare.

  • I recently purchased this 21.5 inch iMac in the month of February. The woman that helped me through the process of purchasing this told me that it comes with the latest Mountain Lion. which it did, but i cant write a review in the app store! Help...

    II recently purchased this 21.5 inch iMac in the month of February. The woman that helped me through the process of purchasing this told me that it comes with the latest Mountain Lion. which it did, but i cant write a review in the app store! Help...

    You want to write a review about Mountain Lion? I'm not sure that you can write about the OS at the app store - it's not an app. Or are you talking about the online Apple store? If you want to send feedback to Apple, you could use this:
    http://www.apple.com/feedback/macosx.html

  • After an recent OS7 update my iPad2 requested a restore which I did, at the end my iPad jumped into "communicating with iTune" but it never communicates. I restored 3 time alreaady and I am not able to communicate with iTune to be able to use my iPad

    After an recent OS7 update my iPad2 requested a restore which I did, at the end my iPad jumped into "communicating with iTune" but it never communicates. I restored 3 time alreaady and I am not able to communicate with iTune to be able to use my iPad which is my working tool.
    What should I do?

    Communicate with iTunes? What does this mean? Tell us what you are seeing on your screen and what you then try to do?

  • How could I find out which user did release a transport request in the sour

    How could I find out which user did release a transport request in the source system

    Hi Tina,
    Use SE10 t-code and type abaper user name in the user field then check released check box then display and select request number which is released, double click on said request number and click on "object list of request" Then click on "comment: released" than you can find out the released user name at the end of request number along with dated of released.
    I hope you problem will be solved.
    Regards,
    Anil

  • 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");

  • Strip port number from request

    We recently upgraded our network and proxy servers. After the upgrade the proxy started adding port number of the origin web server to the request.
    For example www.xxx.com became www.xxx.com:85 if backend web server was listening to alteon on port 85.
    The response from the web server is keeping the port number. We would like to strip the port number off. www.xxx.com:85/foo -> www.xxx.com/foo.
    This is only affecting us adversely in 301 and 302 redirects where we have to give new url to client
    Message was edited by:
    mshamber001

    Ideally, the reverse proxy should be configured to correctly rewrite URLs for the servers it's reverse proxying. (For example, Sun Java System Web Server Proxy 4.0 can be used as a caching reverse proxy and load balancer. It will automatically rewrite the URLs used in 301 and 302 redirects.)
    If for some reason it's not possible to configure the reverse proxy correctly, you can tell Web Server 7.0 which port to use in redirects using the <server-name> element in server.xml:<server-name>www.example.com:80</server-name>If you're using Web Server 6.1 (SP2 or higher), you must instead use the servername attribute in server.xml:<LS ... servername="www.example.com:80" />

  • Finding which recipients did not dequeue a message

    Hello
    Is there a way with a multiconsumer queue to fid out which recipients in the list have not dequeued the message?
    The scenario is this. We have a number of daemon type processes that sit on queues, processing whatever messages they need to. We need a way of finding out if each daemon is alive and kicking.
    The way I thought of doing this was to set up a multiconsumer queue and enqueue a message with the list of recipients being each daemon process, and set an expiration time of say 10 seconds. The daemons listen to their normal work queue and the "are you alive" queue, and just dequeue any messages on the latter. If the message is not dequeued by all recipients within the time limit, the message will be moved to the exception queue. The process that sent out the request can then just listen on the exception queue for a mesage comming back, but it needs to know which recipient did not dequeue it's message.
    So is it possible to find out which recipients did not dequeue the message just from the exceptions queue and supporting meta data tables? Does this sound like a reasonable approach?
    David

    Yes, you can, use the queue table view. It has the consumer name column. View is automatically created [by default] when the table is created.
    All the queue table view name start with AQ$<Queue table name>.
    For example :- if a queue table name is customer_qt then the view name would be aq$customer_qt.
    Regards,
    Sanjeev

Maybe you are looking for