菜鸟java编程 Servletproxy
来源:互联网 发布:php cookie 保存数组 编辑:程序博客网 时间:2024/06/16 13:05
package com.lyl.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 ServletProxy extends GenericServlet {
private String targetBean;
private Servlet proxy;
@Override
public void service(ServletRequest req, ServletResponse resp)
throws ServletException, IOException {
proxy.service(req, resp);
}
@Override
public void destroy() {
super.destroy();
}
@Override
public void init() throws ServletException {
this.targetBean = getServletName();
getServletBean();
proxy.init(getServletConfig());
}
private void getServletBean(){
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
this.proxy = (Servlet) webApplicationContext.getBean(targetBean);
}
}
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 ServletProxy extends GenericServlet {
private String targetBean;
private Servlet proxy;
@Override
public void service(ServletRequest req, ServletResponse resp)
throws ServletException, IOException {
proxy.service(req, resp);
}
@Override
public void destroy() {
super.destroy();
}
@Override
public void init() throws ServletException {
this.targetBean = getServletName();
getServletBean();
proxy.init(getServletConfig());
}
private void getServletBean(){
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
this.proxy = (Servlet) webApplicationContext.getBean(targetBean);
}
}
0 0
- 菜鸟java编程 Servletproxy
- java菜鸟编程小结
- 兔子问题,java菜鸟编程
- 我是菜鸟:java并发编程
- java菜鸟从零d2--网络编程
- Java菜鸟编程 一个有趣的练习
- 菜鸟菜鸟菜鸟菜鸟编程之路
- 本人菜鸟,Java编程时遇到一问题!,请帮忙!
- Java网络编程叶存菜鸟笔记InetAddress
- Java------网络通信编程 之 菜鸟新手的学习总结
- java程序员从笨鸟到菜鸟之(四十四)Socket编程
- java菜鸟
- Java菜鸟
- 菜鸟java
- 特级菜鸟学编程
- 菜鸟也来看编程
- 我是编程菜鸟!
- 菜鸟在学编程__LSJ
- 杭电ACM2060java做法(WA)
- poj1556 判断线段相交+最短路
- 天气类app使用体验
- javaweb中的转发和重定向的区别
- 大数据量高效导入数据库(以excel导入sqlserver为例)
- 菜鸟java编程 Servletproxy
- ajax的使用
- 求一个数组中第k大的数,要求不能另外申请空间,数组顺序不能被改变
- 俞敏洪老师推荐的书单
- 0-1背包:nefu19采药hdu2546饭卡
- MVC图片上传
- leetcode-35 Search Insert Position
- struts2 action如何在前台弹出信息提示
- LintCode--买卖股票的最佳时机