Reputation: 1329
I tried to get hostname and port using
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr()
but it is giving the client details.
How can we get the host name and port from cxf Message?
Upvotes: 2
Views: 1091
Reputation: 1329
I've got the solution
Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
String host = headers.get("host").get(0);
This will get you the host ip with port.
Upvotes: 2