11.2.3. Hostname change event handler
The handler signature:
void onHostnameChanged(ServiceEndpointEvent e)
The procedure of getting the updated hostname is similar to the previous ones. In the handler’s body, call the getEndpoint method on the ‘e’ parameter. It returns the endpoint that invoked the handler. Then call the endpoint’s getHostname method. It has the following signature:
public String getHostname()
The example below demonstrates these steps:
public void onHostnameChanged(ServiceEndpointEvent e)
{
ServiceEndpoint serviceEndpoint = e.getEndpoint();
System.out.println(String.format("The updated service hostname: %s", serviceEndpoint.getHostname()));
}