📄 md5produce.java
字号:
package com.intohotel.util;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* MD5码 生产者 ^-^ java里喜欢这么称呼
* @author weihuawon
*
*/
public class Md5Produce {
public static String produceMd5(){
/**
* 赋初值是良好的编程习惯
*/
String md5 =null;
try {
URL url = new URL("http://getair.szsbx.com/Default.aspx?strV=SZX@PEK@"+new SimpleDateFormat("yyyy-MM-dd").format(new Date())+"@@0@22233");
URLConnection con = url.openConnection();
con.setRequestProperty( "Referer", "http://localhost:8080/airQuery" );
con.getContentType();
md5 = con.getURL().getQuery();
md5 = md5.split( "&" )[0].split( "=" )[1];
} catch (Exception e) {
throw new RuntimeException("服务器端回传字符串异常");
}
return md5;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -