1 4 package com.opensymphony.webwork.spring; 5 6 import com.opensymphony.xwork.ActionContext; 7 import com.opensymphony.xwork.spring.SpringProxyableObjectFactory; 8 import com.opensymphony.webwork.spring.lifecycle.ApplicationContextSessionListener; 9 import org.springframework.context.ApplicationContext; 10 11 import java.util.Map ; 12 13 18 public class SessionContextSpringProxyableObjectFactory extends SpringProxyableObjectFactory { 19 20 protected ApplicationContext getApplicationContext() { 21 Map session = ActionContext.getContext().getSession(); 22 ApplicationContext sessionContext = (ApplicationContext) session.get(ApplicationContextSessionListener.APP_CONTEXT_SESSION_KEY); 23 if (sessionContext == null) { 24 throw new IllegalStateException ("There is no application context in the user's session"); 25 } 26 return sessionContext; 27 } 28 } 29 | Popular Tags |