{"id":220233,"date":"2014-04-23T10:56:03","date_gmt":"2014-04-23T06:56:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=220233"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=220233","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Custom Scope \u0432 JEE \u0438 Spring<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\tScope \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, java-\u0431\u0438\u043d (\u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0438\u043d) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0432 RequestScope \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 http \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0412 JEE \u0438 \u0432 Spring \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 scope. \u0422.\u0435. \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u2014 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443 \u043b\u0438\u0431\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0438 \u0442\u0430\u043a\u0436\u0435 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0442\u044c\u0441\u044f. \u0412 JEE \u0437\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f CDI (Context and Dependency Injection) \u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043c \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 scope. \u042d\u0442\u043e ConversationScope. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c API \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f conversation. \u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u0442\u043e \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e ConversationScope \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a RequestScope. \u0414\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f conversation \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 conversationId, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 http \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0410 \u0432 Spring \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e. \u041d\u043e \u0432 \u043c\u043e\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422.\u0435. \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438) \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0442\u0430\u043a\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 conversation scope \u0434\u043b\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u041c\u0430\u0440, \u0433\u0434\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448 \u0430\u043d\u0430\u043b\u043e\u0433 conversationId, \u0430 \u041c\u0430\u0440 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 ServleContext \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432\u0441\u0451 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041d\u043e \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u043d\u0430\u043c \u043d\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 conversationId. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0432\u043e\u0439 scope, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SOAP \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c. \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u043c\u0443-\u043b\u0438\u0431\u043e scope, \u043d\u043e \u043d\u0430\u0448 \u0431\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u0432 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u043c\u0443 scope. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 CustomScope \u0434\u043b\u044f Spring \u0438 JEE \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u043a\u0442\u0438\u0432\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0448 scope \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 sessionId (\u0430\u043d\u0430\u043b\u043e\u0433 conversationId). \u0417\u0430\u0442\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0430\u043d\u043d\u044b\u0439 id \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c scope. \u041f\u043e\u0442\u043e\u043c \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043a\u0440\u043e\u0435\u043c scope. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f:  <\/p>\n<ul>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0438\u043d\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e scope.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f SOAP Handler, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 sessionId \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 scope \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 scope<\/li>\n<\/ul>\n<p>.<br \/>  \u0412 Spring \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Apache CXF, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u043e\u0442 JEE.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 scope.<\/h4>\n<p>  \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438\/\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f\/\u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0431\u0438\u043d\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e scope. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0435\u0441\u0441\u0438\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043a\u043e\u043f\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c id, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 ThreadLocal \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0447\u0438\u0442\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 id \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0431\u0438\u043d\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 Map. \u0422.\u0435. \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 sessionId \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0431\u0438\u043d\u043e\u0432. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0441\u0435\u0441\u0441\u0438\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e. \u041f\u043e\u043c\u0438\u043c\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u043a\u0430\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0432 JEE \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>javax.enterprise.context.spi.Context<\/code>, \u0432 Spring \u2014 <code>org.springframework.beans.factory.config.Scope<\/code>. \u042d\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043f\u043e\u0445\u043e\u0436\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438. \u0414\u043b\u044f JEE \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 WsContext, \u0434\u043b\u044f Spring \u2014 WsScope. \u041e\u043d\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:  <\/p>\n<h5>\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u043d\u043e\u0432 \u0441\u0435\u0441\u0441\u0438\u0438<\/h5>\n<p>  <\/p>\n<h6>\u0432 JEE:<\/h6>\n<p>  <\/p>\n<pre><code class=\"java\">private static class InstanceInfo&lt;T&gt; {     public CreationalContext&lt;T&gt; ctx;     public T instance; }      private Map&lt;String, Map&lt;Contextual, InstanceInfo&gt;&gt; instances =      new HashMap&lt;SessionId,  Map&lt;Contextual, InstanceInfo&gt;&gt;(); <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c <code>instances<\/code> \u2014 \u044d\u0442\u043e Map, \u0433\u0434\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f id \u0441\u0435\u0441\u0441\u0438\u0438, \u0430 \u0437\u043d\u0430\u0447\u0430\u043d\u0438\u0435\u043c Map \u0431\u0438\u043d\u043e\u0432 \u044d\u0442\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438. \u041d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0431\u0438\u043d \u043d\u0430\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041f\u0440\u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0431\u0438\u043d\u0430 CDI \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0431\u0438\u043d \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 InstanceInfo, \u0432 \u043a\u0442\u043e\u0440\u043e\u043c ctx \u2013 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0430 instance \u2013 \u0431\u0438\u043d. \u041a\u043b\u044e\u0447\u043e\u043c \u0432 \u041c\u0430\u0440 \u0431\u0438\u043d\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <code>Contextual<\/code>. <code>Contextual&lt;T&gt;<\/code> \u2013 \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 CDI \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u043d\u043e\u0432. \u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, CDI \u043e\u043f\u0435\u0440\u0435\u0438\u0440\u0443\u0435\u0442 \u043d\u0435 \u043d\u0430\u0448\u0438\u043c\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0431\u0438\u043d\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 T, \u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 <code>Contextual&lt;T&gt;<\/code> (<code>Bean&lt;T&gt;<\/code>, <code>Decorator&lt;T&gt;<\/code>, <code>Interceptor&lt;T&gt;<\/code>)  <\/p>\n<h6>\u0412 Spring:<\/h6>\n<p>  <\/p>\n<pre><code class=\"java\">private Map&lt;String, Map&lt;String, Object&gt;&gt; instances = new HashMap&lt;String, Map&lt;String, Object&gt;&gt;(); <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, Spring \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<h5>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438. <\/h5>\n<p>  \u041a\u0430\u043a \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, id \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 ThreadLocal \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u0412 Spring\u0438 JEE \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e.  <\/p>\n<pre><code class=\"java\">private final ThreadLocal&lt;String&gt; currentSessionId = new ThreadLocal&lt;String&gt;() {         protected String initialValue() {             return null;         } };  public String getCurrentSessionId() {     return currentSessionId.get(); }  public void setCurrentSessionId(String currentSessionId) {     this.currentSessionId.set(currentSessionId); } <\/code><\/pre>\n<h5>\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0441\u0435\u0441\u0441\u0438\u0438<\/h5>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0434\u043b\u044f JEE \u0438 Spring. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u0443\u044e Map \u0434\u043b\u044f id \u0441\u0435\u0441\u0441\u0438\u0438.   <\/p>\n<pre><code class=\"java\">public void activate(String sessionId) {     Map&lt;Contextual, InstanceInfo&gt; map = new HashMap&lt;Contextual, InstanceInfo&gt;();     instances.put(sessionId, map);     this.currentSessionId.set(sessionId); } <\/code><\/pre>\n<p>  \u0412 JEE \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, JEE \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0435\u0440\u0435\u0434 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043a \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0443:  <\/p>\n<pre><code class=\"java\">@Override public boolean isActive() {     String id = currentSessionId.get();     return instances.containsKey(id); } <\/code><\/pre>\n<h5>\u0414\u0435\u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0441\u0435\u0441\u0441\u0438\u0438 <\/h5>\n<p>  <\/p>\n<h6>\u0412 JEE<\/h6>\n<p>  <\/p>\n<pre><code class=\"java\">public void deactivate() {     String id = currentSessionId.get();     Map&lt;Contextual, InstanceInfo&gt; map = instances.get(id);     if (map == null) {         throw new RuntimeException(&quot;WsScope with id =&quot; + id + &quot; doesn't exist&quot;);     }     Set&lt;Contextual&gt; keySet = map.keySet();     for (Contextual contextual : keySet) {         InstanceInfo instanceInfo = map.get(contextual);         contextual.destroy(instanceInfo.instance, instanceInfo.ctx);     }     currentSessionId.set(null);     instances.remove(id); } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0438\u043c JEE \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0431\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438. \u041f\u043e\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@PreDestroy<\/code> \u0438 \u0434\u0435\u043b\u0430\u043d\u0438\u0435 \u0431\u0438\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0434\u043b\u044f garbage collector. JEE \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u0438\u043d\u0436\u0435\u043a\u0447\u0435\u043d\u044b \u0432 \u043d\u0430\u0448\u0438, \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<h6>\u0412 Spring<\/h6>\n<p>  \u0412\u0441\u0451 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435:  <\/p>\n<pre><code class=\"java\">public void deactivate() {     String id = currentSessionId.get();     Thread currentThread = Thread.currentThread();     Map&lt;String, Object&gt; map = instances.get(id);     if (map == null) {         throw new RuntimeException(&quot;WsScope with id =&quot; + id + &quot; doesn't exist&quot;);     }     Map&lt;String, Object&gt; objectsMap = instances.get(id);     Set&lt;String&gt; keySet = objectsMap.keySet();     for (String name : keySet) {         remove(name);     }     instances.remove(id);     currentSessionId.set(null); } <\/code><\/pre>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 JEE, \u0432 Spring \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>remove<\/code> \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u043d\u043e\u0432. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 <code>Scope<\/code>, \u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0430\u043c\u0438.  <\/p>\n<pre><code class=\"java\">public Object remove(String name) {     String sessionId = currentSessionId.get();     if (sessionId == null) {         throw new RuntimeException(&quot;WsScope is inactive&quot;);     }     Map&lt;String, Object&gt; map = instances.get(sessionId);     if (map == null) {         throw new RuntimeException(&quot;WsScope is inactive&quot;);     }     Runnable runnable = destructionCollbacks.get(name);     Thread t = new Thread(runnable);     t.start();     return map.remove(name); } <\/code><\/pre>\n<p>  <code>destructionCallbacks<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"java\">private Map&lt;String, Runnable&gt; destructionCollbacks = new HashMap&lt;&gt;(); <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u041c\u0430\u0440 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>Scope<\/code>  <\/p>\n<pre><code class=\"java\">public void registerDestructionCallback(String name, Runnable callback) {     destructionCollbacks.put(name, callback); } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, callback, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 Spring, \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u0432 <code>registerDestructionCallback<\/code>. \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0437\u0430\u0438\u043d\u0436\u0435\u043a\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 JEE, \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f. \u0422.\u0435. \u041d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c\u0438 \u0441 \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u043c \u0432 \u0431\u0438\u043d\u044b \u0438\u0437 custom scope \u0432 Spring. <\/p>\n<h5>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0438\u043d\u043e\u0432 <\/h5>\n<p>  <\/p>\n<h6>\u0412 JEE<\/h6>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b   <\/p>\n<pre><code class=\"java\">public &lt;T&gt; T get(Contextual&lt;T&gt; contextual), \u0438   public &lt;T&gt; T get(Contextual&lt;T&gt; contextual, CreationalContext&lt;T&gt; creationalContext) <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u043a\u0435\u0448\u0435. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u0435\u0440\u043d\u0443\u043b null, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0442\u043e\u0440\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0431\u0438\u043d\u0430.   <\/p>\n<pre><code class=\"java\">@Override public &lt;T&gt; T get(Contextual&lt;T&gt; contextual) {     Map&lt;Contextual,InstanceInfo&gt; map = instances.get(currentSessionId.get());     if (map == null) {         return null;     }     InstanceInfo&lt;T&gt; info = map.get(contextual);     if (info == null) {         return null;     }     return info.instance; }  @Override public &lt;T&gt; T get(Contextual&lt;T&gt; contextual, CreationalContext&lt;T&gt; creationalContext) {     T instance = contextual.create(creationalContext);     InstanceInfo&lt;T&gt; info = new InstanceInfo&lt;T&gt;();     info.ctx = creationalContext;     info.instance = instance;     Map&lt;Contextual, InstanceInfo&gt; map = nstances.get(currentSessionId.get());     if (map == null) {         map= new HashMap&lt;Contextual, Context.InstanceInfo&gt;();         instances.put(currentSessionId.get(), map);     }     map.put(contextual, info);     return instance; }  <\/code><\/pre>\n<p>  <\/p>\n<h6>\u0412 Spring<\/h6>\n<p>  \u0412 Spring \u0435\u0441\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b <code>get<\/code> \u0438 <code>resolveContextualObject<\/code>. <code>resolveContextualObject<\/code> \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Spring \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e custom scope. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u0440\u0435\u0439\u043a\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0413\u0443\u0433\u043b \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f, \u0442.\u0435. \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 null. \u041d\u043e \u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0441\u0430\u043c\u0438 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 <code>get<\/code>. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442<code> get<\/code> \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c.  <\/p>\n<pre><code class=\"java\">public Object get(String name, ObjectFactory&lt;?&gt; objectFactory) {     Object object = resolveContextualObject(name);     if (object != null) {         return object;     }     String sessionId = currentSessionId.get();     if (sessionId == null) {         throw new RuntimeException(&quot;WsScope is inactive&quot;);     }     Map&lt;String, Object&gt; map = instances.get(sessionId);     if (map == null) {         throw new RuntimeException(&quot;WsScope is inactive&quot;);     }     object = objectFactory.getObject();     map.put(name, object);     return object; }  public Object resolveContextualObject(String name) {     String sessionId = currentSessionId.get();     if (sessionId == null) {         return null;     }     Map&lt;String, Object&gt; map = instances.get(sessionId);     if (map == null) {         return null;     }     Object object = map.get(name);     return object; } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0432<code> org.springframework.beans.factory.config.Scope<\/code> \u0435\u0441\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043d\u0435\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434: <code>public String getConversationId()<\/code>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e javadoc, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.  <\/p>\n<pre><code class=\"java\">public String getConversationId() {     return currentSessionId.get(); } <\/code><\/pre>\n<h5>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 scope<\/h5>\n<p>  <\/p>\n<h6>\u0412 JEE<\/h6>\n<p>  \u0412 JEE \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c scope.  <\/p>\n<pre><code class=\"java\">@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @NormalScope public @interface WsScope { } <\/code><\/pre>\n<p>  \u0418 \u0435\u0449\u0451 \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441 \u043d\u0430\u0448\u0438\u043c scope. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434:  <\/p>\n<pre><code class=\"java\">@Override public Class&lt;? extends Annotation&gt; getScope() {     return WsScope.class; }  <\/code><\/pre>\n<p>  <\/p>\n<h6>\u0412 Spring<\/h6>\n<p>  \u0412 Spring scope \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043c\u0435\u043d\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u0430\u0435\u0442\u0441\u044f \u0435\u043c\u0443 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0438\u0436\u0435.<\/p>\n<h4>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 (scope)<\/h4>\n<p>  <\/p>\n<h6>\u0412 JEE<\/h6>\n<p>  \u0412 JEE \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 CDI Extension. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 Extension \u0438 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u044c \u043c\u0435\u0442\u043e\u0434  <\/p>\n<pre><code class=\"java\">public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) <\/code><\/pre>\n<p>  \u0412 \u043d\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"java\">context = new WsContext(); abd.addContext(context); <\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 extension \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435<code> \/META-INF\/services\/javax.enterprise.inject.spi.Extension<\/code>. \u041d\u0430\u0434\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 extension \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435. <br \/>  \u041d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 Extension \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e:<\/p>\n<pre><code class=\"java\">public class WsExtension implements Extension {     private WsContext context;      public WsContext getContext() {         return context;     }      public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) {         context = new WsContext();         abd.addContext(context);     } } <\/code><\/pre>\n<h6>\u0412 Spring<\/h6>\n<p>  \u0412 Spring \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 scope. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438  <\/p>\n<pre><code class=\"xml\">&lt;bean class=&quot;org.springframework.beans.factory.config.CustomScopeConfigurer&quot;&gt;     &lt;property name=&quot;scopes&quot;&gt;         &lt;map&gt;             &lt;entry key=&quot;WsScope&quot;&gt;                 &lt;bean class=&quot;com.dataart.customscope.spring.context.WsScope&quot; \/&gt;             &lt;\/entry&gt;         &lt;\/map&gt;     &lt;\/property&gt; &lt;\/bean&gt; <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u043a\u0430\u043a \u0441\u043f\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0439 \u0431\u0438\u043d \u0441\u043e scope Singleton.<\/p>\n<h4>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f scope \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0438\u043c\u0435\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.   <\/p>\n<h6>\u0412 JEE<\/h6>\n<p>  \u0412 JEE \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430, \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 WsExtension. \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0445\u043e\u0442\u044c \u043e\u043d \u0438 \u043d\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 scope. \u041d\u043e \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e WsContext \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0447\u0435\u043c Extension. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 Producer:  <\/p>\n<pre><code class=\"java\">public class WsContextProducer {     @Inject     private WsExtension ext;          @Produces     public WsContext getContext() {         return ext.getContext();     } } <\/code><\/pre>\n<p>  \u041d\u043e \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c manged bean \u0438 JEE \u043c\u043e\u0436\u0435\u0442 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u0438\u043d\u044b \u0441\u043e scope Default (\u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u043d\u0436\u0435\u043a\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440). \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u2014 CDI \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c WsScope \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438: default \u0438 \u0447\u0435\u0440\u0435\u0437 Producer. \u0410 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0432 \u044d\u043a\u0441\u0442\u0435\u043d\u0448\u0435\u043d\u0435, \u0442.\u0435. \u0447\u0435\u0440\u0435\u0437 Producer. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b CDI \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043a\u0430\u043a \u0431\u0438\u043d. \u0412 JEE7 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <code>@Vetoed<\/code>. \u0422.\u0435. \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"java\">@Vetoed public class WsContext implements Context {...} <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043a\u0443\u0434\u0430 \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"java\">@Inject private WsContext context;  <\/code><\/pre>\n<p>  <\/p>\n<h6>\u0412 Spring<\/h6>\n<p>  \u0422.\u043a. \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 scope \u043a\u0430\u043a \u0441\u043f\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0439 \u0431\u0438\u043d, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e:   <\/p>\n<pre><code class=\"java\">@Autowired private WsScope scope; <\/code><\/pre>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e scope<\/h4>\n<p>  \u0412\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0447\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 id \u0441\u0435\u0441\u0441\u0438\u0438 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 ws-session-id. \u0412\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0445\u0435\u043d\u0434\u043b\u0435\u0440\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 id \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u0422.\u0435. \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c. \u0415\u0441\u043b\u0438 id \u043d\u0435\u0442, \u0438\u043b\u0438 \u044d\u0442\u043e id \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 (\u043d\u0435 \u0431\u044b\u043b \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d), \u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u043e\u0448\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0414\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 id \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>activate()<\/code> \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u041e\u043d \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 id, \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0438 \u0432\u0435\u0440\u043d\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434. \u0414\u043b\u044f \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <code>deactivate()<\/code>. \u0412 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u044b \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 (\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u0438\u043d WsService) \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u043d \u0432 \u043d\u0430\u0448\u0435\u043c scope. \u042d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0422.\u0435. \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 id \u0441\u0435\u0441\u0441\u0438\u0438 \u0432 \u043d\u0430\u0448 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u043c\u0443 id.   <\/p>\n<h6>\u0412 JEE<\/h6>\n<p>  <\/p>\n<pre><code class=\"java\">@WsScope public class WsService { ... } <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430:   <\/p>\n<pre><code class=\"java\">@WebService() @HandlerChain(file = &quot;wshandler.xml&quot;, name = &quot;&quot;) public class WsScopeTest {     private static int id = 0;      @Inject     private WsContext context;      @Inject     private WsService srv;          @WebMethod()     public String startWsScope() {         String sessionId = String.valueOf(id++);         context.activate(sessionId);         return sessionId;     }      @WebMethod()     public void endWsScope(@WebParam(name = &quot;ws-session-id&quot;) String sessionId) {         context.deactivate();     }      @WebMethod()     public void setName(@WebParam(name = &quot;ws-session-id&quot;) String sessionId,         @WebParam(name = &quot;name&quot;)String name) {         srv.setName(name);     }      @WebMethod()     public String sayHello(@WebParam(name = &quot;ws-session-id&quot;) String sessionId) {         return srv.hello();     } } <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u0445\u044d\u043d\u0434\u043b\u0435\u0440\u0430:   <\/p>\n<pre><code class=\"java\">public class WsCdiSoapHandler implements SOAPHandler&lt;SOAPMessageContext&gt; {     private static final Logger LOGGER = Logger.getLogger(WsCdiSoapHandler.class.getName());      @Inject     private WsContext context;      @Override     public void close(MessageContext ctx) {     }      @Override     public boolean handleFault(SOAPMessageContext ctx) {         return true;     }      @Override     public boolean handleMessage(SOAPMessageContext ctx) {         Boolean outbound = (Boolean) ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);         SOAPMessage message = ctx.getMessage();         SOAPBody soapBody;         try {             soapBody = message.getSOAPBody();         } catch (SOAPException e) {             e.printStackTrace();             return false;         }         String methodName = null;         NodeList nodes = soapBody.getChildNodes();         methodName = findMethodName(methodName, nodes);         if (outbound) {             LOGGER.fine(&quot;[OUT] &quot; + methodName.replace(&quot;Response&quot;, &quot;&quot;));             return true;         }         LOGGER.fine(&quot;[IN] &quot; + methodName);         String sessionId = findSessionId(nodes);         context.setCurrentSessionId(sessionId);         LOGGER.fine(&quot;Handler. Id=&quot; + sessionId);         return true;     }      private String findMethodName(String methodName, NodeList nodes) {         for (int i = 0; i &lt; nodes.getLength(); i++) {             Node node = nodes.item(i);             if (Node.ELEMENT_NODE == node.getNodeType()) {                 methodName = node.getLocalName();             }         }         return methodName;     }      private String findSessionId(NodeList nodes) {         for (int i = 0; i &lt; nodes.getLength(); i++) {             Node node = nodes.item(i);             if (&quot;ws-session-id&quot;.equals(node.getLocalName())) {                 Node firstChild = node.getFirstChild();                 if (firstChild == null) {                     return null;                 }                 return firstChild.getNodeValue();             }             NodeList childNodes = node.getChildNodes();             String id = findSessionId(childNodes);             if (id != null) {                 return id;             }         }         return null;     }      @Override     public Set&lt;QName&gt; getHeaders() {         return null;     } } <\/code><\/pre>\n<p>  <\/p>\n<h6>\u0412 Spring<\/h6>\n<p>  \u0412 Spring \u043a\u043e\u0434 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435. \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e <code>@Inject<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<code> @Autowired<\/code>, \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0445\u0435\u043d\u0434\u043b\u0435\u0440.<br \/>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430:  <\/p>\n<pre><code class=\"java\">@Service @Scope(value = &quot;WsScope&quot;, proxyMode = ScopedProxyMode.TARGET_CLASS) public class WsService { ... } <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u2014 <code>proxyMode = ScopedProxyMode.TARGET_CLASS<\/code> \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e! \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u043f\u0440\u044f\u043c\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441, \u0442.\u043a. \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043e\u0434\u0438\u043d, \u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043c\u043d\u043e\u0433\u043e. \u0418 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441.<br \/>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u0445\u0435\u043d\u0434\u043b\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"xml\">&lt;jaxws:endpoint id=&quot;testWsService&quot; implementor=&quot;#testWS&quot; \taddress=&quot;\/WsTest&quot; publish=&quot;true&quot;&gt; \t\t&lt;jaxws:handlers&gt; \t\t\t&lt;bean class=&quot;com.dataart.customscope.spring.context.WsSoapHandler&quot;&gt;&lt;\/bean&gt; \t\t&lt;\/jaxws:handlers&gt; &lt;\/jaxws:endpoint&gt; &lt;bean id=&quot;testWS&quot; class=&quot;com.dataart.customscope.spring.testapp.WsTest&quot;&gt;&lt;\/bean&gt; <\/code><\/pre>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0445\u0435\u043d\u0434\u043b\u0435\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043a\u0430\u043a \u0441\u043f\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0435 \u0431\u0438\u043d\u044b, @Autowired \u0432 \u043d\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c custom scope \u0432 JEE \u0438 Spring \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0441\u0445\u043e\u0434\u043d\u044b. \u0422\u043e\u043b\u044c\u043a\u043e \u0432 JEE, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u0430\u044f \u2014 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0438 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0434\u0451\u0436\u043d\u0430\u044f \u2014 JEE \u043e\u0431\u0435\u0441\u043f\u0435\u0446\u0438\u0432\u0430\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0437\u0430\u0438\u043d\u0436\u0435\u043a\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/220233\/\"> http:\/\/habrahabr.ru\/post\/220233\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\tScope \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, java-\u0431\u0438\u043d (\u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0438\u043d) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0432 RequestScope \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 http \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0412 JEE \u0438 \u0432 Spring \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 scope. \u0422.\u0435. \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u2014 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443 \u043b\u0438\u0431\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0438 \u0442\u0430\u043a\u0436\u0435 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0442\u044c\u0441\u044f. \u0412 JEE \u0437\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f CDI (Context and Dependency Injection) \u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043c \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 scope. \u042d\u0442\u043e ConversationScope. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c API \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f conversation. \u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u0442\u043e \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e ConversationScope \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a RequestScope. \u0414\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f conversation \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 conversationId, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 http \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0410 \u0432 Spring \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e. \u041d\u043e \u0432 \u043c\u043e\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422.\u0435. \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438) \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0442\u0430\u043a\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 conversation scope \u0434\u043b\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u041c\u0430\u0440, \u0433\u0434\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448 \u0430\u043d\u0430\u043b\u043e\u0433 conversationId, \u0430 \u041c\u0430\u0440 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 ServleContext \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432\u0441\u0451 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041d\u043e \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u043d\u0430\u043c \u043d\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 conversationId. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0432\u043e\u0439 scope, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SOAP \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c. \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u043c\u0443-\u043b\u0438\u0431\u043e scope, \u043d\u043e \u043d\u0430\u0448 \u0431\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u0432 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u043c\u0443 scope.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-220233","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/220233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=220233"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/220233\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=220233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=220233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=220233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}