年底收藏系列 Java Web工具CookieSupport
/*
* CookieSupport.java
* Copyright (C) 2007-3-19 <JustinLei@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
package org.lambdasoft.web.support;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.lambdasoft.utils.StringUtils;
/**
* @author TangLei <justinlei@gmail.com>
* @date 2008-12-17
*/
public class CookieSupport {
private CookieSupport() {
}
/**
* 写cookies
*
* @param response
* @param cookieParams
* @param maxAge
*/
public static final void writeCookies(HttpServletResponse response,
Map<String, String> cookieParams, int maxAge) {
if (cookieParams == null || cookieParams.size() == 0)
return;
Set<String> keySet = cookieParams.keySet();
for (String key : keySet) {
Cookie cookie = new Cookie(key, cookieParams.get(key));
cookie.setMaxAge(maxAge);
response.addCookie(cookie);
}
}
/**
* 删除所有的cookies
* @param request
* @param response
*/
public static final void removeAllCookies(HttpServletRequest request,HttpServletResponse response) {
Cookie[] cookies = request.getCookies();
if(cookies == null || cookies.length == 0)
相关文档:
最近在找一些笔试题,因为快找工作了。。
题目如下:
问答题
1.数据连接池的工作机制
2.Struts标签中<html:errors>的作用是什么
3.Tomcat<CATALINA_HOME>根目录下\server,\common,\shared以及\WEB-INF下的lib中的jar文件在使用时的区别。
填空题 &n ......
from Rxtx
This page is for general content regarding the use of rxtx. Feel free to add your own content.
Using RXTX In Eclipse
Deploying JAVA with RXTX
I wrote an app several months ago using javax.comm on windows. Sun has left me high and dry. rxtx help!
download ftp://ftp.qbang.org/pub/rx ......
1. 字符串有整型的相互转换
Java代码
String a = String.valueOf(2); //integer to numeric string
int i = Integer.parseInt(a); //numeric string to an int
2. 向文件末尾添加内容
Java代码
BufferedWriter out = null;
try {
out = new BufferedWriter(new FileWr ......
1.what is oracle.
2.what is major differenece oracle8i and oracle9i.
4.tell me some thing ur self.
5.please tell me about oops.
6.what is single inheritance.
7.what is multiple inheritance.
8.can java support multiple inheritance.
9.what is interface.
10.what is differenec between abstract c ......
import java.util.Random;
/**
* 排序测试类
*
* 排序算法的分类如下:
* 1.插入排序(直接插入排序、折半插入排序、希尔排序);
* 2.交换排序(冒泡泡排序、快速排序);
* 3.选择排序(直接选择排序、堆排序);
* 4.归并排序;
* 5.基数排序。
&nbs ......