锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产成人精品亚洲日本在线,久久精品国产亚洲AV久,亚洲激情视频在线观看http://www.tkk7.com/Jiangzy/category/19414.html榪欎釜涓栫晫涓婂彧鏈変袱鏍蜂笢瑗挎剤鍒嗕韓鎰堝,閭e氨鏄櫤鎱т笌鐖便?/description>zh-cnFri, 16 Mar 2007 03:21:56 GMTFri, 16 Mar 2007 03:21:56 GMT60ArrayList鐨勪嬌鐢ㄦ柟娉?http://www.tkk7.com/Jiangzy/articles/104125.html椋涢洩(leo)椋涢洩(leo)Thu, 15 Mar 2007 16:28:00 GMThttp://www.tkk7.com/Jiangzy/articles/104125.htmlhttp://www.tkk7.com/Jiangzy/comments/104125.htmlhttp://www.tkk7.com/Jiangzy/articles/104125.html#Feedback0http://www.tkk7.com/Jiangzy/comments/commentRss/104125.htmlhttp://www.tkk7.com/Jiangzy/services/trackbacks/104125.html闃呰鍏ㄦ枃

]]>
[Java浠g爜]鍥涗釜鏈夌敤鐨勮繃铏戝櫒 Filterhttp://www.tkk7.com/Jiangzy/articles/95371.html椋涢洩(leo)椋涢洩(leo)Mon, 22 Jan 2007 08:59:00 GMThttp://www.tkk7.com/Jiangzy/articles/95371.htmlhttp://www.tkk7.com/Jiangzy/comments/95371.htmlhttp://www.tkk7.com/Jiangzy/articles/95371.html#Feedback0http://www.tkk7.com/Jiangzy/comments/commentRss/95371.htmlhttp://www.tkk7.com/Jiangzy/services/trackbacks/95371.html涓銆佷嬌嫻忚鍣ㄤ笉緙撳瓨欏甸潰鐨勮繃婊ゅ櫒

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
聽* 鐢ㄤ簬鐨勪嬌 Browser 涓嶇紦瀛橀〉闈㈢殑榪囨護鍣?br />聽*/
public class ForceNoCacheFilter聽implements Filter {

聽public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException
聽{
聽聽((HttpServletResponse) response).setHeader("Cache-Control","no-cache");
聽聽((HttpServletResponse) response).setHeader("Pragma","no-cache");
聽聽((HttpServletResponse) response).setDateHeader ("Expires", -1);
聽聽filterChain.doFilter(request, response);
聽}

聽public void destroy()
聽{
聽}

聽聽聽 public void init(FilterConfig filterConfig) throws ServletException
聽{
聽}
}

浜屻佹嫻嬬敤鎴鋒槸鍚︾櫥闄嗙殑榪囨護鍣?/p>

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.IOException;

/**
聽* 鐢ㄤ簬媯嫻嬬敤鎴鋒槸鍚︾櫥闄嗙殑榪囨護鍣紝濡傛灉鏈櫥褰曪紝鍒欓噸瀹氬悜鍒版寚鐨勭櫥褰曢〉闈?lt;p>
聽* 閰嶇疆鍙傛暟<p>
聽* checkSessionKey 闇媯鏌ョ殑鍦?Session 涓繚瀛樼殑鍏抽敭瀛?lt;br/>
聽* redirectURL 濡傛灉鐢ㄦ埛鏈櫥褰曪紝鍒欓噸瀹氬悜鍒版寚瀹氱殑欏甸潰錛孶RL涓嶅寘鎷?ContextPath<br/>
聽* notCheckURLList 涓嶅仛媯鏌ョ殑URL鍒楄〃錛屼互鍒嗗彿鍒嗗紑錛屽茍涓?URL 涓笉鍖呮嫭 ContextPath<br/>
聽*/
public class CheckLoginFilter
聽implements Filter
{
聽聽聽聽protected FilterConfig filterConfig = null;
聽聽聽 private String redirectURL = null;
聽聽聽聽private List notCheckURLList = new ArrayList();
聽聽聽聽private String sessionKey = null;

聽public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
聽{
聽聽HttpServletRequest request = (HttpServletRequest) servletRequest;
聽聽HttpServletResponse response = (HttpServletResponse) servletResponse;

聽聽 HttpSession session = request.getSession();
聽聽if(sessionKey == null)
聽聽{
聽聽聽filterChain.doFilter(request, response);
聽聽聽return;
聽聽}
聽聽if((!checkRequestURIIntNotFilterList(request)) && session.getAttribute(sessionKey) == null)
聽聽{
聽聽聽response.sendRedirect(request.getContextPath() + redirectURL);
聽聽聽return;
聽聽}
聽聽filterChain.doFilter(servletRequest, servletResponse);
聽}

聽public void destroy()
聽{
聽聽notCheckURLList.clear();
聽}

聽private boolean checkRequestURIIntNotFilterList(HttpServletRequest request)
聽{
聽聽String uri = request.getServletPath() + (request.getPathInfo() == null ? "" : request.getPathInfo());
聽聽return notCheckURLList.contains(uri);
聽}

聽public void init(FilterConfig filterConfig) throws ServletException
聽{
聽聽this.filterConfig = filterConfig;
聽聽redirectURL = filterConfig.getInitParameter("redirectURL");
聽 sessionKey = filterConfig.getInitParameter("checkSessionKey");

聽聽String notCheckURLListStr = filterConfig.getInitParameter("notCheckURLList");

聽聽if(notCheckURLListStr != null)
聽聽{
聽聽聽StringTokenizer st = new StringTokenizer(notCheckURLListStr, ";");
聽聽聽notCheckURLList.clear();
聽聽聽while(st.hasMoreTokens())
聽聽聽{
聽聽聽聽notCheckURLList.add(st.nextToken());
聽聽聽}
聽聽}
聽}
}

涓夈佸瓧絎︾紪鐮佺殑榪囨護鍣?/p>

import javax.servlet.*;
import java.io.IOException;

/**
聽* 鐢ㄤ簬璁劇疆 HTTP 璇鋒眰瀛楃緙栫爜鐨勮繃婊ゅ櫒錛岄氳繃榪囨護鍣ㄥ弬鏁癳ncoding鎸囨槑浣跨敤浣曠瀛楃緙栫爜,鐢ㄤ簬澶勭悊Html Form璇鋒眰鍙傛暟鐨勪腑鏂囬棶棰?br />聽*/
public class CharacterEncodingFilter
聽implements Filter
{
聽protected FilterConfig filterConfig = null;
聽protected String encoding = "";

聽public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
聽{
聽聽聽聽聽聽聽 if(encoding != null)
聽聽聽聽聽聽聽聽 servletRequest.setCharacterEncoding(encoding);
聽聽聽聽聽聽聽聽filterChain.doFilter(servletRequest, servletResponse);
聽}

聽public void destroy()
聽{
聽聽filterConfig = null;
聽聽encoding = null;
聽}

聽聽聽 public void init(FilterConfig filterConfig) throws ServletException
聽{
聽聽聽聽聽聽聽聽聽this.filterConfig = filterConfig;
聽聽聽聽聽聽聽 this.encoding = filterConfig.getInitParameter("encoding");

聽}
}

鍥涖佽祫婧愪繚鎶よ繃婊ゅ櫒

package catalog.view.util;

import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
import java.util.HashSet;
//
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* This Filter class handle the security of the application.
*


* It should be configured inside the web.xml.
*
* @author Derek Y. Shen
*/
public class SecurityFilter implements Filter {
//the login page uri
private static final String LOGIN_PAGE_URI = "login.jsf";

//the logger object
private Log logger = LogFactory.getLog(this.getClass());

//a set of restricted resources
private Set restrictedResources;

/**
* Initializes the Filter.
*/
public void init(FilterConfig filterConfig) throws ServletException {
this.restrictedResources = new HashSet();
this.restrictedResources.add("/createProduct.jsf");
this.restrictedResources.add("/editProduct.jsf");
this.restrictedResources.add("/productList.jsf");
}

/**
* Standard doFilter object.
*/
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
this.logger.debug("doFilter");

String contextPath = ((HttpServletRequest)req).getContextPath();
String requestUri = ((HttpServletRequest)req).getRequestURI();

this.logger.debug("contextPath = " + contextPath);
this.logger.debug("requestUri = " + requestUri);

if (this.contains(requestUri, contextPath) && !this.authorize((HttpServletRequest)req)) {
this.logger.debug("authorization failed");
((HttpServletRequest)req).getRequestDispatcher(LOGIN_PAGE_URI).forward(req, res);
}
else {
this.logger.debug("authorization succeeded");
chain.doFilter(req, res);
}
}

public void destroy() {}

private boolean contains(String value, String contextPath) {
Iterator ite = this.restrictedResources.iterator();

while (ite.hasNext()) {
String restrictedResource = (String)ite.next();

if ((contextPath + restrictedResource).equalsIgnoreCase(value)) {
return true;
}
}

return false;
}

private boolean authorize(HttpServletRequest req) {

//澶勭悊鐢ㄦ埛鐧誨綍
/* UserBean user = (UserBean)req.getSession().getAttribute(BeanNames.USER_BEAN);

if (user != null && user.getLoggedIn()) {
//user logged in
return true;
}
else {
return false;
}*/
}
}



]]>
主站蜘蛛池模板: 久久久久亚洲精品无码网址| **aaaaa毛片免费| 免费看国产曰批40分钟| 亚洲天然素人无码专区| 成人无码区免费视频观看| 亚洲国产精品网站久久| 日韩精品极品视频在线观看免费| 亚洲国产精品无码久久一区二区| 免费福利在线视频| 久久亚洲国产中v天仙www| 久久福利青草精品资源站免费| 亚洲AV永久无码精品一百度影院| 久久ww精品w免费人成| 亚洲中字慕日产2021| 成人免费午间影院在线观看| 色婷婷六月亚洲综合香蕉| 亚洲国产成人a精品不卡在线| sihu国产精品永久免费| 亚洲大尺度无码无码专区| 在线免费观看国产| 亚洲综合一区国产精品| 亚洲成片观看四虎永久| 成在人线av无码免费高潮水| 337p日本欧洲亚洲大胆艺术| 免费观看的毛片大全| 亚洲av日韩av永久无码电影 | 一级特黄a免费大片| 国产亚洲无线码一区二区| 精品一区二区三区免费毛片爱 | 精品久久久久久亚洲精品| 午夜dj免费在线观看| 国产日韩久久免费影院| 亚洲黄色中文字幕| 日韩免费视频播放| a级毛片黄免费a级毛片| 亚洲综合伊人制服丝袜美腿| 亚洲欧洲日本在线| 无码乱肉视频免费大全合集| 无码 免费 国产在线观看91| 亚洲视频在线免费看| 四虎永久在线精品免费观看地址|