zoukankan      html  css  js  c++  java
  • 重写struts过滤器

      <filter>
        <filter-name>ExtendStrutsFilter</filter-name>
        <filter-class>
      com.lt.xiaoliao.util.ExtendStrutsFilter
      </filter-class>
      </filter>
      <filter-mapping>
        <filter-name>ExtendStrutsFilter</filter-name>
        <url-pattern>/*</url-pattern>
          <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
      </filter-mapping>


     package com.lt.xiaoliao.util;
     
    import java.io.BufferedReader;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PushbackInputStream;
     
    import javax.servlet.FilterChain;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
     
    import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter;
     
    public class ExtendStrutsFilter extends StrutsPrepareAndExecuteFilter{
     
    @Override
       public void doFilter(ServletRequest req, ServletResponse res,FilterChain chain) throws IOException, ServletException {
           HttpServletRequest request = (HttpServletRequest) req;
           if (request.getRequestURI().endsWith("qiniuServlet.do")) {
               chain.doFilter(req, res);
           }else{
               //System.out.println("使用默认的过滤器");
               super.doFilter(req, res, chain);
           }
       }
     
    }
     
  • 相关阅读:
    MySQL++:Liunx
    MySQL++:liunx 安装 MySQL
    MySQL++:MySQL 相关机制参数解释说明
    linux++:Linux
    linux++:基本操作命令
    coding++:java正则表达式获取指定HTML标签的指定属性值
    mongodb++:mongodb 基本语法
    xml模块
    shelve模块简单用法
    shutil模块
  • 原文地址:https://www.cnblogs.com/jimmy-muyuan/p/5722744.html
Copyright © 2011-2022 走看看