cancel
Showing results for 
Search instead for 
Did you mean: 

IP address of client

Former Member
0 Kudos

Does anybody know how to obtain the IP address of the client in my iView?

I tried <b>request.getServletRequest().getRemoteAddr()</b>, but for some reason it returns the IP address of the portal server instead of the IP address of the client.

I have tried both with "Bypass iView server", and without, in the iView setup.

Any help will be appreciated.

Thanks,

Atul

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Just tried it from two different clients, and it correctly returns the ip of the client.

Don't know whats going wrong.

Former Member
0 Kudos

Dieter,

Did you try it from the PDK, or the portal? It works for me on the PDK, but not on the portal.

If it was on the portal, can you post code snippets and settings you think may be relevant?

Thanks for your help.

Atul

Former Member
0 Kudos

I tried it in the portal (EP6 SP2).

Oliver_S
Advisor
Advisor
0 Kudos

in EP50 a different method is needed, because the 5.0 iviewserver handles the request.

Therefore getRemotehist() delivers the correct IP, the one from the iviewserver. Try bypass iviewserver. Or

the method getAllProperties[] in EP5.0 environment and it returns the IP client. Another more elegant possibilty of course is to use respective PortalRuntime methods

BR,

Oliver

Former Member
0 Kudos

Oliver,

Thanks for the response. We use EP5, and I do have the iView setting at "Bypass iView server".

I think this is heading in the right direction, except that I do not know what classes you are referring to. Can you tell me which class has the getAllProperties[] method?

Also, I checked the javadoc for the PortalRuntime object, and none of the four methods seemed to be appropriate. If you could provide just a little more info, that would help me a lot.

Thanks,

Atul

Oliver_S
Advisor
Advisor
0 Kudos

First:

getServletRequest

public javax.servlet.http.HttpServletRequest getServletRequest()Gets the actual servlet request. Note: It is recommended not to access the servlet request if possible. This is only available, if the request was initiated from a servlet based connection.

Returns:

The actual servlet request or null if not applicable

there you have 3 methdos:

String getRemoteAddr()

Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.

String getRemoteHost()

Returns the fully qualified name of the client or the last proxy that sent the request.

int getRemotePort()

Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request

BR,

Oliver

Former Member
0 Kudos

Oliver,

Thanks for taking the time to reply. If you look at the original message, I have tried exactly what you said I should do. However, The address returned is that of the portal server, instead of the client.

I think I will open an OSS message - I will update here on how that goes.

Thanks,

Atul