锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲成人精品久久,亚洲性天天干天天摸,亚洲日本一区二区http://m.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://m.tkk7.com/Jiangzy/articles/104125.html椋涢洩(leo)椋涢洩(leo)Thu, 15 Mar 2007 16:28:00 GMThttp://m.tkk7.com/Jiangzy/articles/104125.htmlhttp://m.tkk7.com/Jiangzy/comments/104125.htmlhttp://m.tkk7.com/Jiangzy/articles/104125.html#Feedback0http://m.tkk7.com/Jiangzy/comments/commentRss/104125.htmlhttp://m.tkk7.com/Jiangzy/services/trackbacks/104125.html闃呰鍏ㄦ枃

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

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

/**
聽* 鐢ㄤ簬鐨勪嬌 Browser 涓嶇紦瀛橀〉闈㈢殑榪囨護(hù)鍣?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
聽{
聽}
}

浜屻佹嫻嬬敤鎴鋒槸鍚︾櫥闄嗙殑榪囨護(hù)鍣?/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;

/**
聽* 鐢ㄤ簬媯嫻嬬敤鎴鋒槸鍚︾櫥闄嗙殑榪囨護(hù)鍣紝濡傛灉鏈櫥褰曪紝鍒欓噸瀹氬悜鍒版寚鐨勭櫥褰曢〉闈?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());
聽聽聽}
聽聽}
聽}
}

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

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

/**
聽* 鐢ㄤ簬璁劇疆 HTTP 璇鋒眰瀛楃緙栫爜鐨勮繃婊ゅ櫒錛岄氳繃榪囨護(hù)鍣ㄥ弬鏁癳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;
}*/
}
}



]]>
主站蜘蛛池模板: 67194成是人免费无码| 大妹子影视剧在线观看全集免费| 2021在线观看视频精品免费| 亚洲av无码潮喷在线观看| a级日本高清免费看| 亚洲真人无码永久在线| 成人免费乱码大片A毛片| 亚洲精品乱码久久久久久自慰| 一个人看的www在线免费视频| 久久综合亚洲色HEZYO国产| 水蜜桃视频在线观看免费播放高清| 亚洲真人无码永久在线| 99国产精品视频免费观看| 中文字幕乱码亚洲精品一区| 97在线观看永久免费视频| 亚洲资源最新版在线观看| 精品国产麻豆免费网站| 日韩免费码中文在线观看| 亚洲色精品aⅴ一区区三区| 国产精品偷伦视频观看免费| 久久久亚洲欧洲日产国码是AV| 亚洲一区二区免费视频| 亚洲爆乳大丰满无码专区| 亚洲欧洲自拍拍偷精品 美利坚 | 97人妻精品全国免费视频| 亚洲AV日韩AV天堂一区二区三区| 国产午夜无码精品免费看动漫| 亚洲人成影院在线| 67194成是人免费无码| xvideos永久免费入口| 无码乱人伦一区二区亚洲| 一二三四视频在线观看中文版免费| 亚洲AV永久无码精品一福利| 中文字幕亚洲日本岛国片| h视频在线免费看| 色噜噜噜噜亚洲第一| 亚洲av成人无码久久精品| 成人免费视频一区二区三区| 免费观看四虎精品成人| 麻豆亚洲av熟女国产一区二| 日本免费电影一区|