<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Capturing of IP Address through Java Code in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990159#M3594913</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunita,&lt;/P&gt;&lt;P&gt;Thanks for taking time to reply. Can you be more clearer regarding the Internet Settings, port and other popins that needs to be checked?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jan 2014 13:14:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2014-01-20T13:14:10Z</dc:date>
    <item>
      <title>Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaq-p/9990156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I have a situation in my Webdynpro Java Application where I have to capture the IP address of the end user's PC. I use the below code for capturing IP:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IWDRequest req = WDProtocolAdapter.getProtocolAdapter().getRequestObject();&lt;/P&gt;&lt;P&gt;String ipAddress = req.getClientHostName();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is, the code is working perfectly in Quality system, but not in Production system. The IP which is captured in the Production system is the Portal IP itself. Is the problem has to do with some Network settings or the code has to be changed?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 08:08:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaq-p/9990156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-20T08:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990157#M3594911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sujai&lt;/P&gt;&lt;P&gt;There was a similar issue faced by me while in ITS.&lt;/P&gt;&lt;P&gt;You have to cross check with internet settings+port+clear histrory and other popins.&lt;/P&gt;&lt;P&gt;Also in the code where URL is provided : Check the path should be proper, not refering to sap logon files present in local drives, so as to make system independent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 12:01:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990157#M3594911</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-20T12:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990158#M3594912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: Verdana, Arial, helvetica, sans-serif; font-size: 12px;"&gt;Can you please try following code.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: Verdana, Arial, helvetica, sans-serif; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You may not get the real client IP if a the client is behind a proxy, you will get the IP of the proxy and not the client. However, the proxy may include the requesting client IP in a special HTTP header.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HttpServletRequest req=(HttpServletRequest)TaskBinder.getcurrentTask().getProtocolAdapter().getRequestObjectInternal().getProtocolRequest();&lt;/P&gt;&lt;P&gt;req.getHeader("X-Forwarded_For);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="1590660" __jive_macro_name="thread" class="jive_macro_thread jive_macro" data-orig-content="Find IP address of Client with webdybpro" href="https://community.sap.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Patralekha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 12:39:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990158#M3594912</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-20T12:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990159#M3594913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunita,&lt;/P&gt;&lt;P&gt;Thanks for taking time to reply. Can you be more clearer regarding the Internet Settings, port and other popins that needs to be checked?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 13:14:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990159#M3594913</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-20T13:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990160#M3594914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patralekha,&lt;/P&gt;&lt;P&gt;Thanks for replying. For using the &lt;SPAN style="color: #333333; font-size: 12px;"&gt;HttpServletRequest &lt;/SPAN&gt;in my WD Java code, I need to add the servlet.jar into my DC right? I'll try that way and comeback. &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_macro jive_emote" src="https://community.sap.com/504/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 13:35:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990160#M3594914</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-20T13:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990161#M3594915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patralekha,&lt;/P&gt;&lt;P&gt;Thanks for that helpful link you provided. I was able to do some workarounds by adding servlet.jar as external library to my DC. The below code is what I wrote in my DC:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HttpServletRequest request=(HttpServletRequest)TaskBinder.getCurrentTask().getProtocolAdapter().getRequestObjectInternal().getProtocolRequest();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;String ip = request.getHeader("X-Forwarded-For");&lt;/P&gt;&lt;P&gt;messageManager.reportSuccess("X-Forwarded-For: "+ip);&lt;/P&gt;&lt;P&gt;if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip = request.getHeader("Proxy-Client-IP");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageManager.reportSuccess("Proxy-Client-IP: "+ip);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip = request.getHeader("WL-Proxy-Client-IP");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageManager.reportSuccess("WL-Proxy-Client-IP: "+ip);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip = request.getHeader("HTTP_CLIENT_IP");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageManager.reportSuccess("HTTP_CLIENT_IP: "+ip);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip = request.getHeader("HTTP_X_FORWARDED_FOR");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageManager.reportSuccess("HTTP_X_FORWARDED_FOR: "+ip);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip = request.getRemoteAddr();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageManager.reportSuccess("getRemoteAddr: "+ip);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip = null&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip = request.getRemoteHost();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageManager.reportSuccess("getRemoteHost: "+ip);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For all the messages except the last two messages, I get null as the answer. For request.getRemoteAddr() and request.getRemoteHost(), it is returning the proxy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please help on this or guide me in the right path?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 15:26:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990161#M3594915</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-20T15:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990162#M3594916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; background-color: #f6f6f6;"&gt;There is one issue in&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 11.818181991577148px; background-color: #f6f6f6; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;request.getRemoteAddr()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 11.818181991577148px; background-color: #f6f6f6; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; background-color: #f6f6f6;"&gt;The problem, is that the IP we get is not always the correct IP. For example if our server is behind a load balancer, the method “request.getRemoteAddr” returns the IP of the load balancer and not the IP of the remote client. Another common example, is that the client is behind some proxy or even several proxies. The IP we will get will not be the correct IP.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; background-color: #f6f6f6;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; background-color: #f6f6f6;"&gt;Check following link:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; background-color: #f6f6f6;"&gt;&lt;A href="http://www.codereye.com/2010/01/get-real-ip-from-request-in-java.html" title="http://www.codereye.com/2010/01/get-real-ip-from-request-in-java.html"&gt;Coder Eye: Get real IP from request in Java&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 09:16:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990162#M3594916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-21T09:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing of IP Address through Java Code</title>
      <link>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990163#M3594917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the link Patralekha.&lt;/P&gt;&lt;P&gt;I see that, there also the code accesses 'X-Forwarded-For' parameter. It seems that parameter will be false by default in SAP Webdispatcher. We have asked the basis team to configure that. Since it is PRD server, unfortunately we can't do that at this time. Once that is done and if my code works, I will update this place&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 08:52:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/capturing-of-ip-address-through-java-code/qaa-p/9990163#M3594917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-22T08:52:35Z</dc:date>
    </item>
  </channel>
</rss>

