• 大小: 1.15MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-12
  • 语言: 其他
  • 标签: websocket  1V1聊天室  

资源简介

博客:https://blog.csdn.net/woailol930910/article/details/79914568 websocket 1V1聊天 功能齐全:用户上下线、离线消息等

资源截图

代码片段和文件信息

package com.use.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.use.model.UserInfo;
import com.use.service.UserService;
import com.websocket.WebSocket;

@RestController
@RequestMapping(“/user“)
public class UserController {

@Autowired
private UserService userService;
public WebSocket getWebSocket() {
return webSocket;
}

public void setWebSocket(WebSocket webSocket) {
this.webSocket = webSocket;
}

private WebSocket webSocket;

@ResponseBody
@RequestMapping(value = “/selectList“ method = RequestMethod.GET)
public List selectList(Model model) {
Mapject> paramMap = new HashMapject>();
List users = userService.selectList(paramMap);
model.addAttribute(“users“ users);
return users;
}

@RequestMapping(value = “/add“ method = RequestMethod.GET)
public String add(Model model String userName HttpServletRequest request) {
HttpSession httpSession = request.getSession();
httpSession.setAttribute(“userName“ userName);
return userName;
}

@RequestMapping(value = “/getLoginUserName“ method = RequestMethod.GET)
public String getLoginUserName(Model model HttpServletRequest request) {
HttpSession httpSession = request.getSession();
String userName = httpSession.getAttribute(“userName“).toString();
return userName;
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-09 10:11  redisIntroduce\
     文件        1094  2018-04-09 10:11  redisIntroduce\.classpath
     目录           0  2018-04-02 17:20  redisIntroduce\.idea\
     目录           0  2018-04-02 17:20  redisIntroduce\.idea\artifacts\
     文件         308  2017-11-01 16:48  redisIntroduce\.idea\artifacts\redisIntroduce_war.xml
     文件        3836  2017-11-02 13:54  redisIntroduce\.idea\artifacts\redisIntroduce_war_exploded.xml
     文件         640  2017-11-01 14:33  redisIntroduce\.idea\compiler.xml
     文件         200  2017-11-01 14:32  redisIntroduce\.idea\encodings.xml
     目录           0  2018-04-12 15:25  redisIntroduce\.idea\inspectionProfiles\
     目录           0  2018-04-02 17:20  redisIntroduce\.idea\libraries\
     文件         514  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__aopalliance_aopalliance_1_0.xml
     文件         493  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__com_alibaba_druid_1_0_18.xml
     文件         644  2017-11-02 13:54  redisIntroduce\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml
     文件         595  2017-11-02 13:54  redisIntroduce\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_core_2_5_4.xml
     文件         623  2017-11-02 13:54  redisIntroduce\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_databind_2_5_4.xml
     文件         511  2017-11-02 13:54  redisIntroduce\.idea\libraries\Maven__com_redisUse_redisUse_0_0_1.xml
     文件         558  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__commons_logging_commons_logging_1_2.xml
     文件         462  2017-11-01 16:48  redisIntroduce\.idea\libraries\Maven__junit_junit_3_8_1.xml
     文件         469  2017-11-01 17:54  redisIntroduce\.idea\libraries\Maven__log4j_log4j_1_2_14.xml
     文件         574  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__mysql_mysql_connector_java_5_1_38.xml
     文件         514  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_aspectj_aspectjrt_1_8_7.xml
     文件         500  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_mybatis_mybatis_3_3_1.xml
     文件         549  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_mybatis_mybatis_spring_1_2_4.xml
     文件         548  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_slf4j_jcl_over_slf4j_1_7_13.xml
     文件         513  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_slf4j_slf4j_api_1_7_13.xml
     文件         534  2017-11-01 17:54  redisIntroduce\.idea\libraries\Maven__org_slf4j_slf4j_log4j12_1_7_5.xml
     文件         699  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_springframework_data_spring_data_commons_1_11_4_RELEASE.xml
     文件         664  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_springframework_data_spring_data_jpa_1_9_4_RELEASE.xml
     文件         609  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_springframework_spring_aop_4_2_5_RELEASE.xml
     文件         623  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_springframework_spring_beans_4_2_5_RELEASE.xml
     文件         637  2017-11-01 17:01  redisIntroduce\.idea\libraries\Maven__org_springframework_spring_context_4_2_5_RELEASE.xml
............此处省略457个文件信息

评论

共有 条评论