List list = new ArrayList();
if (null != context || context.length()!=0) {
list = StringUtil.ssplit(context);
}
public static List ssplit(String text) {
String[] strArray = null;
List<String> list = new ArrayList<String>();
strArray = text.split("\\|", -1);
for (String str : strArray) {
int i = str.length();
if (str.equals("") || str.length() == 0) {
} else {
list.add(str);
}
System.out.println(str);
}
return list;
}
public static String getPort(){
String port="";
try {
MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
Set<ObjectName> objectNames = beanServer.queryNames(new ObjectName("*:type=Connector,*"),
Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
port = objectNames.iterator().next().getKeyProperty("port");
System.out.println("port"+port);
} catch (MalformedObjectNameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return port;
}
public static String getLocalIP(){
InetAddress addr = null;
try {
addr = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
byte[] ipAddr = addr.getAddress();
String ipAddrStr = "";
for (int i = 0; i < ipAddr.length; i++) {
if (i > 0) {
ipAddrStr += ".";
}
ipAddrStr += ipAddr[i] & 0xFF;
}
//System.out.println(ipAddrStr);
return ipAddrStr;
}