package com.hand.kinggrid; public class MainRequest { /** * 信签服务器地址 */ //public static final String SERVER_URL = "http://171.34.78.70:8081:8081/tosignserver"; //public static final String SERVER_URL = "http://10.203.0.11:8989/tosignserver"; // public static final String SERVER_URL = "http://171.34.78.70:8081/tosignpub"; /** * 信签服务器对接应用ID */ //public static final String APP_ID = "king"; // public static final String APP_ID = "ac4a3bd1bf6f44fa86477ac251933259"; //public static final String APP_ID = "f12a2c19e72348998b159df903b9b379"; /** * 信签服务器对接应用密钥 */ //public static final String APP_SECURITY = "e3f55030d473095d"; // public static final String APP_SECURITY = "7lQ7GC1HSviWAFG6"; //public static final String APP_SECURITY = "SK60MXsN7dzv1iIM"; //public static final String APP_ID = "f12a2c19e72348998b159df903b9b379"; /** * 测试签署用户编码 */ //public static final String SIGNER_CODE= "hlzlUser"; //public static final String SIGNER_CODE= "lidongzhang"; /** * 模板创建合同使用的模板编码 */ //public static final String CONTRACT_TPL_CODE= "testTemplate"; public static void main(String[] args) { } /** * 生成信签请求操作对象 * @param url * @return */ public static HttpRequest createHttpRequest(String url,String server_url,String app_id,String app_security){ String requestUrl = url; if(!url.toUpperCase().startsWith("HTTP")){ if(server_url.endsWith("/")){ requestUrl = server_url.substring(0, server_url.length()-1)+url; }else{ requestUrl = server_url+url; } } HttpRequest httpRequest = new HttpRequest(requestUrl); /** * 如果是云服务,需要添加应用id到header * 如果是私有云,可以不用设置 */ httpRequest.addHeader("app_id", app_id); String time = System.currentTimeMillis()+""; httpRequest.addHeader("time", time); httpRequest.addHeader("sign", MD5.toMD5(app_id+"."+time+'.'+app_security)); return httpRequest; } }