锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲成人精品久久,亚洲性天天干天天摸,亚洲日本一区二区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 涓嶇紦瀛橀〉闈㈢殑榪囨護(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;
}*/
}
}



]]>
主站蜘蛛池模板: 国产自偷亚洲精品页65页| 免费看国产精品3a黄的视频| 日本免费一区二区三区最新| 亚洲一区二区三区免费在线观看| 久久国产色AV免费观看| 亚洲高清不卡视频| 久草视频免费在线观看| 亚洲国产理论片在线播放| 日日麻批免费40分钟日本的| 中文字幕乱码亚洲精品一区 | 久久久久亚洲精品天堂| 久久久久成人片免费观看蜜芽| 亚洲国产精品一区二区成人片国内 | 一级毛片**免费看试看20分钟| 亚洲精品国自产拍在线观看| 国产黄色片免费看| 久久被窝电影亚洲爽爽爽| 久久精品无码专区免费青青| 久久精品国产亚洲av麻豆蜜芽 | 蜜臀91精品国产免费观看| 亚洲av无码专区国产不乱码 | 精品无码免费专区毛片| 久久狠狠爱亚洲综合影院| 日韩在线视频免费看| 国产日韩精品无码区免费专区国产 | 亚洲色图.com| 黄网址在线永久免费观看| 男女污污污超污视频免费在线看| 国产美女亚洲精品久久久综合| 美女视频黄a视频全免费网站色窝| 亚洲视频在线观看视频| 免费高清资源黄网站在线观看| eeuss在线兵区免费观看| 亚洲国产成人久久精品影视| 成年在线观看免费人视频草莓| 高h视频在线免费观看| 久久久久亚洲AV成人无码| 成全视频免费高清| 一区二区视频免费观看| 亚洲国产av一区二区三区丶| 免费永久在线观看黄网站|