Java¹ýÂËÆ÷ÑéÖ¤µÇ¼Óû§
1.Ê×ÏÈдһ¸öȨÏÞ¹ýÂËfilterÀà,ʵÏÖFilter½Ó¿Ú
/*Ê×ÏÈдһ¸öȨÏÞ¹ýÂËfilter*/
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.FilterChain;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
public class RightFilter
implements Filter {
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
HttpSession session = req.getSession(true);
String path = req.getRequestURI();
//´ÓsessionÀïÈ¡µÄÓû§ÃûÐÅÏ¢
String username = (String) session.getAttribute("username");
for (int i = 0; i < Constants.NoFilter_Pages.length; i++) {
if (path.indexOf(Constants.NoFilter_Pages[i]) > -1) {
chain.doFilter(req, res);
return;
}
}
//ÅжÏÈç¹ûûÓÐÈ¡µ½Óû§ÐÅÏ¢,¾ÍÌøתµ½µÇ½ҳÃæ
if (username == null || "".equals(username)) {
//Ìøתµ½µÇ½ҳÃæ
res.sendRedirect(" http://"+req.getHeader("Host")+"/login.jsp ");//ÕâÀïÊÇ·µ»ØÓòÃûµÄ¸ùĿ¼µØÖ·£¬ÈôÖ±½Ó·µ»Øµ±Ç°µÄĿ¼ÏµÄÎļþ£¬ÔòÓÃres.sendRedirect("/login.jsp")
}
else {
//ÒѾµÇ½,¼ÌÐø´
Ïà¹ØÎĵµ£º
ÎÄÕÂÀïÓÐһЩ±í¸ñ£¬javaeyeµÄÌûºÃÏñ²»Ö§³Ö±í¸ñÐÎʽ£¬ÓÐÐËȤ¿ÉÒÔµ½ÎÒµÄblog¿´¿´¡£
http://hzxdark.javaeye.com
Ò»£®JPCAP¼ò½é
ÖÚËùÖÜÖª£¬JAVAÓïÑÔËäÈ»ÔÚTCP/UDP´«Êä·½Ãæ¸øÓèÁËÁ¼ºÃµÄ¶¨Ò壬µ«¶ÔÓÚÍøÂç²ãÒÔϵĿØÖÆ£¬È´ÊÇÎÞÄÜΪÁ¦µÄ¡£JPCAPÀ©Õ¹°üÃÖ²¹ÁËÕâÒ»µã¡£
JPCAPʵ¼ÊÉϲ¢·ÇÒ»¸öÕæÕýȥʵÏÖ¶ÔÊý¾ÝÁ´Â·²ãµÄ¿ØÖÆ£¬¶øÊ ......
public class Test{
public static String addBigNum(String str1,String str2){
//ÕÒ³öÁ½×Ö·û´®µÄ³¤¶Ì£¬·½±ãºó±ßÒýÓã»
String longer = str1.length() > str2.length()? str1 : str2;
String shorter = str1.length( ......
ÓÉÓÚFlex Builder compiler shellÓÐmemory leakµÄÎÊÌ⣬ ¶øSDKĬÈÏµÄµÄ JVM heap size Ö»ÓÐ312M£¬µ±compile±È½Ï´óµÄprojectÈÝÒײ»¹»£¬ËùÒÔÖ»ÒªÐÞ¸ÄSDKµÄJVM²ÎÊý¾Í¿ÉÒÔ¡£
±à¼ {Flex SDK}/bin/jvm.config ÎļþÈçÏ¡£
java.args=-Xmx512m ...
Èç¹û»¹ÊÇÓÐError£¬¿ÉÒÔÔö¼Óµ½1024»òÕ߸ü¶à¡£ ......
package testPackage;
class Test {
public static void main(String[] args) {
String hello = "Hello", lo = "lo";
System.out.print((hello == "Hello") + " ");
System.out.print((Other.hello == hello) + " ");
System.out.print((other.Other.hello == hello) + " ");
System.out.print((hello == ("Hel"+"lo ......