Ошибка при вызове объекта сеанса внутри метода, оформленного аннотациями Springsoso

Используя плагин Grails spring-websocket:

CurrentStatusController.groovy

@MessageMapping("/personExist")
@SendTo("/topic/personExist")
protected Boolean personExist(String personId) {    
    return (Person.get(personId)!=null)
}

Сохранение всех идентификаторов лиц в session список personIdsзатем обработайте тот же метод, используя объект сеанса

CurrentStatusController.groovy

@MessageMapping("/personExist")
@SendTo("/topic/personExist")
protected Boolean personExist(String personId) {
    return (session.personIds.contains(personId))
}

Первый работает, последний не работает со следующим сообщением об ошибке:

ERROR springwebsocket.GrailsSimpAnnotationMethodMessageHandler  -
Unhandled exception Message: No thread-bound request found: Are you
referring to request attributes outside of an actual web request, or
processing a request outside of the originally receiving thread? If
you are actually operating within a web request and still receive this
message, your code is probably running outside of
DispatcherServlet/DispatcherPortlet: In this case, use
RequestContextListener or RequestContextFilter to expose the current
request.
    Line | Method
->>   53 | getSession in org.grails.plugins.web.rest.api.ControllersRestApi

Как заставить методы Spring-WebSocket принимать сессионный объект?

0 ответов

Другие вопросы по тегам