- 浏览: 33677 次
- 性别:
- 来自: 北京
-
最近访客 更多访客>>
文章分类
- 全部博客 (31)
- web前端技术 (4)
- JS中四舍五入 (1)
- 去掉小数点以及无效字符 (1)
- 按钮样式 (1)
- oracle解决死锁问题 (1)
- oracle递归查询 (1)
- 圆角文本框 (1)
- spring mvc 批量上传 (1)
- json (1)
- oracle (2)
- 正则表达式 (1)
- checkbox框 (1)
- ec_table多选框 (1)
- java io操作本地文件 (1)
- 创建表空间以及用户权限 (1)
- eclipse+tomcat (1)
- dblink (1)
- 物化视图 (1)
- IE事件 (1)
- java编程 (1)
- oracle 表空间 (1)
- 重置序列 (1)
- 函数索引 (1)
- oracle 解决session被锁问题 (1)
- 查询表空间存放位置 (1)
最新评论
filter
/*
* Created on 2004-11-19
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.aisino.common.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.aisino.privisys.Constants;
/**
*
* @author vincent.shan
*
* 功能:用户非法登录访问跳转处理
*/
public class AuthFilter extends HttpServlet implements Filter {
/**
*
*/
private static final long serialVersionUID = 3435621465821410076L;
private FilterConfig fileterConfig;
public void init(FilterConfig arg0) throws ServletException {
this.fileterConfig = arg0;
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException,
ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String uri = httpRequest.getRequestURI();
boolean flag=(httpRequest.getSession().getAttribute(Constants.userKey)==null);
uri=uri.replaceAll("([?].*)|([/].*[/])","");
String authUrls = fileterConfig.getInitParameter("authUrls");
if (flag) {
if(authUrls.length()>0&&authUrls.indexOf(uri)!=-1){
filterChain.doFilter(request, response);
return;
}
((HttpServletResponse) response).sendRedirect(WebUtil.getCompeleteContext(httpRequest)+"login.jsp");
return;
} else {
filterChain.doFilter(request, response);
return;
}
}
public void destroy() {
this.fileterConfig = null;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/config/spring/*.xml</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>config/i18n/messages_zh_CN</param-value>
</context-param>
<context-param>
<param-name>extremecomponentsPreferencesLocation</param-name>
<param-value>/config/i18n/extremetable.properties</param-value>
</context-param>
<context-param>
<param-name>extremecomponentsMessagesLocation</param-name>
<param-value>config/i18n/extremetableResourceBundle</param-value>
</context-param>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter>
<filter-name>eXtremeExport</filter-name>
<filter-class>org.extremecomponents.table.filter.ExportFilter</filter-class>
<init-param>
<param-name>responseHeadersSetBeforeDoFilter</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>Auth</filter-name>
<filter-class>com.aisino.common.util.AuthFilter</filter-class>
<init-param>
<param-name>authUrls</param-name>
<param-value>ctaisRequest.do,login.do,authQueryService.do</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>eXtremeExport</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Auth</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/classes/config/struts/struts-config.xml,
/WEB-INF/classes/config/struts/privisys-struts-config.xml,
/WEB-INF/classes/config/struts/netinv-struts-config.xml,
/WEB-INF/classes/config/struts/notice-struts-config.xml,
/WEB-INF/classes/config/struts/baseInf-struts-config.xml,
/WEB-INF/classes/config/struts/invoiceFail-struts-config.xml,
/WEB-INF/classes/config/struts/fpyj-struts-config.xml
</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!--
<servlet>
<servlet-name>xfire</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:org/codehaus/xfire/spring/xfire.xml,/WEB-INF/classes/config/spring/xfire-servlet.xml</param-value>
</init-param>
</servlet>
-->
<!--
<servlet-mapping>
<servlet-name>xfire</servlet-name>
<url-pattern>/webservice/*</url-pattern>
</servlet-mapping>
-->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>600</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>welcome.jsp</welcome-file>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>500</error-code>
<location>/errorPage.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/errorPage.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/errorPage.jsp</location>
</error-page>
<taglib>
<taglib-uri>struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>struts-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>struts-logic</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>extremecomponents</taglib-uri>
<taglib-location>/WEB-INF/tld/extremecomponents.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-menu</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-menu.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-menu-el</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-menu-el.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>automatic</taglib-uri>
<taglib-location>/WEB-INF/tld/automatic.tld</taglib-location>
</taglib>
<resource-ref>
<res-ref-name>login</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
* Created on 2004-11-19
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.aisino.common.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.aisino.privisys.Constants;
/**
*
* @author vincent.shan
*
* 功能:用户非法登录访问跳转处理
*/
public class AuthFilter extends HttpServlet implements Filter {
/**
*
*/
private static final long serialVersionUID = 3435621465821410076L;
private FilterConfig fileterConfig;
public void init(FilterConfig arg0) throws ServletException {
this.fileterConfig = arg0;
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException,
ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String uri = httpRequest.getRequestURI();
boolean flag=(httpRequest.getSession().getAttribute(Constants.userKey)==null);
uri=uri.replaceAll("([?].*)|([/].*[/])","");
String authUrls = fileterConfig.getInitParameter("authUrls");
if (flag) {
if(authUrls.length()>0&&authUrls.indexOf(uri)!=-1){
filterChain.doFilter(request, response);
return;
}
((HttpServletResponse) response).sendRedirect(WebUtil.getCompeleteContext(httpRequest)+"login.jsp");
return;
} else {
filterChain.doFilter(request, response);
return;
}
}
public void destroy() {
this.fileterConfig = null;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/config/spring/*.xml</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>config/i18n/messages_zh_CN</param-value>
</context-param>
<context-param>
<param-name>extremecomponentsPreferencesLocation</param-name>
<param-value>/config/i18n/extremetable.properties</param-value>
</context-param>
<context-param>
<param-name>extremecomponentsMessagesLocation</param-name>
<param-value>config/i18n/extremetableResourceBundle</param-value>
</context-param>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter>
<filter-name>eXtremeExport</filter-name>
<filter-class>org.extremecomponents.table.filter.ExportFilter</filter-class>
<init-param>
<param-name>responseHeadersSetBeforeDoFilter</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>Auth</filter-name>
<filter-class>com.aisino.common.util.AuthFilter</filter-class>
<init-param>
<param-name>authUrls</param-name>
<param-value>ctaisRequest.do,login.do,authQueryService.do</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>eXtremeExport</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Auth</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/classes/config/struts/struts-config.xml,
/WEB-INF/classes/config/struts/privisys-struts-config.xml,
/WEB-INF/classes/config/struts/netinv-struts-config.xml,
/WEB-INF/classes/config/struts/notice-struts-config.xml,
/WEB-INF/classes/config/struts/baseInf-struts-config.xml,
/WEB-INF/classes/config/struts/invoiceFail-struts-config.xml,
/WEB-INF/classes/config/struts/fpyj-struts-config.xml
</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!--
<servlet>
<servlet-name>xfire</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:org/codehaus/xfire/spring/xfire.xml,/WEB-INF/classes/config/spring/xfire-servlet.xml</param-value>
</init-param>
</servlet>
-->
<!--
<servlet-mapping>
<servlet-name>xfire</servlet-name>
<url-pattern>/webservice/*</url-pattern>
</servlet-mapping>
-->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>600</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>welcome.jsp</welcome-file>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>500</error-code>
<location>/errorPage.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/errorPage.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/errorPage.jsp</location>
</error-page>
<taglib>
<taglib-uri>struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>struts-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>struts-logic</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>extremecomponents</taglib-uri>
<taglib-location>/WEB-INF/tld/extremecomponents.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-menu</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-menu.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-menu-el</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-menu-el.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>automatic</taglib-uri>
<taglib-location>/WEB-INF/tld/automatic.tld</taglib-location>
</taglib>
<resource-ref>
<res-ref-name>login</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
相关推荐
### Java Filter 打印请求返回参数详解 #### 一、背景与目的 在Web开发过程中,经常需要在请求处理流程中增加一些通用的功能,比如日志记录、性能监控、安全控制等。Java Servlet规范提供了Filter机制来实现这些...
标题中的“cors-filter-2.5.jar”是一个Java Web应用程序使用的库,专门用于处理跨域资源共享(CORS)的问题。CORS是一种机制,允许Web应用通过浏览器从不同源(即非同源策略允许的源)获取资源,以克服浏览器的同源...
本资料“RF filter.rar”涵盖了射频滤波器设计的各种方面,包括低通滤波器、带通滤波器以及Chebyshev滤波器,这些都是射频滤波器的常见类型。 1. 射频低通滤波器:这种滤波器允许低频信号通过,而阻止高频信号。在...
Servlet Filter 是Java Servlet API中的一个重要组件,主要用于在Servlet处理请求之前或之后进行拦截处理,例如权限检查、日志记录、内容转换等。进行Servlet Filter的单元测试是确保Filter功能正确性和健壮性的重要...
TI公司开发的FilterPro是一款软件工具,旨在辅助工程师设计由多重反馈(MFB)和Sallen-Key拓扑结构实现的有源滤波器。它能够减少设计和验证有源滤波器时所耗费的时间和精力,这对于现代电子设计而言极为重要,因为...
Filter Solutions 简易教程 Filter Solutions 是一种滤波器设计软件,旨在帮助用户快速设计和实现滤波器电路。下面是 filter solutions 简易教程的知识点总结: 一、Filter Solutions 软件简介 * Filter ...
**FilterPro TI滤波器设计软件详解** FilterPro是由美国Texas Instruments(TI)公司开发的一款专业滤波器设计工具,广泛应用于信号处理、通信、音频系统等领域。它为工程师提供了直观且高效的滤波器设计环境,能够...
`Datagrid-filter`插件正是针对这种需求设计的,它是一个高效且实用的Grid插件,旨在提升数据网格的可操作性和用户交互性。这个插件的核心功能是为每一列提供过滤条件,使得用户能够快速筛选出所需的信息,极大地...
### Java中的Filter(过滤器)使用详解 #### 一、Filter概述 在Java Web开发中,`Filter`是一种非常实用的技术,它可以在请求到达目标资源(如Servlet或JSP页面)之前进行预处理,或者在响应返回客户端之前进行后...
标题中的“cors-filter-1.7.jar”,“cors-filter-2.5.jar”和“cors-filter-2.10.jar”是针对不同版本的CORS过滤器实现。这些jar包是专门为Tomcat设计的,用于处理跨域请求过滤,确保服务器能够安全地响应来自不...
<filter-name>XssFilter</filter-name> <filter-class>com.xxx.Filter.XssFilter</filter-class> </filter> <filter-mapping> <filter-name>XssFilter</filter-name> <url-pattern>/* </filter-mapping>
有源滤波器设计软件Filter Design Wizard是一款专用于设计有源滤波器的专业工具,它为电子工程师提供了简便而高效的设计平台。有源滤波器是电子系统中常见的一种信号处理设备,它能够通过电子元件(如运算放大器)来...
Filter Wiz Pro适用于低于-1Hz 至10MHz 范围内的截止频率,而适用于此范围的无源滤波器设计必须具备非常大的组件值和组件尺寸 Filter Wiz Pro在几分钟内便能让您设计、优化和仿真一套完整的多级有源滤波器解决方案...
在Java Web开发中,Filter(过滤器)是一个非常重要的组件,它允许我们在数据处理之前或之后执行特定的任务,比如防止跨站脚本攻击(XSS)、处理字符编码问题、实现权限控制等。在这个主题中,我们将深入理解Filter的...
FilterPro是一款由德州仪器(TI)开发的专业有源滤波器设计软件,它为电子工程师提供了强大而便捷的工具,用于模拟和优化滤波器设计。本教程将涵盖FilterPro的安装过程以及基本的使用方法,包括Sallen-Key滤波器和多...
在IT领域,尤其是在Web开发中,`FilterBuilder`是一个重要的工具,它允许用户构建自定义的查询和过滤条件,以动态地筛选数据。这个组件通常用于数据量大、需要复杂查询逻辑的应用场景,如数据分析、报表展示或者管理...
**Filter Pro 有源滤波器设计软件:TI公司的创新工具** Filter Pro是一款由美国德州仪器(TI)公司开发的专业有源滤波器设计软件。TI作为全球知名的半导体和集成电路制造商,其产品线广泛,包括各种模拟和数字解决...
标题中的“imu_filter_madgwick”指的是Madgwick滤波算法,这是一类用于惯性测量单元(IMU)数据处理的算法,主要用于融合来自陀螺仪和加速度计的数据,以消除噪声和漂移,提高传感器测量的稳定性和准确性。...
对request请求进行拦截,... <filter-class>weixin.idea.waiting.cq.controller.JsFilter</filter-class> </filter> <filter-mapping> <filter-name>sqlFilter</filter-name> <url-pattern>/* </filter-mapping>
Wavelets and Filter Banks_MIT Lecture 1 Discrete-time Filters: Convolution Fourier Transform Lowpass and Highpass Filters Lecture 2 Sampling Rate Change Operations: Upsampling and Downsampling ...