Here you can find the source of getCasServerHostName()
public static String getCasServerHostName()
//package com.java2s; //License from project: Apache License import java.net.InetAddress; public class Main { /**//ww w. ja va 2s. c o m * Gets cas server host name. * * @return the cas server host name */ public static String getCasServerHostName() { try { final String hostName = InetAddress.getLocalHost().getCanonicalHostName(); final int index = hostName.indexOf('.'); if (index > 0) { return hostName.substring(0, index); } return hostName; } catch (final Exception e) { throw new IllegalArgumentException("Host name could not be determined automatically.", e); } } }