单点登录三个接口

master
CL 2 years ago
parent a0bf1fec0b
commit 62f6af6b0b

@ -0,0 +1,16 @@
package com.api.wxbsinglelogin;
import com.engine.web.wxbaction.SingelLoginAction;
import javax.ws.rs.Path;
/**
* @author:CL
* @date:2023/3/6 10:02
* wxb
*/
@Path("/wxb/singleLogin")
public class SingelLoginApi extends SingelLoginAction {
}

@ -0,0 +1,320 @@
package com.engine.web.wxbaction;
import com.alibaba.fastjson.JSON;
import com.alitriph5.logging.Logger;
import com.alitriph5.logging.LoggerFactory;
import com.engine.web.wxbaction.pojo.User;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.modeexpand.HttpClient;
import weaver.formmode.customjavacode.modeexpand.MyWebSocketClient;
import weaver.general.BaseBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
/**
* Action
*
* @author:CL
* @date:2023/3/6 10:05
*/
public class SingelLoginAction {
private static final Logger log = LoggerFactory.getLogger("【com.engine.web.wxbaction.SingelLoginAction --------------wxb_SingelLogin】");
/**
*
*
* @param request
* @param response
* @return
*/
@POST
@Path("/getRandomNum")
public String getRandomNum(@Context HttpServletRequest request, @Context HttpServletResponse response) {
log.info("已进入获取随机数请求");
BaseBean bb = new BaseBean();
String ip = bb.getPropValue("wxbSingelLogin", "ip");
String url = "http://" + ip + ":10318/GeneratorChallenge";
String challenge="";
// 响应的结果集
Map<String, Object> resultMap = new HashMap<>();
// 调用身份认证服务端
try{
challenge = HttpClient.httpPostForm(url, null, null, "utf-8");
}catch (Exception e){
resultMap.put("code", 500);
resultMap.put("data", "获取随机数失败,请检查身份认证服务端的服务状态!!");
log.info("获取随机数请求失败,请检查身份认证服务端的服务状态!!【 " + e + " 】");
return JSON.toJSONString(resultMap);
}
log.info("获取到的64位编码随机数【 " + challenge + " 】");
// random = getBase64(message);
// log.info("64位编码随机数解码结果【 " + random + " 】");
if (!challenge.isEmpty()) {
resultMap.put("code", 200);
resultMap.put("data", challenge);
// TODO 获取随机数返回登录页面
} else {
resultMap.put("code", 500);
resultMap.put("data", "获取随机数为空!!");
}
return JSON.toJSONString(resultMap);
}
/**
*
*
* @param request
* @param response
* @return
*/
@POST
@Path("/getIdentitynote")
public String getIdentitynote(@Context HttpServletRequest request, @Context HttpServletResponse response) {
log.info("已进入获取票据请求");
// TODO 获取随机数 request.getParameter("challenge");
String challenge = "dGVzdHJhbmRvbWRhdGE=";
// BaseBean bb = new BaseBean();
// String ip = bb.getPropValue("wxbSingelLogin", "ip");
StringBuffer content = new StringBuffer();
content.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
content.append("<getsignandtokenreq version=\"1\"><challenge>");
content.append(challenge);
content.append("</challenge></getsignandtokenreq>");
// 传给websocket的请求数据
String res = content.toString();
// websocke服务返回数据 是一个xml
String xml = null;
// 连接本地的websocket终端 并发送消息
MyWebSocketClient client = null;
try {
// 实例WebSocketClient对象并连接到WebSocket服务端
client = new MyWebSocketClient(new URI("ws://127.0.0.1:30318/"));
// 连接
client.connect();
while (!client.isOpen()) {
log.info("连接至本地终端中===========");
Thread.sleep(500);
}
// 向WebSocket服务端发送数据
client.send(res);
// 等待WebSocket服务端响应
while ((xml = client.getExcptMessage()) == null) {
log.info("服务忙等待=============");
Thread.sleep(500);
}
//接收到服务器返回的数据
log.info("本地终端服务返回的xml数据【 " + xml + " 】");
} catch (Exception e) {
e.printStackTrace();
} finally {
// 关闭连接
client.close();
}
// 解析websocket返回的xml 提取到tokeninfo信息
Document doc;
// 解析到的tokeninfo
String tokeninfo = "";
// 失败原因,字符串,result非0时有返回值。
String errorinfo = "";
// 解码后的tokeninfo
String decodedTokeninfo = "";
// 响应的结果集
Map<String,Object> resultMap=new HashMap<>();
try {
doc = DocumentHelper.parseText(xml);
Element rootElt = doc.getRootElement();
log.info("获取票据接口【rootElt根节点】======" + rootElt.getName());
String result = rootElt.element("result").getText();
// 处理结果 整型值 0-成功 非0-失败
if (result.equals("0")) {
// 获取到tokeninfo节点内容
tokeninfo = rootElt.element("tokeninfo").getText();
log.info("获取票据接口【tokeninfo内容】=========" + tokeninfo);
// 解码后的tokeninfo
decodedTokeninfo = getBase64(tokeninfo);
log.info("获取票据接口【tokeninfo解码后内容】=============" + decodedTokeninfo);
resultMap.put("code",200);
resultMap.put("tokeninfo",tokeninfo);
} else {
errorinfo = rootElt.element("errorinfo").getText();
resultMap.put("code",500);
resultMap.put("errorinfo",errorinfo);
}
} catch (DocumentException e) {
e.printStackTrace();
log.info("获取票据接口 出现异常 =============" + e);
}
return JSON.toJSONString(resultMap);
}
/**
*
*
* @param request
* @param response
* @return
*/
@POST
@Path("/Authentication")
public String Authentication(@Context HttpServletRequest request, @Context HttpServletResponse response) {
log.info("已进入验证票据请求");
BaseBean bb = new BaseBean();
// 身份认证应用服务IP
String ip = bb.getPropValue("wxbSingelLogin", "ip");
// 应用标识
String appserverid = bb.getPropValue("wxbSingelLogin", "appserverid");
// 响应的结果集
Map<String,Object> resultMap=new HashMap<>();
// 调用身份认证服务端
String url = "http://" + ip + ":10318/VerifyIdentityTicket";
StringBuffer content = new StringBuffer();
content.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?");
content.append("<verifyidentityticketreq version=\"1\"><challenge>");
// TODO 获取随机数和 票据信息 request.getParameter("challenge"); request.getParameter("identityticket");???
content.append("随机数");
content.append("</challenge><identityticket>");
content.append("票据信息");
content.append("</identityticket><appserverid>");
content.append(appserverid);
content.append("</appserverid></verifyidentityticketreq>");
String rqs = content.toString();
// 发送http请求获取返回结果
String xml = "";
try{
xml = HttpClient.httpPostRaw(url, rqs, null, "utf-8");
}catch (Exception e){
resultMap.put("code", 500);
resultMap.put("data", "验证票据请求失败,请检查身份认证服务端的服务状态!!");
log.info("验证票据接口 验证票据请求失败,请检查身份认证服务端的服务状态!!【 " + e + " 】");
return JSON.toJSONString(resultMap);
}
log.info("验证票据接口 请求身份认证服务端获取到的xml响应【 " + xml + " 】");
// 解析xml响应
Document doc;
// 请求验证票据接口返回的result (未解码)
String result1 = "";
// 请求验证票据接口返回的result (解码后) 得到一个新的xml
String decodedResultxml = "";
// decodedResultxml中的<result>标签
String result2 = "";
// decodedResultxml中的<userinfo>下的<rmsid>标签
String rmsid = "";
try {
doc = DocumentHelper.parseText(xml);
Element rootElt = doc.getRootElement();
log.info("验证票据接口【rootElt根节点】======" + rootElt.getName());
result1 = rootElt.element("result").getText();
// 对结果解码`
decodedResultxml = getBase64(result1);
log.info("验证票据接口【解析后的result】===========" + decodedResultxml);
// 把解析的xml中的result二次解析 (因为解析后的result也是一个xml)
doc = DocumentHelper.parseText(decodedResultxml);
Element resultElt = doc.getRootElement();
result2 = resultElt.element("result").getText();
log.info("验证票据接口【解析后的result里的result 0为验证通过非0为验证不通过】===========" + result2);
// result验证结果,0为验证通过非0为验证不通过
if (result2.equals("0")) {
log.info("验证票·据接口【result验证结果 0为验证通过】=========");
Element userinfos = resultElt.element("userinfo");
rmsid = userinfos.element("rmsid").getText();
log.info("验证票据接口【解析后的result里的userinfo下的rmsid】============================" + rmsid);
RecordSet rs = new RecordSet();
String sql = "select * from hrmresource where uuid=?";
rs.executeQuery(sql, rmsid);
if (rs.next()) {
// 该用户已经在应用系统中存在时,允许用户登录应用系统,完成单点登录。
resultMap.put("code",200);
// TODO 验证成功通过用户标识登录应用系统
resultMap.put("isLogin",true);
// 存储用户信息到session
User user = new User();
user.setId(rs.getInt("id"));
user.setPassword(rs.getString("password"));
user.setLoginid(rs.getString("loginid"));
user.setLastname(rs.getString("lastname"));
user.setSex(rs.getString("sex"));
user.setSystemlanguage(rs.getInt("systemlanguage"));
user.setMaritalstatus(rs.getString("maritalstatus"));
user.setLocationid(rs.getInt("locationid"));
user.setJobtitle(rs.getInt("jobtitle"));
user.setJobactivitydesc(rs.getString("jobactivitydesc"));
user.setJoblevel(rs.getInt("joblevel"));
user.setSeclevel(rs.getInt("seclevel"));
user.setDepartmentid(rs.getInt("departmentid"));
user.setSubcompanyid1(rs.getInt("subcompanyid1"));
user.setManagerid(rs.getInt("managerid"));
user.setAssistantid(rs.getInt("assistantid"));
user.setBankid1(rs.getInt("bankid1"));
user.setCreatedate(rs.getString("createdate"));
user.setLastmoddate(rs.getString("lastmoddate"));
user.setLastlogindate(rs.getString("lastlogindate"));
user.setWorkcode(rs.getString("workcode"));
user.setHealthinfo(rs.getString("healthinfo"));
user.setUsekind(rs.getInt("usekind"));
user.setJobcall(rs.getInt("jobcall"));
user.setManagerstr(rs.getString("managerstr"));
user.setStatus(rs.getString("status"));
user.setIslabouunion(rs.getString("islabouunion"));
user.setCountryid(rs.getInt("countryid"));
user.setDsporder(rs.getString("dsporder"));
user.setClassification(rs.getString("Classification"));
user.setUuid(rs.getString("uuid"));
user.setHashData(rs.getString("hashData"));
user.setSignData(rs.getString("signData"));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setLastlogindate(rs.getString("currentdate"));
user.setAccount(rs.getString("account"));
request.getSession().setAttribute("userbean",user);
log.info("验证票据接口 登录的用户信息============================" + user);
} else {
// 未查到结果 无法登录
resultMap.put("code",500);
resultMap.put("error","系统中未查询到这个人!!");
log.info("验证票据接口 系统中未找到该人============================" );
}
} else {
String error = resultElt.element("error").getText();
log.info("【result验证结果 非0为验证不通过】=========错误信息:" + error);
resultMap.put("code",500);
resultMap.put("error",error);
}
} catch (DocumentException e) {
e.printStackTrace();
log.info("【验证票据请求进入catch】===========:" + e);
}
return JSON.toJSONString(resultMap);
}
/**
* base64
* @param encodedMessage
* @return
*/
public String getBase64(String encodedMessage) {
return new String(Base64.getDecoder().decode(encodedMessage), StandardCharsets.UTF_8);
}
}

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
<id>TestJrebel</id>
<classpath>
<dir name="D:/Project/TestJrebel/out/production/TestJrebel">
</dir>
</classpath>
</application>

@ -0,0 +1,338 @@
package weaver.formmode.customjavacode.modeexpand;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* GetHttpResponse httpGet(String url,Map<String,String> headers,String encode)
*PostPostHttpResponse httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode)
*Post RawHttpResponse httpPostRaw(String url,String stringJson,Map<String,String> headers, String encode)
*Put RawHttpResponse httpPutRaw(String url,String stringJson,Map<String,String> headers, String encode)
*DeleteHttpResponse httpDelete(String url,Map<String,String> headers,String encode)
*/
public class HttpClient {
/**
* http get
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* http post form
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* http post
* @param url
* @param encode
* @return
*/
public static String httpPostRaw(String url,String stringJson,Map<String,String> headers, String encode){
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
//HttpClients.createDefault()等价于 HttpClientBuilder.create().build();
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
httpost.setHeader("Content-type", "application/json");
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
//组织请求参数
StringEntity stringEntity = new StringEntity(stringJson, encode);
httpost.setEntity(stringEntity);
//响应信息
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* http put
* @param url
* @param encode
* @return
*/
public static String httpPutRaw(String url,String stringJson,Map<String,String> headers, String encode){
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
//HttpClients.createDefault()等价于 HttpClientBuilder.create().build();
closeableHttpClient = HttpClients.createDefault();
HttpPut httpput = new HttpPut(url);
//设置header
httpput.setHeader("Content-type", "application/json");
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpput.setHeader(entry.getKey(),entry.getValue());
}
}
//组织请求参数
StringEntity stringEntity = new StringEntity(stringJson, encode);
httpput.setEntity(stringEntity);
//响应信息
httpResponse = closeableHttpClient.execute(httpput);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
closeableHttpClient.close(); //关闭连接、释放资源
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* http delete
*/
public static String httpDelete(String url,Map<String,String> headers,String encode){
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
//since 4.3 不再使用 DefaultHttpClient
closeableHttpClient = HttpClientBuilder.create().build();
HttpDelete httpdelete = new HttpDelete(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpdelete.setHeader(entry.getKey(),entry.getValue());
}
}
httpResponse = closeableHttpClient.execute(httpdelete);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* http post
*/
public static String httpPostFormMultipart(String url,Map<String,String> params, List<File> files,Map<String,String> headers,String encode){
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
MultipartEntityBuilder mEntityBuilder = MultipartEntityBuilder.create();
mEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
mEntityBuilder.setCharset(Charset.forName(encode));
// 普通参数
ContentType contentType = ContentType.create("text/plain",Charset.forName(encode));//解决中文乱码
if (params != null && params.size() > 0) {
Set<String> keySet = params.keySet();
for (String key : keySet) {
mEntityBuilder.addTextBody(key, params.get(key),contentType);
}
}
//二进制参数
if (files != null && files.size() > 0) {
for (File file : files) {
mEntityBuilder.addBinaryBody("file", file);
}
}
httpost.setEntity(mEntityBuilder.build());
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
}

@ -0,0 +1,69 @@
package weaver.formmode.customjavacode.modeexpand;
import com.alitriph5.logging.Logger;
import com.alitriph5.logging.LoggerFactory;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import java.net.URI;
/**
* @author:CL
* @date:2023/3/8 8:50
*/
public class MyWebSocketClient extends WebSocketClient {
private static final Logger log = LoggerFactory.getLogger("【--------------wxb_SingelLogin---MyWebSocketClient-----】");
//用来接收数据
private String excptMessage;
//构造方法
public MyWebSocketClient(URI serverUri) {
super(serverUri);
excptMessage = null;
}
//连接建立成功时调用该方法
@Override
public void onOpen(ServerHandshake serverHandshake) {
log.info("获取票据接口与本地 WebSocket 连接成功!");
}
//收到来自服务端的消息时调用该方法
@Override
public void onMessage(String s) {
log.info("获取票据接口 收到本地终端WebSocket 消息:" + s);
this.excptMessage = s;
}
//连接关闭时调用该方法
@Override
public void onClose(int i, String s, boolean b) {
log.info("获取票据接口与本地 WebSocket 连接 已断开!");
}
//出现错误时调用该方法
@Override
public void onError(Exception e) {
log.info("获取票据接口与本地 WebSocket 连接出现错误!");
}
//发送消息
public void sendMessage(String message){
this.send(message);
log.info("获取票据接口向本地 WebSocket 发送消息 成功!【 " + message+" 】");
}
//获取接收到的信息
public String getExcptMessage() {
if(excptMessage != null){
String message = new String(excptMessage);
excptMessage = null;
return message;
}
return null;
}
}

@ -0,0 +1,138 @@
package weaver.shouwen.cronjob;
import com.cloudstore.dev.api.util.Util_DataCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.*;
/**
* @author:CL
* @date:2023/2/14 10:16
*/
public class DocreceiveunitTimeCron extends BaseCronJob {
private static final Logger LOGGER = LoggerFactory.getLogger("收发文单位定时任务");
@Override
public void execute() {
LOGGER.info(" com.weaver.shouwen.cronjob.DocreceiveunitTimeCron 已进入");
// 取到部门值
BaseBean bb = new BaseBean();
//所属机构
int subcompanyid = Integer.parseInt(bb.getPropValue("gongwenTimesubcompanyid", "subcompanyid"));
//外部单位
int companytype = Integer.parseInt(bb.getPropValue("gongwenTimesubcompanyid", "companytype"));
// 先查标准表 存入list
// String selBzSql = "SELECT id,receiveunitname,canceled from docreceiveunit where subcompanyid="+subcompanyid+" and companytype="+companytype+"";
String selBzSql = "SELECT id,receiveunitname,canceled,unitcode from docreceiveunit where subcompanyid=? and companytype=?";
RecordSet recordSet = new RecordSet();
boolean flag = recordSet.executeQuery(selBzSql, subcompanyid, companytype);
List<Map<String, Object>> docList = new ArrayList<>();
if (flag) {
while (recordSet.next()) {
Map<String, Object> map = new HashMap<>();
// 标准表里1是封存0是启用
map.put("id", recordSet.getString("id"));
map.put("receiveUnitName", recordSet.getString("receiveunitname"));
map.put("canceled", recordSet.getString("canceled"));
map.put("unitcode", recordSet.getString("unitcode"));
docList.add(map);
}
}
// 再查建模表 存入list
String selJmSql = "SELECT id,dwmc,sjzt from uf_SFWDWGL";
recordSet = new RecordSet();
boolean flag2 = recordSet.executeQuery(selJmSql);
List<Map<String, Object>> jianmoList = new ArrayList<>();
if (flag2) {
while (recordSet.next()) {
Map<String, Object> map = new HashMap<>();
// 建模表里1是启用0是封存
map.put("id", recordSet.getString("id"));
map.put("receiveUnitName", recordSet.getString("dwmc"));
map.put("canceled", recordSet.getString("sjzt"));
jianmoList.add(map);
}
}
LOGGER.info(" com.weaver.shouwen.cronjob.DocreceiveunitTimeCron 标准表 【"+docList+"】");
LOGGER.info(" com.weaver.shouwen.cronjob.DocreceiveunitTimeCron 建模表 【"+jianmoList+"】");
// 如果测试表开始就无数据 直接插入 建模表中数据
if (docList.size() == 0) {
// 封存
String canceled = null;
for (Map<String, Object> jianmoMap : jianmoList) {
String insertSql = "INSERT into docreceiveunit " +
"(receiveunitname,companytype,subcompanyid,showorder,canceled,unitcode) VALUES" +
"(?,?,?,?,?,?)";
recordSet.executeQuery(insertSql, jianmoMap.get("receiveUnitName").toString(), companytype, subcompanyid, ".00", ("0".equals(jianmoMap.get("canceled").toString()) ? "1" : "0"), jianmoMap.get("id").toString());
}
LOGGER.info(" com.weaver.shouwen.cronjob.DocreceiveunitTimeCron 标准表内为空 插入了建模表数据");
} else {
// 比对结果
String insertSql = null;
String updateSql = null;
HashSet<String> jianmoNameSet = new HashSet<>();
HashSet<String> docNameSet = new HashSet<>();
HashSet<String> deleteset = new HashSet<>();
for (Map<String, Object> jianmoMap : jianmoList) {
jianmoNameSet.add((String) jianmoMap.get("receiveUnitName"));
// 判断是否需要新增
Integer fg = 0;
for (Map<String, Object> docMap : docList) {
//如果建模表没有与标准表匹配的receiveUnitName则删除标准表的数据
docNameSet.add((String) docMap.get("receiveUnitName"));
// 如果公文表编码和建模表id一样 但封存状态或者名字改变了
if (docMap.get("unitcode").toString().equals(jianmoMap.get("id").toString()) && (docMap.get("canceled").toString().equals(jianmoMap.get("canceled").toString()) || !docMap.get("receiveUnitName").toString().equals(jianmoMap.get("receiveUnitName").toString()))) {
// 更新封存状态和receiveUnitName
updateSql = "UPDATE docreceiveunit set canceled=?,receiveunitname=? WHERE unitcode=?";
recordSet.executeUpdate(updateSql,
("0".equals(jianmoMap.get("canceled").toString()) ? "1" : "0"),
jianmoMap.get("receiveUnitName"), docMap.get("unitcode"));
LOGGER.info(" com.weaver.shouwen.cronjob.DocreceiveunitTimeCron 更新数据sql执行数量");
}
// 如果有一样的 就break
String unitcode = docMap.get("unitcode").toString();
String id = jianmoMap.get("id").toString();
if (unitcode.equals(id)) {
LOGGER.info(" =============判断id 编码相等==================");
fg = 1;
break;
}
}
// 遍历完如果没有一样的就加入
if (fg == 0) {
LOGGER.info(" com.weaver.shouwen.cronjob.DocreceiveunitTimeCron 新增了数据");
insertSql = "INSERT into docreceiveunit " +
"(receiveunitname,companytype,subcompanyid,showorder,canceled,unitcode) VALUES" +
"(?,?,?,?,?,?)";
recordSet.executeQuery(insertSql, jianmoMap.get("receiveUnitName").toString(), companytype, subcompanyid, ".00", ("0".equals(jianmoMap.get("canceled").toString()) ? "1" : "0"), jianmoMap.get("id").toString());
}
}
//如果建模表没有与标准表匹配的receiveUnitName则删除标准表的数据
deleteset.addAll(docNameSet);
deleteset.removeAll(jianmoNameSet);
String deleteSql = null;
String id = "";
for (String receiveunitname : deleteset) {
deleteSql = "select id from docreceiveunit where receiveunitname=?";
recordSet.executeQuery(deleteSql, receiveunitname);
if (recordSet.next()) {
id = recordSet.getString("id");
}
if(!id.isEmpty()){
deleteSql = "delete from docreceiveunit where id=" + id;
recordSet.execute(deleteSql);
LOGGER.info(" com.weaver.shouwen.cronjob.DocreceiveunitTimeCron 删除了【" + receiveunitname + "】的数据id为" + id);
}
}
}
}
}

@ -0,0 +1,200 @@
2020/03/23 12:38:13 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/23 12:52:43 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/23 12:55:15 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/23 12:55:46 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/23 16:37:31 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/23 16:42:40 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/23 18:41:20 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/27 14:44:48 [I] version 1.0
2020/03/27 14:44:48 [I] start websocket server, url: 127.0.0.1:30318
2020/03/27 14:45:03 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge></challenge></getsignandtokenreq>, message type 1
2020/03/27 14:45:26 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge></challenge></getsignandtokenreq>, message type 1
2020/03/27 14:45:33 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:36 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:39 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:42 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:45 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:48 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:51 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:54 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:45:57 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:00 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:03 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:06 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:09 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:12 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:15 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:18 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:21 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:24 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:27 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:30 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:33 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:36 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:39 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:42 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:45 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:48 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:51 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:54 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:46:57 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:00 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:03 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:06 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:09 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:12 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:15 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:18 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:21 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:24 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:27 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:30 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:33 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:36 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:39 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:42 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:45 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:48 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:51 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:54 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:47:57 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:00 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:03 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:06 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:09 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:12 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:15 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:18 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:21 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:24 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:27 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:30 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:33 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:36 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:39 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:42 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:45 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:48 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:51 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:54 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:48:57 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:49:00 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:49:03 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:49:06 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:49:09 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:49:12 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:18 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/27 14:54:22 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:24 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:27 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:30 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:33 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:36 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:39 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:42 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:45 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:48 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:51 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:54 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:54:57 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:00 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:03 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:06 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:09 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:12 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:15 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:18 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:21 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:24 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:27 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:30 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:33 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:36 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:40 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 14:55:42 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:03:13 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/27 15:05:21 [I] version 1.0
2020/03/27 15:05:21 [I] start websocket server, url: 127.0.0.1:30318
2020/03/27 15:05:23 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/27 15:16:38 [I] version 1.0
2020/03/27 15:16:38 [I] start websocket server, url: 127.0.0.1:30318
2020/03/27 15:16:44 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/27 15:16:45 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:46 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:47 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:48 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:49 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:50 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:51 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:52 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:53 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:54 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:55 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:56 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:57 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:58 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:16:59 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:00 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:01 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:02 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:03 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:04 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:05 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:06 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:07 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:08 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:09 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:10 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:11 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:12 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:13 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:14 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:15 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:16 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:17 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:18 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:19 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:20 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:21 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:22 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:23 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:24 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:25 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:26 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:27 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:28 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:38 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:47 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/27 15:17:56 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/30 10:21:34 [I] version 1.0
2020/03/30 10:21:34 [I] start websocket server, url: 127.0.0.1:30318
2020/03/30 10:24:29 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>dGVzdHJhbmRvbWRhdGE=</challenge></getsignandtokenreq>, message type 1
2020/03/30 10:24:38 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/30 10:24:47 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/30 10:24:56 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/30 10:25:05 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/30 10:25:14 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/03/30 10:25:23 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getauthstatusreq version="1"></getauthstatusreq>, message type 1
2020/05/25 16:41:09 [I] version 1.0
2020/05/25 16:41:09 [I] start websocket server, url: 127.0.0.1:30318
2020/05/25 16:43:08 [I] version 1.0
2020/05/25 16:43:08 [I] start websocket server, url: 10.106.9.202:30318
2020/05/25 16:44:01 [I] websocket request for user info
2020/05/25 16:44:02 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtoken version="1"><challenge>7DbgT65HZFiNEQ5rK3X7eQ==</challenge></getsignandtoken>, message type 1
2020/05/25 16:44:02 [I] websocket send message finished: userId=testUserId
2020/05/25 16:44:29 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtoken version="1"><challenge>7DbgT65HZFiNEQ5rK3X7eQ==</challenge></getsignandtoken>, message type 1
2021/10/21 14:09:31 [I] version 1.0
2021/10/21 14:09:31 [I] start websocket server, url: 127.0.0.1:30318
2021/10/21 14:09:59 [I] recv: <?xml version="1.0" encoding="UTF-8"?><getsignandtokenreq version="1"><challenge>7DbgT65HZFiNEQ5rK3X7eQ==</challenge></getsignandtokenreq>, message type 1
2023/03/03 17:00:01 [I] version 1.0
2023/03/03 17:00:01 [I] start websocket server, url: 127.0.0.1:30318
2023/03/03 17:00:04 [I] version 1.0
2023/03/03 17:00:04 [I] start websocket server, url: 127.0.0.1:30318
2023/03/06 11:22:49 [I] version 1.0
2023/03/06 11:22:49 [I] start websocket server, url: 127.0.0.1:30318
2023/03/06 11:22:52 [I] version 1.0
2023/03/06 11:22:52 [I] start websocket server, url: 127.0.0.1:30318
2023/03/06 11:22:53 [I] version 1.0
2023/03/06 11:22:53 [I] start websocket server, url: 127.0.0.1:30318
2023/03/06 11:49:42 [I] version 1.0
2023/03/06 11:49:42 [I] start websocket server, url: 127.0.0.1:30318

@ -0,0 +1,60 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
function WebSocketTest()
{
if("WebSocket" in window)
{
//alert("WebSocket is supported by your Browser!");
var ws= new WebSocket("ws://127.0.0.1:30318/");
ws.onopen = function()
{
var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><getsignandtokenreq version=\"1\"><challenge>7DbgT65HZFiNEQ5rK3X7eQ==</challenge></getsignandtokenreq>";
ws.send(str);
var a = document.createElement('div');
a.textContent == "" ? a.textContent= '\n开始发送请求...\n' + str : a.innerText= '\n开始发送请求...\n' + str;
document.getElementById("showResult").appendChild(a);
};
ws.onmessage = function(evt)
{
var received_msg = evt.data;
var b = document.createElement('div');
b.textContent == "" ? b.textContent = '\n返回结果\n' + evt.data:b.innerText= '\n返回结果\n' + evt.data;
document.getElementById("showResult").appendChild(b);
};
ws.onclose = function()
{
//document.write("Connection is closed...");
var c = document.createElement('div');
c.textContent == "" ? c.textContent = '\n连接已关闭' : c.innerText= '\n连接已关闭';
document.getElementById("showResult").appendChild(c);
};
}
else
{
var d = document.createElement('div');
d.textContent == "" ? d.textContent = '\n浏览器不支持websocket': d.innerText= '\n浏览器不支持websocket';
document.getElementById("showResult").appendChild(d);
}
}
</script>
</head>
<body>
<div id="sse">
<a href="javascript:WebSocketTest()">应用调用websocket标准接口测试</a>
</div>
<div id="result">
<p>测试结果:
<div id="showResult">
</div>
</div>
</body>
</html>

@ -0,0 +1,14 @@
websocket 软库接口程序
程序功能软库在本地启动一个模拟服务应用发起接口调用websocket响应中返回票据数据
应用按照文档提供的格式说明解析所需的用户信息。
1 双击ws_server-soft.exe 程序启动命令行窗口监听30318端口
2 确认websocket-test.xml与ws_server-soft.exe在同一路径下否则无法返回正确的票据数据。
异常情况返回数据格式测试:
可以手动重命名websocket-test.xml为其他文件名称再次调用接口返回失败时的响应结果。
验证完毕后务必将测试文件名还原为websocket-test.xml。
3 接口日志文件为当前路径下的log目录查看websocket.log

@ -0,0 +1,82 @@
## 模拟windows环境调试
as_server.exe是模拟单点登录文档说明中的产生随机数和验证票据两个接口。
双击程序在10318端口启动http监听模拟服务。
【注】当测试验证票据结果xml中用户标识rmsid为定制格式时模拟程序启动方式
打开cmd命令行工具执行as_server.exe -ticketFlag=false
## 模拟linux64位服务器调试
上传文件as_server 到测试服务器,需要执行以下两步运行:
root用户执行命令
1chmod +x as_server
2./as_server
执行运行后在10318端口启动http监听模拟服务。
1 产生随机数(本机IP必须为实际地址不能为127.0.0.1应用调用者应支持该IP可配置实际部署环境该IP为身份认证服务器的IP地址)
服务url: http://本机IP:10318/GeneratorChallenge
通过 发送 POST 请求获取响应结果中的随机数
2 验证票据(注意url与文档身份认证服务应用单点登录接口中保持一致)
服务url: http://本机IP:10318/VerifyIdentityTicket
发送POST 请求数据
<?xml version="1.0" encoding="UTF-8"?>
<verifyidentityticketreq version="1">
<challenge>服务端调用模拟接口产生的随机数</challenge>
<identityticket>终端浏览器websocet获取的票据xml tokeninfo元素内容</identityticket>
<appserverid>app server id支持可配置的一个参数</appserverid>
</verifyidentityticketreq>
返回模拟数据后解析获取rmsid用户标识与应用系统中保存的用户属性进行匹配查找出当前用户。
返回固定的模拟数据
<?xml version="1.0" encoding="UTF-8"?>
<verifyidentityticketresp version="1"> <result>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHZlcmlmeWlkZW50aXR5dGlja2V0cmVzdWx0IHZlcnNpb249IjEiPgoJPHJlc3VsdD4wPC9yZXN1bHQ+Cgk8Y2hhbGxlbmdlPlIxPC9jaGFsbGVuZ2U+Cgk8ZXJyb3I+PC9lcnJvcj4KCTx1c2VyaW5mbz4KCQk8cm1zaWQ+NTlhNTAwNWUtMzIwYy00ZDQzLThjODAtNWI1ZGJmN2FmMzc1PC9ybXNpZD4KCQk8bmFtZT48L25hbWU+CgkJPGNlcnQ+PC9jZXJ0PgoJCTxjZXJ0aW5mbz48L2NlcnRpbmZvPgoJCTxhZGRyZXNzPjwvYWRkcmVzcz4KCQk8YXBwYWNjb3VudD48L2FwcGFjY291bnQ+Cgk8L3VzZXJpbmZvPgoJPGFzaW5mbz4KCQk8bmFtZT48L25hbWU+CgkJPGNlcnQ+aXNzdWVyIGNlcnQ8L2NlcnQ+CgkJPGNlcnRpbmZvPjwvY2VydGluZm8+CgkJPGFkZHJlc3M+PC9hZGRyZXNzPgoJPC9hc2luZm8+Cgk8dGltZT4yMDE4LTAzLTA4IDA5OjQ1OjI4PC90aW1lPgoJPHNpZ25hdHVyZSBvaWQ9IjEuMi4xNTYuMTk3LjEuMTAwMC4xMSIgZGVzYz0iWFpNUyIvPgo8L3ZlcmlmeWlkZW50aXR5dGlja2V0cmVzdWx0Pg==</result>
<signature>dGlja2V0IHNpZ24gZGF0YQ==</signature>
</verifyidentityticketresp>
== 解析过程==
1先对响应数据进行签名验证该步可暂时跳过
验证过程:
signature 元素内容解base64编码后得到签名值的byte数组内容
result元素内容解base64编码后得到原文值的byte数组内容
调用CipherAPI提供的验签接口将签名值byte数组原文值byte数组AS服务的签名证书解析后的公钥值作为接口参数调用后判断是否验证成功。
验证成功后再进行下一步解析,验证失败提示用户登录失败,票据签名未验证通过。
2对result元素内容解base64得到原文数据另一个xml格式
<?xml version="1.0" encoding="UTF-8"?>
<verifyidentityticketresult version="1">
<result>0</result>
<challenge>R1</challenge>
<error></error>
<userinfo>
<rmsid>59a5005e-320c-4d43-8c80-5b5dbf7af375</rmsid>
<name></name>
<cert></cert>
<certinfo></certinfo>
<address></address>
<appaccount></appaccount>
</userinfo>
<asinfo>
<name></name>
<cert>issuer cert</cert>
<certinfo></certinfo>
<address></address>
</asinfo>
<time>2018-03-08 09:45:28</time>
<signature oid="1.2.156.197.1.1000.11" desc="XZMS"/>
</verifyidentityticketresult>
解析userinfo下的rmsid元素值,【59a5005e-320c-4d43-8c80-5b5dbf7af375】为用户同步模拟工具推送的【测试人员1】用户标识。
在判断该用户已经在应用系统中存在时,允许用户登录应用系统,完成单点登录。

@ -0,0 +1,70 @@
Copyright © 2006, 2011, Oracle and/or its affiliates.
All rights reserved.
This software and related documentation are provided under a
license agreement containing restrictions on use and
disclosure and are protected by intellectual property laws.
Except as expressly permitted in your license agreement or
allowed by law, you may not use, copy, reproduce, translate,
broadcast, modify, license, transmit, distribute, exhibit,
perform, publish, or display any part, in any form, or by
any means. Reverse engineering, disassembly, or
decompilation of this software, unless required by law for
interoperability, is prohibited.
The information contained herein is subject to change
without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related software documentation that
is delivered to the U.S. Government or anyone licensing it
on behalf of the U.S. Government, the following notice is
applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and
related documentation and technical data delivered to U.S.
Government customers are "commercial computer software" or
"commercial technical data" pursuant to the applicable
Federal Acquisition Regulation and agency-specific
supplemental regulations. As such, the use, duplication,
disclosure, modification, and adaptation shall be subject to
the restrictions and license terms set forth in the
applicable Government contract, and, to the extent
applicable by the terms of the Government contract, the
additional rights set forth in FAR 52.227-19, Commercial
Computer Software License (December 2007). Oracle America,
Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software or hardware is developed for general use in a
variety of information management applications. It is not
developed or intended for use in any inherently dangerous
applications, including applications which may create a risk
of personal injury. If you use this software or hardware in
dangerous applications, then you shall be responsible to
take all appropriate fail-safe, backup, redundancy, and
other measures to ensure its safe use. Oracle Corporation
and its affiliates disclaim any liability for any damages
caused by use of this software or hardware in dangerous
applications.
Oracle and Java are registered trademarks of Oracle and/or
its affiliates. Other names may be trademarks of their
respective owners.
AMD, Opteron, the AMD logo, and the AMD Opteron logo are
trademarks or registered trademarks of Advanced Micro
Devices. Intel and Intel Xeon are trademarks or registered
trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered
trademarks of SPARC International, Inc. UNIX is a
registered trademark licensed through X/Open Company, Ltd.
This software or hardware and documentation may provide
access to or information on content, products, and services
from third parties. Oracle Corporation and its affiliates
are not responsible for and expressly disclaim all
warranties of any kind with respect to third-party content,
products, and services. Oracle Corporation and its
affiliates will not be responsible for any loss, costs, or
damages incurred due to your access to or use of third-party
content, products, or services.

@ -0,0 +1,374 @@
README
Java(TM) Platform, Standard Edition
Runtime Environment
Version 6
The Java(TM) Platform, Standard Edition Runtime Environment (JRE(TM)),
excluding the JavaFX(TM) runtime, is intended for software developers
and vendors to redistribute with their applications.
The Java SE Runtime Environment contains the Java virtual machine,
runtime class libraries, and Java application launcher that are
necessary to run programs written in the Java programming language.
It is not a development environment and does not contain development
tools such as compilers or debuggers. For development tools, see the
Java SE Development Kit (JDK(TM)). The JRE installation triggers the
download of the JavaFX runtime. The JavaFX runtime is also available
separately, and is not part of the JRE. For information on JavaFX, and
how to make changes, go to: http://java.com/javafx
=======================================================================
Deploying Applications with the Java SE Runtime Environment
=======================================================================
When you deploy an application written in the Java programming
language, your software bundle will probably consist of the following
parts:
Your own class, resource, and data files.
The Java SE Runtime Environment.
An installation procedure or program.
You already have the first part, of course. The remainder of this
document covers the other two parts. See also the Notes for Developers
page on the Java Software website:
http://java.sun.com/javase/6/webnotes/runtime.html
-----------------------------------------------------------------------
Java Platform, Standard Edition Runtime Environment (JRE)
-----------------------------------------------------------------------
To run your application, a user needs the Java SE Runtime Environment,
which is freely available from Oracle. Or, you can redistribute the
Java SE Runtime Environment for free with your application, according
to the terms of the Java SE Platform Runtime Environment's license. The
JavaFX runtime is only required to run applications written in the
JavaFX scripting language; it is freely available from Oracle, and must
not be redistributed with your application.
The final step in the deployment process occurs when the software is
installed on an individual user's system. Installation consists of copying
software onto the user's system, then configuring the user's system
to support that software. You should ensure that your installation
procedure does not overwrite existing JRE installations, as they may
be required by other applications.
=======================================================================
Redistribution of the Java SE Runtime Environment (JRE)
=======================================================================
--------------------------------------------------------
NOTE - The license for this software does not allow the
redistribution of beta and other pre-release versions.
--------------------------------------------------------
Subject to the terms and conditions of the Software License
Agreement and the obligations, restrictions, and exceptions set
forth below, You may reproduce and distribute the Software (and
also portions of Software identified below as Redistributable),
provided that:
(a) you distribute the Software complete and unmodified and only
bundled as part of your applets and applications ("Programs"),
(b) your Programs add significant and primary functionality to the
Software,
(c) your Programs are only intended to run on Java-enabled general
purpose desktop computers and servers,
(d) you distribute Software for the sole purpose of running your
Programs,
(e) you do not distribute additional software intended to replace
any component(s) of the Software,
(f) you do not remove or alter any proprietary legends or notices
contained in or on the Software,
(g) you only distribute the Software subject to a license agreement
that protects Oracle's interests consistent with the terms
contained in this Agreement, and
(h) you agree to defend and indemnify Oracle and its licensors from
and against any damages, costs, liabilities, settlement amounts
and/or expenses (including attorneys' fees) incurred in
connection with any claim, lawsuit or action by any third party
that arises or results from the use or distribution of any and
all Programs and/or Software.
The term "vendors" used here refers to licensees, developers, and
independent software vendors (ISVs) who license and distribute the
Java SE Runtime Environment with their programs.
Vendors must follow the terms of the Java SE Runtime Environment Binary
Code License agreement.
-----------------------------------------------------------------------
Required vs. Optional Files
-----------------------------------------------------------------------
The files that make up the Java SE Runtime Environment are divided into
two categories: required and optional. Optional files may be excluded
from redistributions of the Java SE Runtime Environment at the
vendor's discretion.
The following section contains a list of the files and directories that
may optionally be omitted from redistributions with the Java SE Runtime
Environment. All files not in these lists of optional files must be
included in redistributions of the runtime environment.
-----------------------------------------------------------------------
Optional Files and Directories
-----------------------------------------------------------------------
The following files may be optionally excluded from redistributions.
These files are located in the jre1.6.0_<version> directory, where
<version> is the update version number. Solaris and Linux filenames
and separators are shown. Windows executables have the ".exe" suffix.
Corresponding files with _g in the name can also be excluded.
The corresponding man pages should be excluded for any excluded
executables (with paths listed below beginning with bin/ ,
for the Solaris(TM) Operating System and Linux).
lib/charsets.jar
Character conversion classes
lib/ext/
sunjce_provider.jar - the SunJCE provider for Java
Cryptography APIs
localedata.jar - contains many of the resources
needed for non US English locales
ldapsec.jar - contains security features supported
by the LDAP service provider
dnsns.jar - for the InetAddress wrapper of JNDI DNS provider
bin/rmid
Java RMI Activation System Daemon
bin/rmiregistry
Java Remote Object Registry
bin/tnameserv
Java IDL Name Server
bin/keytool
Key and Certificate Management Tool
bin/kinit
Used to obtain and cache Kerberos ticket-granting tickets
bin/klist
Kerberos display entries in credentials cache and keytab
bin/ktab
Kerberos key table manager
bin/policytool
Policy File Creation and Management Tool
bin/orbd
Object Request Broker Daemon
bin/servertool
Java IDL Server Tool
bin/javaws, lib/javaws/ and lib/javaws.jar
Java Web Start
When redistributing the JRE on Microsoft Windows as a private
application runtime (not accessible by other applications)
with a custom launcher, the following files are also
optional. These are libraries and executables that are used
for Java support in Internet Explorer and Mozilla family browsers;
these files are not needed in a private JRE redistribution.
bin\java.exe
bin\javaw.exe
bin\javaws.exe
bin\javacpl.exe
bin\jucheck.exe
bin\jusched.exe
bin\wsdetect.dll
bin\NPJPI*.dll (The filename changes in every release)
bin\NPJava11.dll
bin\NPJava12.dll
bin\NPJava13.dll
bin\NPJava14.dll
bin\NPJava32.dll
bin\NPOJI610.dll
bin\RegUtils.dll
bin\axbridge.dll
bin\deploy.dll
bin\jpicom.dll
bin\javacpl.cpl
bin\jpiexp.dll
bin\jpinscp.dll
bin\jpioji.dll
bin\jpishare.dll
lib\deploy.jar
lib\plugin.jar
lib\javaws.jar
lib\javaws\messages.properties
lib\javaws\messages_de.properties
lib\javaws\messages_es.properties
lib\javaws\messages_fr.properties
lib\javaws\messages_it.properties
lib\javaws\messages_ja.properties
lib\javaws\messages_ko.properties
lib\javaws\messages_sv.properties
lib\javaws\messages_zh_CN.properties
lib\javaws\messages_zh_HK.properties
lib\javaws\messages_zh_TW.properties
lib\javaws\miniSplash.jpg
-----------------------------------------------------------------------
Redistributable JDK(TM) Files
-----------------------------------------------------------------------
The limited set of files from the Java SE Development Kit (JDK)
listed below may be included in vendor redistributions of the Java SE
Runtime Environment. All paths are relative to the top-level
directory of the JDK. The corresponding man pages should be included for
any included executables (with paths listed below beginning with bin/ ,
for the Solaris(TM) Operating System and Linux).
jre/lib/cmm/PYCC.pf
Color profile. This file is required only if one wishes to
convert between the PYCC color space and another color space.
All .ttf font files in the jre/lib/fonts directory.
Note that the LucidaSansRegular.ttf font is already contained
in the Java SE Runtime Environment, so there is no need to
bring that file over from the JDK.
jre/lib/audio/soundbank.gm
This MIDI soundbank is present in the JDK, but it has
been removed from the Java SE Runtime Environment in order to
reduce the size of the Runtime Environment's download bundle.
However, a soundbank file is necessary for MIDI playback, and
therefore the JDK's soundbank.gm file may be included in
redistributions of the Runtime Environment at the vendor's
discretion. Several versions of enhanced MIDI soundbanks are
available from the Java Sound web site:
http://java.sun.com/products/java-media/sound/
These alternative soundbanks may be included in redistributions
of the Java SE Runtime Environment.
The javac bytecode compiler, consisting of the following files:
bin/javac [Solaris(TM) Operating System
and Linux]
bin/sparcv9/javac [Solaris Operating System
(SPARC(R) Platform Edition)]
bin/amd64/javac [Solaris Operating System (AMD)]
bin/javac.exe [Microsoft Windows]
lib/tools.jar [All platforms]
The Annotation Processing Tool, consisting of the following files:
lib/tools.jar [All platforms]
bin/apt [Solaris(TM) Operating System
and Linux]
bin/sparcv9/apt [Solaris Operating System
(SPARC(R) Platform Edition)]
bin/amd64/apt [Solaris Operating System (AMD)]
bin/apt.exe [Microsoft Windows]
lib/jconsole.jar
The Jconsole application. NOTE: The Jconsole application requires
the dynamic attach mechanism.
The dynamic attach mechanism consisting of the following files:
lib/tools.jar [All platforms]
jre/lib/sparc/libattach.so
[Solaris(TM) Operating System (SPARC(R) Platform Edition) and Linux]
jre/lib/sparcv9/libattach.so
[Solaris(TM) Operating System (SPARC(R) Platform Edition) and Linux]
jre/lib/i386/libattach.so
[Solaris(TM) Operating System (x86) and Linux]
jre/lib/amd64/libattach.so
[Solaris(TM) Operating System (AMD) and Linux]
jre\bin\attach.dll [Microsoft Windows]
The Java Platform Debugger Architecture implementation consisting of the
files shown in the dynamic attach section above, and the following files:
lib/tools.jar [All platforms]
lib/sa-jdi.jar [All platforms]
jre/lib/sparc/libsaproc.so
[Solaris(TM) Operating System (SPARC(R) Platform Edition) and Linux]
jre/lib/sparcv9/libsaproc.so
[Solaris(TM) Operating System (SPARC(R) Platform Edition) and Linux]
jre/lib/i386/libsaproc.so
[Solaris(TM) Operating System (x86) and Linux]
jre/lib/amd64/libsaproc.so
[Solaris(TM) Operating System (AMD) and Linux]
jre\bin\server\
On Microsoft Windows platforms, the JDK includes both
the Java HotSpot(TM) Server VM and Java HotSpot Client VM.
However, the Java SE Runtime Environment for Microsoft Windows
platforms includes only the Java HotSpot Client VM. Those wishing
to use the Java HotSpot Server VM with the Java SE Runtime
Environment may copy the JDK's jre\bin\server folder to a
bin\server directory in the Java SE Runtime Environment. Software
vendors may redistribute the Java HotSpot Server VM with their
redistributions of the Java SE Runtime Environment.
-----------------------------------------------------------------------
Unlimited Strength Java Cryptography Extension
-----------------------------------------------------------------------
Due to import control restrictions for some countries, the Java
Cryptography Extension (JCE) policy files shipped with the Java SE
Development Kit and the Java SE Runtime Environment allow strong but
limited cryptography to be used. These files are located at
<java-home>/lib/security/local_policy.jar
<java-home>/lib/security/US_export_policy.jar
where <java-home> is the jre directory of the JDK or the
top-level directory of the Java SE Runtime Environment.
An unlimited strength version of these files indicating no restrictions
on cryptographic strengths is available on the JDK web site for
those living in eligible countries. Those living in eligible countries
may download the unlimited strength version and replace the strong
cryptography jar files with the unlimited strength files.
-----------------------------------------------------------------------
The cacerts Certificates File
-----------------------------------------------------------------------
Root CA certificates may be added to or removed from the Java SE
certificate file located at
<java-home>/lib/security/cacerts
For more information, see The cacerts Certificates File section
in the keytool documentation at:
http://java.sun.com/javase/6/docs/tooldocs/solaris/keytool.html#cacerts
=======================================================================
Endorsed Standards Override Mechanism
=======================================================================
From time to time it is necessary to update the Java platform in order
to incorporate newer versions of standards that are created outside of
the Java Community Process(SM) (JCP(SM) http://www.jcp.org/) (Endorsed
Standards), or in order to update the version of a technology included
in the platform to correspond to a later standalone version of that
technology (Standalone Technologies).
The Endorsed Standards Override Mechanism provides a means whereby
later versions of classes and interfaces that implement Endorsed
Standards or Standalone Technologies may be incorporated into the Java
Platform.
For more information on the Endorsed Standards Override Mechanism,
including the list of platform packages that it may be used to
override, see
http://java.sun.com/javase/6/docs/technotes/guides/standards/
-----------------------------------------------------------------------
The Java(TM) Runtime Environment (JRE) and the JavaFX(TM) runtime are
products of Oracle.
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.

@ -0,0 +1,26 @@
<html>
<head>
<title>
Welcome to the Java(TM) Platform
</title>
</head>
<body>
<h2>Welcome to the Java<SUP><FONT SIZE=-2>TM</FONT></SUP> Platform</h2>
<p> Welcome to the Java<SUP><FONT SIZE=-2>TM</FONT></SUP> Standard Edition Runtime
Environment. This provides complete runtime support for Java applications.
<p> The runtime environment includes the Java<SUP><FONT SIZE=-2>TM</FONT></SUP>
Plug-in product which supports the Java environment inside web browsers.
<h3>References</h3>
<p>
See the <a href=http://java.sun.com/javase/6/docs/technotes/guides/plugin/index.html>Java Plug-in</a> product
documentation for more information on using the Java Plug-in product.
<p> See the <a href=http://java.sun.com/javase>Java Platform</a> web site for
more information on the Java Platform.
<hr>
<font size="-2">
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
</font>
<p>
</body>
</html>

@ -0,0 +1,24 @@
-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xfuture enable strictest checks, anticipating future default
-Xrs reduce use of OS signals by Java/VM (see documentation)
-Xcheck:jni perform additional checks for JNI functions
-Xshare:off do not attempt to use shared class data
-Xshare:auto use shared class data if possible (default)
-Xshare:on require using shared class data, otherwise fail.
The -X options are non-standard and subject to change without notice.

@ -0,0 +1,24 @@
-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xfuture enable strictest checks, anticipating future default
-Xrs reduce use of OS signals by Java/VM (see documentation)
-Xcheck:jni perform additional checks for JNI functions
-Xshare:off do not attempt to use shared class data
-Xshare:auto use shared class data if possible (default)
-Xshare:on require using shared class data, otherwise fail.
The -X options are non-standard and subject to change without notice.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save