我需要在Socket关闭连接时,移除对应的HttpSession,请问如何在socket里手动获取对应当前请求的HttpSession?
17 回复
刚才试了一下,但是取不到,断点看了是null
/**
* 连接打开时的回调
* @param session
*/
public void onOpen(Session session, EndpointConfig config) {
HttpSession sess = Mvcs.getHttpSession();
}
是tomcat,我这些日志包含了从登陆到socket连接
2017-05-08 11:48:17,138 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/user/login : UserModule.login(UserModule.java:54)
2017-05-08 11:48:17,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userModule'<class com.mychat.controol.UserModule>
2017-05-08 11:48:17,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get '$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2017-05-08 11:48:17,143 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=$aop_async
2017-05-08 11:48:17,146 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject($aop_async) in AsyncAopIocLoader@1384825733
2017-05-08 11:48:17,147 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2017-05-08 11:48:17,149 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object '$aop_async' to [app]
2017-05-08 11:48:17,163 org.nutz.ioc.aop.SimpleAopMaker.<init>(SimpleAopMaker.java:79) DEBUG - Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
2017-05-08 11:48:17,164 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=userModule
2017-05-08 11:48:17,164 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(userModule) in AnnotationIocLoader(packages=[com.mychat])
2017-05-08 11:48:17,165 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'userModule'<class com.mychat.controol.UserModule>
2017-05-08 11:48:17,167 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class com.mychat.controol.UserModule without AOP
2017-05-08 11:48:17,167 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'userModule' to [app]
2017-05-08 11:48:17,172 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userDao'<>
2017-05-08 11:48:17,173 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=userDao
2017-05-08 11:48:17,173 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(userDao) in AnnotationIocLoader(packages=[com.mychat])
2017-05-08 11:48:17,173 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'userDao'<>
2017-05-08 11:48:17,174 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class com.mychat.dao.UserDaoImpl without AOP
2017-05-08 11:48:17,175 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'userDao' to [app]
2017-05-08 11:48:17,175 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2017-05-08 11:48:17,175 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=dao
2017-05-08 11:48:17,175 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dao
2017-05-08 11:48:17,185 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(dao) in JsonLoader(paths=[ioc/])
2017-05-08 11:48:17,186 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'dao'<interface org.nutz.dao.Dao>
2017-05-08 11:48:17,219 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.nutz.dao.impl.NutDao without AOP
2017-05-08 11:48:17,220 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'dao' to [app]
2017-05-08 11:48:17,220 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dataSource'<>
2017-05-08 11:48:17,220 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=dataSource
2017-05-08 11:48:17,220 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dataSource
2017-05-08 11:48:17,235 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2017-05-08 11:48:17,235 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'dataSource'<>
2017-05-08 11:48:17,281 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class com.alibaba.druid.pool.DruidDataSource without AOP
2017-05-08 11:48:17,282 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'dataSource' to [app]
2017-05-08 11:48:17,284 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-05-08 11:48:17,284 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=conf
2017-05-08 11:48:17,284 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=conf
2017-05-08 11:48:17,285 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2017-05-08 11:48:17,286 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'conf'<>
2017-05-08 11:48:17,287 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2017-05-08 11:48:17,287 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'conf' to [app]
2017-05-08 11:48:17,294 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 1 resource by src( custom/ ) , regex( ^.+[.]properties$ )
2017-05-08 11:48:17,448 com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:715) INFO - {dataSource-1} inited
2017-05-08 11:48:17,452 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dataSource'<>
2017-05-08 11:48:17,508 org.nutz.filepool.NutFilePool.<init>(NutFilePool.java:23) INFO - Init file-pool by: C:\Users\Administrator/.nutz/tmp/dao/ [200000]
2017-05-08 11:48:17,509 org.nutz.filepool.NutFilePool.<init>(NutFilePool.java:37) DEBUG - file-pool.home: 'C:\Users\Administrator\.nutz\tmp\dao'
2017-05-08 11:48:17,510 org.nutz.filepool.NutFilePool.<init>(NutFilePool.java:66) INFO - file-pool.cursor: 0
2017-05-08 11:48:17,529 org.nutz.dao.jdbc.Jdbcs.<clinit>(Jdbcs.java:90) DEBUG - Jdbcs init complete
2017-05-08 11:48:17,529 org.nutz.dao.jdbc.Jdbcs.getExpert(Jdbcs.java:103) INFO - Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2017-05-08 11:48:17,892 org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:188) DEBUG - select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert
2017-05-08 11:48:17,904 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:199) DEBUG - JDBC Driver --> mysql-connector-java-5.1.39 ( Revision: 3289a357af6d09ecc1a10fd3c26e95183e5790ad )
2017-05-08 11:48:17,904 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:200) DEBUG - JDBC Name --> MySQL Connector Java
2017-05-08 11:48:17,904 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:202) DEBUG - JDBC URL --> jdbc:mysql://127.0.0.1:3306/mychat
2017-05-08 11:48:18,067 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_client=utf8
2017-05-08 11:48:18,068 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_connection=utf8
2017-05-08 11:48:18,068 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_database=utf8
2017-05-08 11:48:18,069 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_filesystem=binary
2017-05-08 11:48:18,069 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_results=
2017-05-08 11:48:18,069 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_server=utf8
2017-05-08 11:48:18,069 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_system=utf8
2017-05-08 11:48:18,069 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_sets_dir=C:\Program Files (x86)\MySQL\MySQL Server 5.1\share\charsets\
2017-05-08 11:48:18,072 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:219) DEBUG - Mysql : binlog_format=STATEMENT
2017-05-08 11:48:18,073 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:226) DEBUG - Mysql : database=mychat
2017-05-08 11:48:18,074 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:232) DEBUG - Mysql : user=root@localhost
2017-05-08 11:48:18,140 org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:221) DEBUG - Database info --> MYSQL:[MySQL - 5.1.49-community]
2017-05-08 11:48:18,146 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2017-05-08 11:48:18,146 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'chatMessageDao'<interface com.mychat.dao.ChatMessageDao>
2017-05-08 11:48:18,146 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=chatMessageDao
2017-05-08 11:48:18,147 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(chatMessageDao) in AnnotationIocLoader(packages=[com.mychat])
2017-05-08 11:48:18,147 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'chatMessageDao'<interface com.mychat.dao.ChatMessageDao>
2017-05-08 11:48:18,147 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class com.mychat.dao.ChatMessageDaoImpl without AOP
2017-05-08 11:48:18,147 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'chatMessageDao' to [app]
2017-05-08 11:48:18,148 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2017-05-08 11:48:18,309 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE username=? AND pwd=? LIMIT 0, 1
| 1 | 2 |
|-------|-----|
| huage | 123 |
For example:> "SELECT * FROM user WHERE username='huage' AND pwd='123' LIMIT 0, 1 "
2017-05-08 11:48:18,326 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - UPDATE user SET status=? WHERE id=?
| 1 | 2 |
|--------|---|
| online | 1 |
For example:> "UPDATE user SET status='online' WHERE id=1"
2017-05-08 11:48:18,359 com.mychat.mvc.LogTimeProcessor.process(LogTimeProcessor.java:29) DEBUG - [ GET]URI=/mychat/user/login 1220ms
2017-05-08 11:48:19,516 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:110) DEBUG - Search mapping for [GET] path=/chat2 : NOT Action match
2017-05-08 11:48:19,518 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/user/getInitData : UserModule.getInitData(UserModule.java:119)
2017-05-08 11:48:19,519 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userModule'<class com.mychat.controol.UserModule>
2017-05-08 11:48:19,523 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 1 |
For example:> "SELECT * FROM user WHERE id=1 LIMIT 0, 1 "
2017-05-08 11:48:19,534 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM `group` WHERE user_id IN (1)
2017-05-08 11:48:19,541 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'nutSocket'<class com.mychat.socket.NutSocket>
2017-05-08 11:48:19,541 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - >> Load definition name=nutSocket
2017-05-08 11:48:19,541 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(nutSocket) in AnnotationIocLoader(packages=[com.mychat])
2017-05-08 11:48:19,541 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - >> Make...'nutSocket'<class com.mychat.socket.NutSocket>
2017-05-08 11:48:19,541 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class com.mychat.socket.NutSocket without AOP
2017-05-08 11:48:19,541 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'nutSocket' to [app]
2017-05-08 11:48:19,543 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM friends WHERE groupId=? AND me=?
| 1 | 2 |
|---|---|
| 1 | 1 |
For example:> "SELECT * FROM friends WHERE groupId=1 AND me=1"
2017-05-08 11:48:19,546 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 2 |
For example:> "SELECT * FROM user WHERE id=2 LIMIT 0, 1 "
2017-05-08 11:48:19,546 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userDao'<interface com.mychat.dao.UserDao>
2017-05-08 11:48:19,547 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'chatMessageDao'<interface com.mychat.dao.ChatMessageDao>
2017-05-08 11:48:19,549 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM friends WHERE groupId=? AND me=?
| 1 | 2 |
|---|---|
| 2 | 1 |
For example:> "SELECT * FROM friends WHERE groupId=2 AND me=1"
2017-05-08 11:48:19,552 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 3 |
For example:> "SELECT * FROM user WHERE id=3 LIMIT 0, 1 "
2017-05-08 11:48:19,555 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 7 |
For example:> "SELECT * FROM user WHERE id=7 LIMIT 0, 1 "
2017-05-08 11:48:19,559 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 9 |
For example:> "SELECT * FROM user WHERE id=9 LIMIT 0, 1 "
2017-05-08 11:48:19,566 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM flockrefuser WHERE uid=?
| 1 |
|---|
| 1 |
For example:> "SELECT * FROM flockrefuser WHERE uid=1"
2017-05-08 11:48:19,571 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM flock WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 1 |
For example:> "SELECT * FROM flock WHERE id=1 LIMIT 0, 1 "
{
"code": 0,
"msg": "",
"data": {
"mine": {
"id": 1,
"username": "huage",
"pwd": "123",
"sign": "志在天涯,梦在亲人;心随宁静,随遇而安。",
"avatar": "/mychat/imgs/3.jpg",
"status": "online"
},
"friend": [{
"id": 1,
"user_id": 1,
"groupname": "家人",
"list": [{
"id": 2,
"username": "陆离",
"pwd": "123",
"sign": "this is luli~",
"avatar": "/mychat/imgs/1.jpg",
"status": "hide"
}]
}, {
"id": 2,
"user_id": 1,
"groupname": "朋友",
"list": [{
"id": 3,
"username": "姜源",
"pwd": "123",
"sign": "姜源二货!",
"avatar": "/mychat/imgs/4.jpg",
"status": "hide"
}, {
"id": 7,
"username": "321",
"pwd": "321",
"sign": "hahaha",
"avatar": "/mychat/imgs/user.png",
"status": "hide"
}, {
"id": 9,
"username": "2",
"pwd": "2",
"sign": "qqqqq",
"avatar": "/mychat/imgs/user.png",
"status": "hide"
}]
}],
"group": [{
"id": 1,
"groupname": "激情的java",
"avatar": "/mychat/imgs/java.jpg"
}]
}
}
2017-05-08 11:48:19,580 com.mychat.mvc.LogTimeProcessor.process(LogTimeProcessor.java:29) DEBUG - [ GET]URI=/mychat/user/getInitData 60ms
2017-05-08 11:48:19,655 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/user/unreadMsgCount : UserModule.unreadMsgCount(UserModule.java:132)
2017-05-08 11:48:19,655 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userModule'<class com.mychat.controol.UserModule>
2017-05-08 11:48:19,666 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM message WHERE uid=? ORDER BY `time` DESC
| 1 |
|---|
| 1 |
For example:> "SELECT * FROM message WHERE uid=1 ORDER BY `time` DESC "
2017-05-08 11:48:19,675 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 2 |
For example:> "SELECT * FROM user WHERE id=2 LIMIT 0, 1 "
2017-05-08 11:48:19,678 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 2 |
For example:> "SELECT * FROM user WHERE id=2 LIMIT 0, 1 "
2017-05-08 11:48:19,681 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 2 |
For example:> "SELECT * FROM user WHERE id=2 LIMIT 0, 1 "
2017-05-08 11:48:19,684 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 9 |
For example:> "SELECT * FROM user WHERE id=9 LIMIT 0, 1 "
2017-05-08 11:48:19,686 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM user WHERE id=? LIMIT 0, 1
| 1 |
|---|
| 7 |
For example:> "SELECT * FROM user WHERE id=7 LIMIT 0, 1 "
2017-05-08 11:48:19,690 com.mychat.mvc.LogTimeProcessor.process(LogTimeProcessor.java:29) DEBUG - [ GET]URI=/mychat/user/unreadMsgCount 35ms
因为我需要在socket里使用nutz提供的ioc,所以得这么干
@ServerEndpoint(value = "/chat2", configurator=NutWsConfigurator.class)
但又得获取HttpSession,configurator里面应该怎么写...
继承改之矣,却无果, Mvcs.getHttpSession(true);依然为Null
public class GetHttpSessionConfigurator extends NutWsConfigurator {
@Override
public void modifyHandshake(ServerEndpointConfig sec,
HandshakeRequest request, HandshakeResponse response) {
// TODO Auto-generated method stub
HttpSession httpSession=(HttpSession) request.getHttpSession();
sec.getUserProperties().put(HttpSession.class.getName(),httpSession);
}
}
添加回复
请先登陆