Java»ñÈ¡ÇëÇó¿Í»§¶ËµÄÕæʵIPµØÖ·
ͨ³£Í¨¹ýrequest.getRemoteAddr()
È¡µÃ¿Í»§¶ËµÄIPµØÖ·£¬×ö¼øȨºÍУÑ飬Â߼ûÎÊÌ⣬ÄÇô¿Ï¶¨request.getRemoteAddr()³öÁËÎÊÌ⣬googleÏ£¬·¢ÏÖÓÐÈËÓöµ½ÀàËƵÄÎÊÌâ¡£
×îÖÕ¶¨Î»Îªrequest.getRemoteAddr()ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache,SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110:2046/
µÄURL·´Ïò´úÀíΪhttp://www.xxx.com/
µÄURLʱ£¬ÓÃrequest.getRemoteAddr()
·½·¨»ñÈ¡µÄIPµØÖ·ÊÇ£º127.0.0.1¡¡»ò¡¡192.168.1.110£¬¶ø²¢²»ÊÇ¿Í»§¶ËµÄÕæʵ£É£Ð¡£
¾¹ý´úÀíÒÔºó£¬ÓÉÓÚÔÚ¿Í»§¶ËºÍ·þÎñÖ®¼äÔö¼ÓÁËÖмä²ã£¬Òò´Ë·þÎñÆ÷ÎÞ·¨Ö±½ÓÄõ½¿Í»§¶ËµÄIP£¬·þÎñÆ÷¶ËÓ¦ÓÃÒ²ÎÞ·¨Ö±½Óͨ¹ýת·¢ÇëÇóµÄµØÖ··µ»Ø¸ø¿Í»§¶Ë¡£µ«ÊÇÔÚת·¢ÇëÇóµÄHTTPÍ·ÐÅÏ¢ÖУ¬Ôö¼ÓÁËX£FORWARDED£FOR
ÐÅÏ¢ÓÃÒÔ¸ú×ÙÔÓеĿͻ§¶ËIPµØÖ·ºÍÔÀ´¿Í»§¶ËÇëÇóµÄ·þÎñÆ÷µØÖ·¡£
Java´úÂë
public String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
i
Ïà¹ØÎĵµ£º
jarÎļþÌý˵¹ýÂð£¬Ã»ÓУ¿»òÕßÄ°Éú£¡ºÃ£¬Ã»¹Øϵ£¬Õâ¾ÍÊÇÎÒÃǵĵÚÒ»Õ¾£º´ò°ü·¢²¼¡£
Ϊʲô»áÓÐÕâ¸öÍæÒâÄØ£¬Ê×ÏÈ£¬ÕâÊÇjarµÄÈ«³Æ£ºJavaTM Archive (JAR) file£¬Êǵģ¬¾ÍÊÇjava´æµµÎļþ¡£ÕâÓеãÀàËÆzipÎļþ£¬ÏëÒ»ÏëËüÊǸÉʲôµÄÓõÄÄØ£¬Ñ¹Ëõ£¡£¿Ã»´í¾ÍÊÇҪѹËõ£¬½«ÎÒÃÇÔÏÈÁãÉ¢µÄ¶«Î÷·Åµ½Ò»Ï£¬ÖØÐÂ×éÖ¯£¬ËùÓÐÕâЩĿµÄÖ»ÓÐÒ» ......
1.ÕûÊý
byte 1×Ö½Ú
short 2×Ö½Ú
int 4×Ö½Ú
long 8×Ö½Ú
2.¸¡µã
float
double
Ìáʾ
£¨1£© ¸¡µãÐ͵ÄÖµ£¬Èç¹ûûÓÐÌرðÖ¸Ã÷£¬Ä¬ÈÏÊÇ double Ð͵Ä
£¨2£© ¶¨Òå float Ð͵Äʱºò£¬Ò»¶¨ÒªÖ¸Ã÷ÊÇ float Ð͵ģ¬¿ÉÒÔͨ¹ýÔÚÊý×ÖºóÃæÌí¼Ó&rd ......
¸ÄÒ»¸öÕâÑùµÄÌâÄ¿Õýʽ¸æËßÄ㣬ÎÒÖÕÓÚ¶¯ÊּǼһЩjavaµÄ±Ê¼ÇÁË¡£ÊµÔںܾÃûÓÐдjavaÁË¡£¹þ¹þ£¬²»ºÃÒâ˼£¬ÎªÁËflash ºǫ́ÓиöÖ§³Ö£¬java Õⲿ·Ö»¹ÊÇҪѧһµã£¬µ«²»ÊǺÜÖصãѧ¡£Õⲿ·Ö¶«Î÷£¬ÎÒ²»ÊìϤ£¬Ò²ÔÚÂýÂý¼Ç¼¡£×Ô¼º¿´µÄ±Ê¼Ç£¬ËùÒÔÒªÊÇÄã²»ÊÇɵB£¬×îºÃ²»Òª¿´¡£
ÔÚ½ñÍíÁ·Ï°µÄʱºò£¬³¢ÊÔÈ¥Á¬½Ó¿É°®µÄ ......
---------------------------------------
Asp.Net,C#,SQL,JS,WCF,AJAX,¹¤×÷Á÷,WPF,MVC,LINQ,Éè¼Æģʽ(¼Ü¹¹)µÈ¼¼ÊõÌÖÂÛ
“ASP.NET(C#)Fans” QQȺ£º96877690
---------------------------------------
²»¹ÜÊÇJ2SE¡¢J2EE»¹ÊÇJ2ME¾´Çë¼ÓÈ룡Eclipse¡¢NetBeans
Java½»Á÷QQ¸ß¼¶ÈºÀ©ÕУº96878255 ......
JAVAÓïÑÔÖеķ´Éä»úÖÆ£º
ÔÚJava ÔËÐÐʱ »·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿
¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ÷ÓÃËûµÄ·½·¨£¿ÕâЩ´ð°¸Êǿ϶¨µÄ£¬ÕâÖÖ¶¯Ì¬»ñÈ¡ÀàµÄÐÅÏ¢£¬ÒÔ¼°¶¯Ì¬µ÷ÓÃÀàµÄ·½·¨µÄ¹¦ÄÜÀ´Ô´ÓÚJAVAµÄ·´Éä¡£´Ó¶øʹjava¾ßÓж¯Ì¬ÓïÑÔµÄÌØÐÔ¡£
JAVA·´É ......