0
BayeuxServer.SessionListener 콜백 함수에서 ServletContext에 액세스 할 수 있습니까? ServletContext의 속성으로 사용할 수있게 해주는 객체가 있습니다. 나는 그것을 싱글 톤으로 만들 수 있었지만 궁금해하고 있었다.BayeuxServer.SessionListener 내부에서 ServletContext에 어떻게 액세스 할 수 있습니까?
BayeuxServer.SessionListener 콜백 함수에서 ServletContext에 액세스 할 수 있습니까? ServletContext의 속성으로 사용할 수있게 해주는 객체가 있습니다. 나는 그것을 싱글 톤으로 만들 수 있었지만 궁금해하고 있었다.BayeuxServer.SessionListener 내부에서 ServletContext에 어떻게 액세스 할 수 있습니까?
는 사용자가 직접 ServletContext
에 액세스 할 수 없습니다,하지만 당신은이 방법으로 그 속성에 액세스 할 수 있습니다
BayeuxServer bayeuxServer = ...;
BayeuxContext bayeuxContext = bayeuxServer.getContext();
Object attributeValue = bayeuxContext.getContextAttribute(attributeName);
죄송 조밀 될,하지만 난 BayeuxServer 어떻게 얻을 것인가? – garey
신경 쓰지 마세요. 발견 (session.getBayeuxServer()) – garey