javaÓ¦ÓÃtomcatʵÏÖhttps ssl°²È«Á¬½ÓµÄ·½·¨
ÔÚÕ⿪ʼ֮ǰ£¬ÎÒÃǵÃÏÈÁ˽âÒ»ÏÂʲôÊÇhttps¡£
https (Secure Hypertext Transfer Protocol) = °²È«³¬Îı¾´«ÊäÐÒé
httpsµÄÌصãÊÇ£º
1.Êý¾Ý¼ÓÃÜ£¨SSL£© = Secure Socket Layer
2.Éí·ÝÈÏÖ¤
µ±ÄãµÄÏîÄ¿ÐèÒª¿¼ÂÇ°²È«ÐÔµÄʱºò£¬²¿·ÖÄ£¿é¿ÉÒÔÓõ½https¡£µ±È»ÕâЩ¶¼µÃµ½CA×¢²á£¬ÒªÇ®Ç®µÄŶ¡£
ÕâÀïÎÒÏë¸ø´ó¼Ò½éÉܸö²»Êշѵġ£ÓÃJDKµÄkeytool¹¤¾ßÉú³ÉÖ¤Ê顢ȻºóÔÚTomcatÏÂÅäÖÃserver.xml£¬¾Í¿ÉÒÔʵÏÖhttps£¬¶Ô´«ÊäµÄË«ÏòÊý¾Ý½øÐмÓÃܺͽâÃÜ¡£
Ë«ÏòµÄ¼ÓÃܽâÃܹý³Ì£º
ÓÃTomcatÀ´ÅäÖÃSSLÖ÷ÒªÓÐÏÂÃæÕâôÁ½´ó²½Ö裺
Ò»¡¢Éú³ÉÖ¤Êé
1.ÔÚÃüÁîÐÐÏÂÖ´ÐУº
%Java_home%\bin\keytool -genkey -alias tomcat -keyalg RSA
ÔÚ´ËÃüÁîÖУ¬keytoolÊÇJDK×Ô´øµÄ²úÉúÖ¤ÊéµÄ¹¤¾ß¡£°ÑRSAÔËËã·¨Ôò×÷ΪÖ÷Òª°²È«ÔËËã·¨Ôò£¬Õâ±£Ö¤ÁËÓëÆäËü·þÎñÆ÷ºÍ×é¼þµÄ¼æÈÝÐÔ¡£
Õâ¸öÃüÁî»áÔÚÓû§µÄhome directory²úÉúÒ»¸ö½Ð×ö" .keystore " µÄÐÂÎļþ¡£ÔÚÖ´Ðкó£¬ÄãÊ×Ïȱ»ÒªÇó³öʾkeystoreÃÜÂë¡£TomcatʹÓõÄĬÈÏÃÜÂëÊÇ" changeit "(È«¶¼ÊÇСд×Öĸ)£¬Èç¹ûÄãÔ¸Ò⣬Äã¿ÉÒÔÖ¸¶¨Äã×Ô¼ºµÄÃÜÂë¡£Ä㻹ÐèÒªÔÚserver.xmlÅäÖÃÎļþÀïÖ¸¶¨×Ô¼ºµÄÃÜÂ룬ÕâÔÚÒÔºó»áÓÐÃèÊö¡£
Èç¹ûÒ»ÇÐ˳Àû£¬ÄãÏÖÔÚ¾ÍÓµÓÐÁËÒ»¸ö¿ÉÒÔ±»ÄãµÄ·þÎñÆ÷ʹÓõÄÓÐÈÏÖ¤ÊéµÄkeystoreÎļþ¡£
¶þ¡¢ÅäÖÃtomcat
µÚ¶þ¸ö´ó²½ÖèÊÇ°Ñsecure socketÅäÖÃÔÚ$CATALINA_HOME/conf/server.xmlÎļþÀï¡£$CATALINA_HOME´ú±í°²×°TomcatµÄĿ¼¡£Ò»¸öÀý×ÓÊÇSSLÁ¬½ÓÆ÷µÄÔªËر»°üÀ¨ÔÚºÍTomcatÒ»Æð°²×°µÄȱʡserver.xmlÎļþÀï¡£Ëü¿´ÆðÀ´ÏóÊÇÕâÑù£º
$CATALINA_HOME/conf/server.xml
< -- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
< !--
< Connector
port="8888" minProcessors="5" maxProcessors="75"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100" debug="0" scheme="https" secure="true";
clientAuth="false" sslProtocol="TLS"/>
-->
ConnectorÔªËر¾Éí£¬ÆäĬÈÏÐÎʽÊDZ»×¢Ê͵ôµÄ(commented out)£¬ËùÒÔÐèÒª°ÑËüÖÜΧµÄ×¢Êͱê־ɾ³ýµô¡£È»ºó£¬¿ÉÒÔ¸ù¾ÝÐèÒª¿Í»§»¯(×Ô¼ºÉèÖÃ)Ìض¨µÄÊôÐÔ¡£Ò»°ãÐèÒªÔö¼ÓÒ»ÏÂkeystoreFileºÍkeystorePassÁ½¸öÊôÐÔ£¬Ö¸¶¨Äã´æ·ÅÖ¤ÊéµÄ·¾¶£¨È磺keystoreFile="D:/shu/.keystore"£©ºÍ¸Õ²ÅÉèÖõÄÃÜÂ루È磺keystorePass="123456"£©¡£
ÔÚÍê³ÉÕâЩÅäÖøü¸Äºó£¬±ØÐëÏóÖØÐÂÆô¶¯Tomcat£¬È»ºóÄã¾Í¿ÉÒÔͨ¹ýSSL·ÃÎÊTomcatÖ§³ÖµÄÈκÎwebÓ¦ÓóÌÐò¡£Ö»²
Ïà¹ØÎĵµ£º
×î½üÒªÖØÐÂѧϰJava£¬ÕÒ¸öÀý×ÓÀ´Êµ¼ù£¬ÔÚÍøÉÏÕÒÁ˺ܶàÀý³ÌÀ´¿´£¬×Ô¼ºÖØбàдÁËÒ»¸ö̰ʳÉßµÄÀý×Ó£¬¼ÇÔÚÕâÀï¡£
1.SnakeModel.java
import java.util.Observable;
import java.util.LinkedList;
import java.util.Arrays;
import java.util.Random;
import javax.swing.*;
//ObservableÀàÒ»°ã´ú±íÊý¾Ý£¬ÊµÏÖ½Ó¿ÚRunna ......
1. Ê×ÏÈString²»ÊôÓÚ8ÖÖ»ù±¾Êý¾ÝÀàÐÍ£¬StringÊÇÒ»¸ö¶ÔÏó¡£
¡¡¡¡ÒòΪ¶ÔÏóµÄĬÈÏÖµÊÇnull£¬ËùÒÔStringµÄĬÈÏÖµÒ²ÊÇnull£»µ«ËüÓÖÊÇÒ»ÖÖÌØÊâµÄ¶ÔÏó£¬ÓÐÆäËü¶ÔÏóûÓеÄһЩÌØÐÔ¡£
¡¡¡¡2. new String()ºÍnew String(“”)¶¼ÊÇÉêÃ÷Ò»¸öеĿÕ×Ö·û´®£¬ÊÇ¿Õ´®²»ÊÇnull£»
¡¡¡¡3. String str=”kvill”£»
......
¹¤×÷ÒѾÓаëÄêÁË£¬Í»È»Ïëдµã¶«Î÷£¬´óѧµÄʱºò¾ÍÓÐдÈռǵÄÏ°¹ß£¬µ«ÊÇ×Ô´ÓÈ¥Java06°àѧϰһֱµ½ÏÖÔÚ¹¤×÷£¬ÂýÂýµÄҲûÓÐʱ¼äȥдÈռǣ¬Ï£Íûͨ¹ýÕâƪÎÄÕÂÄÜÈÃJava˽ÛÓµÄѧµÜѧÃÃÃÇ¿´ÁËÓÐËù°ïÖú¡£
ÏàÐźܶàͬѧºÜÎÒÒ»Ñù´óËĵÄʱºò¶¼±È½ÏÃÔ㣬ÓÈÆäÊÇÎÒ¶ÁµÄ¼ÆËã»úרҵ£¬ËµÊµ»°´óѧÀïѧµÄºÍÉç»áʵ¼ÊÐèÒªµÄ» ......
1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢ ......