Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java È¡µÃ ¿Í»§¶ËIP

ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr£¨£©£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache£¬SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæÊµIPµØÖ·ÁË¡£
    Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110£º2046/ µÄURL·´Ïò´úÀíΪ
http://www.bt285.cn /
µÄURLʱ£¬ÓÃrequest.getRemoteAddr£¨£©·½·¨»ñÈ¡µÄIPµØÖ·ÊÇ£º127.0.0.1¡¡»ò¡¡192.168.1.110£¬¶ø²¢²»ÊÇ¿Í
»§¶ËµÄÕæÊµIP¡£

   
¾­¹ý´úÀíÒÔºó£¬ÓÉÓÚÔÚ¿Í»§¶ËºÍ·þÎñÖ®¼äÔö¼ÓÁËÖмä²ã£¬Òò´Ë·þÎñÆ÷ÎÞ·¨Ö±½ÓÄõ½¿Í»§¶ËµÄIP£¬·þÎñÆ÷¶ËÓ¦ÓÃÒ²ÎÞ·¨Ö±½Óͨ¹ýת·¢ÇëÇóµÄµØÖ··µ»Ø¸ø¿Í»§¶Ë¡£µ«ÊÇ
ÔÚת·¢ÇëÇóµÄHTTPÍ·ÐÅÏ¢ÖУ¬Ôö¼ÓÁËX£­FORWARDED£­FORÐÅÏ¢¡£ÓÃÒÔ¸ú×ÙÔ­ÓеĿͻ§¶ËIPµØÖ·ºÍÔ­À´¿Í»§¶ËÇëÇóµÄ·þÎñÆ÷µØÖ·¡£µ±ÎÒÃÇ·ÃÎÊ
http://www.5q520.cn /index.jsp/
ʱ£¬Æäʵ²¢²»ÊÇÎÒÃÇä¯ÀÀÆ÷ÕæÕý·ÃÎʵ½ÁË·þÎñÆ÷ÉϵÄindex.jspÎļþ£¬¶øÊÇÏÈÓÉ´úÀí·þÎñÆ÷È¥·ÃÎÊhttp://192.168.1.110£º2046
/index.jsp
£¬´úÀí·þÎñÆ÷ÔÙ½«·ÃÎʵ½µÄ½á¹û·µ»Ø¸øÎÒÃǵÄä¯ÀÀÆ÷£¬ÒòΪÊÇ´úÀí·þÎñÆ÷È¥·ÃÎÊindex.jspµÄ£¬ËùÒÔindex.jspÖÐͨ¹ý
request.getRemoteAddr£¨£©µÄ·½·¨»ñÈ¡µÄIPʵ¼ÊÉÏÊÇ´úÀí·þÎñÆ÷µÄµØÖ·£¬²¢²»Êǿͻ§¶ËµÄIPµØÖ·¡£

    ÓÚÊǿɵóö»ñµÃ¿Í»§¶ËÕæÊµIPµØÖ·µÄ·½·¨Ò»£º
Java code
public
String getRemortIP(HttpServletRequest request) {

if
(request.getHeader(
"
x-forwarded-for
"
)
==

null
) {

return
request.getRemoteAddr();
}

return
request.getHeader(
"
x-forwarded-for
"
);
}


    ¿ÉÊǵ±ÎÒ·ÃÎÊhttp://www.5a520.cn /index.jsp/
ʱ£¬·µ»ØµÄIPµØÖ·Ê¼ÖÕÊÇunknown£¬Ò²²¢²»ÊÇÈçÉÏËùʾµÄ127.0.0.1¡¡»ò¡¡192.168.1.110ÁË£¬¶øÎÒ·ÃÎÊ
http://192.168.1.110£º2046/index.jsp
ʱ£¬ÔòÄÜ·µ»Ø¿Í»§¶ËµÄÕæÊµIPµØÖ·£¬Ð´Á˸ö·½·¨È¥ÑéÖ¤¡£Ô­Òò³öÔÚÁËSquidÉÏ¡£squid.conf µÄÅäÖÆÎļþ¡¡forwarded_for
ÏîĬÈÏÊÇΪon£¬Èç¹û forwarded_for Éè³ÉÁË off ¡¡Ôò£ºX-Forwarded-For£º unknown

    ÓÚÊǿɵóö»ñµÃ¿Í»§¶ËÕæÊµIPµØÖ·µÄ·½·¨¶þ£º
Java code
public
String getIpAddr(HttpServletRequest request) {
String ip
=
request.getHeader(
"
x-forwarded-for
"
);

if
(ip
==

null

||


Ïà¹ØÎĵµ£º

Ê®¸ö×îºÃµÄJavaÐÔÄܹÊÕÏÅųý¹¤¾ß

ÉùÃ÷£ºJavaEyeÐÂÎÅÎÄÕµİæÈ¨ÊôÓÚJavaEyeÍøÕ¾ËùÓУ¬ÑϽûÈκÎÍøÕ¾×ªÔØ±¾ÎÄ£¬·ñÔò±Ø½«×·¾¿·¨ÂÉÔðÈΣ¡
ÍÆ¼öÊ®¸ö×îºÃµÄJavaÐÔÄܹÊÕÏÅųý¹¤¾ß£º
   1.jconsoleÊÇËæ×ÅJDK 1.5¶øÍƳöµÄ¡£ÕâÊÇÒ»¸öJava¼à²âºÍ¹ÜÀí¿ØÖÆÌ¨-JMX¼æÈݵÄͼÐι¤¾ßÀ´¼à²âJavaÐéÄâ»ú¡£ËüÄܹ»Í¬Ê±¼à²â±¾µØºÍÔ¶³ÌµÄJVMs¡£ÏêÇé¿É²é¿´£ºjconsole¹¤¾ß½ ......

java Ï̺߳ǫ́ÔËÐÐʾÀý

import java.io.IOException;
public class ResponseUI extends Thread{
private static volatile double d = 1;

public ResponseUI(){
super.setDaemon(true); //ÉèÖúǫ́ÔËÐÐ
start();
}

public void run(){
while(true){
d = d + (Math.E + Math.PI) / d;
}
}
/**
* @param args ......

Java Socket ±à³Ì

Ò»£¬ÍøÂç±à³ÌÖÐÁ½¸öÖ÷ÒªµÄÎÊÌâ
Ò»¸öÊÇÈçºÎ׼ȷµÄ¶¨Î»ÍøÂçÉÏһ̨»ò¶ą̀Ö÷»ú£¬ÁíÒ»¸ö¾ÍÊÇÕÒµ½Ö÷»úºóÈçºÎ¿É¿¿¸ßЧµÄ½øÐÐÊý¾Ý´«Êä¡£
ÔÚTCP/IPЭÒéÖÐIP²ãÖ÷Òª¸ºÔðÍøÂçÖ÷»úµÄ¶¨Î»£¬Êý¾Ý´«ÊäµÄ·ÓÉ£¬ÓÉIPµØÖ·¿ÉÒÔΨһµØÈ·¶¨InternetÉϵÄһ̨Ö÷»ú¡£
¶øTCP²ãÔòÌá¹©ÃæÏòÓ¦ÓõĿɿ¿µÄ»ò·Ç¿É¿¿µÄÊý¾Ý´«Êä»úÖÆ£¬ÕâÊÇÍøÂç±à³ÌµÄÖ÷Òª¶Ô ......

¡¶Java±à³ÌÄÇЩʶù¡·Ê鼮ǰÑÔºÍĿ¼

Java±à³ÌÄÇЩʶù 
×÷Õߣº³ÂÔ¾·å¡¢ÀîÖбò¡¢¹ÈæçÓÂ
ͼÊéÏêϸÐÅÏ¢£º
ISBN£º9787302214052
¶¨¼Û£º39Ôª
Ó¡´Î£º1-1
×°Ö¡£ºÆ½×°
Ó¡Ë¢ÈÕÆÚ£º2009-12-30
ͼÊé¼ò½é£º
±¾ÊéÒÔͨË×Ò×¶®µÄÓïÑԺʹúÂëʾÀý½éÉÜJavaÓïÑÔ±à³ÌµÄ¸÷ÖÖ֪ʶ£¬ÊÇÒ»±¾Ö¸µ¼³õѧÕß½øÐÐ×Ôѧ±à³Ì£¬²¢Í¨¹ýÏà¹ØÕ½ڸ½´øµÄÁ·Ï°ÈÚ»á¹áͨÏà¹Ø¼¼ÊõµÄÈëÃÅÊé¼®¡£ ......

ÎÒµÄJava×ܽá

1£® OverloadºÍOverrideµÄÇø±ð¡£OverloadedµÄ·½·¨ÊÇ·ñ¿ÉÒԸı䷵»ØÖµµÄÀàÐÍ
  ´ð£º·½·¨µÄÖØÐ´OverridingºÍÖØÔØOverloadingÊÇJava¶à̬ÐԵIJ»Í¬±íÏÖ¡£ÖØÐ´Overriding    ÊǸ¸ÀàÓë×ÓÀàÖ®¼ä¶à̬ÐÔµÄÒ»ÖÖ±íÏÖ£¬ÖØÔØOverloadingÊÇÒ»¸öÀàÖжà̬ÐÔµÄÒ»ÖÖ±íÏÖ¡£ Èç¹ûÔÚ×ÓÀàÖж¨Òåij·½·¨ÓëÆä¸¸ÀàÓÐÏàͬµÄÃû³ÆºÍ² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ