DynamoHttpServletRequest.getRemotePort() is return 0 How to get client Remort Port

129 Views Asked by At

I need client remote port for some validation. I tried to get Remote Port in request but result come only Zero 0. I seen that OOTB class DynamoHttpServletRequest its default return the zero any way to get the client remote port.

In OOTB class DynamoHttpServletRequest returns

public int getRemotePort() {
    return 0;
}

Is there any possibility to get remote port? Any alternative ways to get Client Remote port?

1

There are 1 best solutions below

0
Justin On

I got the remote port help of implemented class HttpServletRequest.

public int getClientPort(DynamoHttpServletRequest req){ 
    int remortPortVal = req.getRequest().getRemotePort();
    return remortPortVal;
}