Java»ñÈ¡ÇëÇó¿Í»§¶ËµÄÕæʵIPµØÖ·
ת×Ô http://blog.csdn.net/foamflower/archive/2009/10/29/4744862.aspx
ÏñÒƶ¯Íø¹ØÒ»Ñù£¬iisforwardÕâ¸öISAPI¹ýÂËÆ÷Ò²»á¶Ôrequest¶ÔÏó½øÐÐÔÙ°ü×°£¬¸½¼ÓһЩWLSÒªÓõÄÍ·ÐÅÏ¢¡£ÕâÖÖÇé¿öÏ£¬Ö±½ÓÓÃrequest.getRemoteAddr()
ÊÇÎÞ·¨È¡µ½ÕæÕýµÄ¿Í»§IPµÄ¡£
ʵ¼ÊµÄiisforward¸½¼ÓÍ·ÈçÏ£º
WL-Proxy-Client-IP=211.161.1.239
Proxy-Client-IP=211.161.1.239
X-Forwarded-For=211.161.1.239
WL-Proxy-Client-Keysize=
WL-Proxy-Client-Secretkeysize=
X-WebLogic-Request-ClusterInfo=true
X-WebLogic-KeepAliveSecs=30
X-WebLogic-Force-JVMID=-327089098
WL-Proxy-SSL=false
×ÛÉÏ£¬ÕýÈ·×÷·¨ÈçÏ£º
private String getIpAddr() {
String ipAddress = null;
//ipAddress = this.getRequest().getRemoteAddr();
ipAddress = this.getRequest().getHeader("x-forwarded-for");
if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = this.getRequest().getHeader("Proxy-Client-IP");
}
if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = this.getRequest().getHeader("WL-Proxy-Client-IP");
}
if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = this.getRequest().getRemoteAddr();
if(ipAddress.equals("127.0.0.1")){
//¸ù¾ÝÍø¿¨È¡±¾»úÅäÖõÄIP
InetAddress inet=null;
try {
inet = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
&n
Ïà¹ØÎĵµ£º
javaÐĵã¡--ºÜºÃµÄjavaѧϰÀú³Ì£¨×ª×ÔÕŹú±¦£© ÊÕ²Ø ´ËÎÄÓÚ2009-10-26±»ÍƼöµ½CSDNÊ×Ò³
ÈçºÎ±»ÍƼö£¿
1. Êý×éÓÐûÓÐlength()Õâ¸ö·½·¨? StringÓÐûÓÐlength()Õâ¸ö·½·¨£¿
´ð£ºÊý×éûÓÐlength()Õâ¸ö·½·¨£¬ÓÐlengthµÄÊôÐÔ¡£
......
×î½üÏîÄ¿½ø¶È±È½Ï»ºÂý£¬³õ²½Ñо¿ÁËÒ»ÏÂOracleµÄ´æ´¢¹ý³Ì£¬½«´úÂëÌù³öÀ´¡£
Ê×ÏÈÏÈÌù³öÀ´OracleµÄ·ÖÒ³·ÖÒ³´æ´¢¹ý³Ì´úÂë°É¡£
1.ÕâÊÇ°üµÄ´úÂë
create or replace package DB_Oper is
-- Author : LIUBING
-- Created : 2009-10-28 15:01:30
-- Purpose : ²âÊÔOracleµ ......
Java ¶ÔÎļþ½øÐжÁд²Ù×÷µÄÀý×Ӻܶ࣬ÈóõѧÕ߸е½Ê®·ÖÀ§»ó£¬ÎÒ¾õµÃÓбØÒª½«¸÷ÖÖ·½·¨½øÐÐ
Ò»´Î·ÖÎö£¬¹éÀ࣬ÀíÇ岻ͬ·½·¨Ö®¼äµÄÒìͬµã¡£
Ò»£®ÔÚ JDK 1.0 ÖУ¬Í¨³£ÊÇÓà InputStream & OutputStream ÕâÁ½¸ö»ùÀàÀ´½øÐжÁд²Ù×÷µÄ¡£
InputStream ÖÐµÄ FileInputStream ÀàËÆÒ»¸öÎļþ¾ä±ú£¬Í¨¹ýËüÀ´¶ÔÎļþ½øÐвÙ×÷£¬ÀàËÆ ......
1.JVMµÄgc¸ÅÊö
¡¡¡¡gc¼´À¬»øÊÕ¼¯»úÖÆÊÇÖ¸jvmÓÃÓÚÊÍ·ÅÄÇЩ²»ÔÙʹÓõĶÔÏóËùÕ¼ÓõÄÄÚ´æ¡£javaÓïÑÔ²¢²»ÒªÇójvmÓÐgc£¬Ò²Ã»Óй涨gcÈçºÎ¹¤×÷¡£²»¹ý³£ÓõÄjvm¶¼ÓÐgc£¬¶øÇÒ´ó¶àÊýgc¶¼Ê¹ÓÃÀàËƵÄËã·¨¹ÜÀíÄÚ´æºÍÖ´ÐÐÊÕ¼¯²Ù×÷¡£
¡¡¡¡ÔÚ³ä·ÖÀí½âÁËÀ¬»øÊÕ¼¯Ëã·¨ºÍÖ´Ðйý³Ìºó£¬²ÅÄÜÓÐЧµÄÓÅ»¯ËüµÄÐÔÄÜ¡£ÓÐЩÀ¬»øÊÕ¼¯×¨ÓÃÓÚÌØÊâµÄ ......