/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package filters;
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;
/**
* <p>
* Example filter that sets the character encoding to be used in parsing the
* incoming request, either unconditionally or only if the client did not
* specify a character encoding. Configuration of this filter is based on the
* following initialization parameters:
* </p>
* <ul>
* <li><strong>encoding</strong> - The character encoding to be configured for
* this request, either conditionally or unconditionally based on the
* <code>ignore</code> initialization parameter. This parameter is required, so
* there is no default.</li>
* <li><strong>ignore</strong> - If set to "true", any character encoding
* specified by the client is ignored, and the value returned by the
* <code>selectEncoding()</code> method is set. If set to "false,
* <code>selectEncoding()</code> is called <strong>only</strong> if the client
* has not already specified an encoding. By default, this parameter is set to
* "true".</li>
* </ul>
*
* <p>
* Although this filter can be used unchanged, it is also easy to subclass it
* and make the <code>selectEncoding()</code> method more intelligent about what
* encoding to choose, based on characteristics of the incoming request (such as
* the values of the <code>Accept-Language</code> and <code>User-Agent</code>
* headers, or a value stashed in the current user's session.
* </p>
*
* @author Craig McClanahan
* @version $Revision: 500674 $ $Date: 2007-01-28 00:15:00 +0100 (Sun, 28 Jan
* 2007) $
*/
public class SetCharacterEncodingFilter implements Filter {
// ----------------------------------------------------- Instance Variables
/**
* The default character encoding to set for requests that pass through this
* filter.
*/
protected String encoding = null;
/**
* The filter configuration object we are associated with. If this value is
* null, this filter instance is not currently configured.
*/
protected FilterConfig filterConfig = null;
/**
* Should a character encoding specified by the client be ignored?
*/
protected boolean ignore = true;
// --------------------------------------------------------- Public Methods
/**
* Take this filter out of service.
*/
public void destroy() {
this.encoding = null;
this.filterConfig = null;
}
/**
* Select and set (if specified) the character encoding to be used to
* interpret request parameters for this request.
*
* @param request
* The servlet request we are processing
* @param result
* The servlet response we are creating
* @param chain
* The filter chain we are processing
*
* @exception IOException
* if an input/output error occurs
* @exception ServletException
* if a servlet error occurs
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
// Conditionally select and set the character encoding to be used
if (ignore || (request.getCharacterEncoding() == null)) {
String encoding = selectEncoding(request);
if (encoding != null)
request.setCharacterEncoding(encoding);
}
// Pass control on to the next filter
chain.doFilter(request, response);
}
/**
* Place this filter into service.
*
* @param filterConfig
* The filter configuration object
*/
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
String value = filterConfig.getInitParameter("ignore");
if (value == null)
this.ignore = true;
else if (value.equalsIgnoreCase("true"))
this.ignore = true;
else if (value.equalsIgnoreCase("yes"))
this.ignore = true;
else
this.ignore = false;
}
// ------------------------------------------------------ Protected Methods
/**
* Select an appropriate character encoding to be used, based on the
* characteristics of the current request and/or filter initialization
* parameters. If no character encoding should be set, return
* <code>null</code>.
* <p>
* The default implementation unconditionally returns the value configured
* by the <strong>encoding</strong> initialization parameter for this
* filter.
*
* @param request
* The servlet request we are processing
*/
protected String selectEncoding(ServletRequest request) {
return (this.encoding);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
医院支付平台系统整体框架+基本功能+数据库
共226个文件
jsp:44个
java:44个
class:44个
3星 · 超过75%的资源 需积分: 50 68 下载量 149 浏览量
2015-12-04
15:53:44
上传
评论 3
收藏 2.16MB ZIP 举报
温馨提示
一个完整的web系统主要使用struts2等主流技术,有完整的数据库sql文件,供大家学习参考
资源推荐
资源详情
资源评论
收起资源包目录
医院支付平台系统整体框架+基本功能+数据库 (226个子文件)
AuthFilter.class 7KB
Dao.class 6KB
StrutsUtil.class 6KB
Register.class 4KB
Member.class 4KB
BaseAction.class 4KB
BaseManager.class 4KB
PatManager.class 4KB
Prescription.class 3KB
EmployeeManager.class 3KB
NurseManager.class 3KB
DoctorManager.class 3KB
Unit.class 3KB
Patient.class 3KB
PrescriptionManager.class 3KB
DoctorAction.class 3KB
NurseAction.class 3KB
AssManager.class 3KB
InjAction.class 3KB
DruAction.class 3KB
PatientManager.class 3KB
PatAction.class 3KB
HibernateSessionFactory.class 3KB
RegisterAction.class 2KB
UnitManager.class 2KB
Drug.class 2KB
SetCharacterEncodingFilter.class 2KB
AdmAction.class 2KB
PrescriptionAction.class 2KB
PatientAction.class 2KB
UnitAction.class 2KB
RegisterManager.class 2KB
MemberAction.class 1KB
SymptomAction.class 1KB
DrugAction.class 1KB
PrescriptionDrug.class 1KB
Symptom.class 1KB
DrugManager.class 993B
MemberManager.class 949B
SymptomManager.class 795B
AdmManager.class 523B
PrescriptionDrugAction.class 499B
PrescriptionDrugManager.class 438B
ID.class 379B
.classpath 1KB
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 7KB
dtree.css 795B
jquery.autocomplete.css 575B
.DS_Store 6KB
dwr20.dtd 5KB
globe.gif 1KB
trash.gif 1KB
question.gif 1KB
base.gif 1KB
nolines_plus.gif 870B
nolines_minus.gif 861B
menu7.gif 691B
musicfolder.gif 633B
imgfolder.gif 622B
page.gif 582B
folderopen.gif 376B
folder.gif 372B
cd.gif 239B
plus.gif 89B
plusbottom.gif 88B
minus.gif 86B
minusbottom.gif 85B
join.gif 69B
line.gif 66B
joinbottom.gif 66B
empty.gif 62B
main.html 3KB
mysql-connector-java-5.0.8-bin.jar 528KB
dwr.jar 491KB
log4j-1.2.12.jar 350KB
bsh-2.0b4.jar 275KB
bsf-2.3.jar 171KB
commons-validator-1.1.4.jar 82KB
jakarta-oro-2.0.8.jar 64KB
commons-logging-1.0.4.jar 37KB
SetCharacterEncodingFilter.java 5KB
AuthFilter.java 5KB
Dao.java 4KB
StrutsUtil.java 4KB
Register.java 3KB
BaseAction.java 3KB
HibernateSessionFactory.java 3KB
Member.java 3KB
Prescription.java 2KB
PatManager.java 2KB
Patient.java 2KB
PrescriptionManager.java 2KB
PatAction.java 2KB
DoctorAction.java 2KB
BaseManager.java 2KB
NurseAction.java 2KB
Unit.java 2KB
EmployeeManager.java 2KB
AssManager.java 2KB
共 226 条
- 1
- 2
- 3
啥也不懂的PONY
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 利用 Microsoft.Office.Interop.Excel处理带外部引用的Excel
- Mega328p-bootloader启动固件
- LML6401-VB一款SOT23封装P-Channel场效应MOS管
- c#人事管理系统设计与实现(lw+源代码+答辩PPT).rar
- TensorFlow 的 Rust 语言绑定
- LML6401G-VB一款SOT23封装P-Channel场效应MOS管
- 基于C++使用模拟退火算法求解旅行商问题.zip
- LML6346-VB一款SOT23封装N-Channel场效应MOS管
- 基于SpringBoot框架的任务调度系统的设计与实现【尚学堂·百战程序员】.zip
- 使用Python实现的旅行商问题的多种求解算法.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页