diff --git a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplateuse/CardTemplateUseAppController.java b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplateuse/CardTemplateUseAppController.java index affca37..f96c118 100644 --- a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplateuse/CardTemplateUseAppController.java +++ b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplateuse/CardTemplateUseAppController.java @@ -158,6 +158,8 @@ public class CardTemplateUseAppController extends DefaultBaseController { try { String userId = securityComponent.getAppTokenUser(token).getId(); params.put("userId", userId); + if(1 == 1) + throw new SearchException("测试"); }catch(Exception e) { throw new SearchException("没有登陆信息"); } @@ -181,6 +183,8 @@ public class CardTemplateUseAppController extends DefaultBaseController { try { String userId = securityComponent.getAppTokenUser(token).getId(); params.put("userId", userId); + if(1 == 1) + throw new SearchException("测试"); }catch(Exception e) { throw new SearchException("没有登陆信息"); } diff --git a/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleController.java b/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleController.java index 3c7867c..cdcb1c8 100644 --- a/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleController.java +++ b/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleController.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.controller.route.cardconsole; +import cn.com.tenlion.projectconfig.util.ProjectConfigUtil; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.interfaces.consts.ISystemConstant; import ink.wgink.properties.ServerProperties; @@ -28,9 +29,7 @@ public class CardConsoleController extends DefaultBaseController { @GetMapping("console") public ModelAndView save() { ModelAndView mv = new ModelAndView("cardconsole/console"); - String serverUrl = systemProperties.getUrl(); - String wsUrl = serverUrl.replaceAll("https:", "ws:/").replaceAll("http:", "ws:/"); - mv.addObject("serverUrl", wsUrl); + mv.addObject("webSocketConsole", ProjectConfigUtil.getText("webSocketConsole")); return mv; } diff --git a/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java b/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java index 93b8722..7e3bd34 100644 --- a/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java +++ b/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java @@ -8,8 +8,9 @@ import ink.wgink.util.ReflectUtil; import ink.wgink.util.date.DateUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.*; import javax.servlet.annotation.WebFilter; diff --git a/src/main/java/cn/com/tenlion/systemcard/socket/CardLogSocket.java b/src/main/java/cn/com/tenlion/systemcard/socket/CardLogSocket.java index bd1adfd..438c266 100644 --- a/src/main/java/cn/com/tenlion/systemcard/socket/CardLogSocket.java +++ b/src/main/java/cn/com/tenlion/systemcard/socket/CardLogSocket.java @@ -24,6 +24,8 @@ public class CardLogSocket { public static String selectUser = ""; + public static Boolean exceptionDescription = false; + @OnOpen public void onOpen(Session session) { System.out.println("链接成功......"); @@ -60,18 +62,24 @@ public class CardLogSocket { if(message.contains("selectUser")) { selectUser = message.split("=")[1]; } + if(message.contains("exceptionDescription")) { + exceptionDescription = Boolean.parseBoolean(message.split("=")[1]); + } } /** * 群发消息 * @param message 消息内容 */ - public synchronized void sendAll(String message) throws IOException { + public synchronized void sendAll(String message) { for (Map.Entry sessionEntry : SESSIONS.entrySet()) { synchronized(sessionEntry) { Session session = sessionEntry.getValue(); if(session.isOpen()) { - session.getBasicRemote().sendText(message); + try { + session.getBasicRemote().sendText(message); + } catch (IOException e) { + } } } } diff --git a/src/main/resources/templates/cardconsole/console.html b/src/main/resources/templates/cardconsole/console.html index 01fd16c..136916d 100644 --- a/src/main/resources/templates/cardconsole/console.html +++ b/src/main/resources/templates/cardconsole/console.html @@ -11,7 +11,7 @@ @@ -53,6 +53,8 @@ 内容查询 内容替换 指定行跳转 + + 选中文字内容 CTRL + K【下一个】 | ALT + SHIF + K【上一个】 @@ -101,6 +103,12 @@ consoleLog = "控制台连接成功...\r\n\r\n"; setCodeTxt(consoleLog); }); + + $(document).on('click','#exceptionDescription',function(){ + var exceptionDescription = $(this).is(':checked'); + socket.send("exceptionDescription=" + exceptionDescription); + }); + var stopStatus = false; $(document).on('click','#stop',function(){ if(stopStatus) { @@ -118,7 +126,7 @@ }else{ console.log("您的浏览器支持WebSocket"); //实现化WebSocket对象,指定要连接的服务器地址与端口 建立连接 - socket = new WebSocket("[[${serverUrl}]]/cardlogsocket"); + socket = new WebSocket("[[${webSocketConsole}]]"); //打开事件 socket.onopen = function() { console.log("Socket 已打开"); @@ -339,7 +347,7 @@ enableLiveAutocompletion: true }); editor.setTheme("ace/theme/monokai"); - editor.getSession().setMode("ace/mode/php"); + editor.getSession().setMode("ace/mode/java"); editor.setOptions ({ enableBasicAutocompletion: true,//