athrunwang

          紀元
          數據加載中……
          spring 委派Servlet代理類
          import java.io.IOException;
          import javax.servlet.GenericServlet;
          import javax.servlet.Servlet;
          import javax.servlet.ServletException;
          import javax.servlet.ServletRequest;
          import javax.servlet.ServletResponse;
          import org.springframework.web.context.WebApplicationContext;
          import org.springframework.web.context.support.WebApplicationContextUtils;
          public class DelegatingServletProxy extends GenericServlet implements Servlet {
          private String targetBean;
          private Servlet proxy;
          public void init() throws ServletException {
          this.targetBean = getServletName();
          getServletBean();
          proxy.init(getServletConfig());
          }
          public void service(ServletRequest req, ServletResponse res)
          throws ServletException, IOException {
          proxy.service(req, res);
          }
          private void getServletBean() {
          WebApplicationContext wac = WebApplicationContextUtils
          .getRequiredWebApplicationContext(getServletContext());
          this.proxy = (Servlet) wac.getBean(targetBean);
          }
          }

          posted on 2011-11-02 19:11 AthrunWang 閱讀(451) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 墨竹工卡县| 惠来县| 灌云县| 镇远县| 新兴县| 深泽县| 内乡县| 丰都县| 万山特区| 宁化县| 龙山县| 黄冈市| 日照市| 凌云县| 通渭县| 思茅市| 京山县| 南京市| 辽宁省| 凌云县| 普宁市| 方山县| 法库县| 雷山县| 广东省| 灌南县| 华阴市| 吉水县| 突泉县| 邵东县| 杭锦旗| 新化县| 阿克苏市| 武义县| 宣恩县| 华蓥市| 工布江达县| 浑源县| 安阳市| 商水县| 城口县|