WHAT'S COOKIE
useful links :
1. what's session
¼¼¼ÇÀº ÀÏÁ¤ÇÑ ½Ã°£µ¿¾È¿¡ ¼ºí¸´¿¡ Á¢¼ÓÇÏ´Â »ç¿ëÀÚ(ºê¶ó¿ìÀú)¸¦
È®ÀÎÇÒ ÀÖ´Â ¹æ¹ýÀ» Á¦°øÇÕ´Ï´Ù.
Áï ¼ºí¸´ÀÌ ¾î¶° Ŭ¸®¾ðÆ®°¡ request¸¦ ÇÑ °ÍÀÎÁö¸¦ ¾Ë¼ö ÀÖÁÒ.
¼¼¼ÇÀ» Çϳª ¸¸µé¸é ¿©·¯ °³ÀÇ ¼ºí¸´¿¡¼ °øÀ¯Çؼ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
ÄíÅ°°¡ name=value Çü½ÄÀ¸·Î »ç¿ëµÇ´Â °Íó·³ ¼¼¼Çµµ
ÀÚ¹Ù ¿ÀºêÁ§Æ®¸¦ name=value Çü½ÄÀ¸·Î °¡Áú ¼ö ÀÖ½À´Ï´Ù.
ÄíÅ°¿Í ´Þ¸® °ªµéÀÌ ¼¹öÂÊ¿¡¼ °ü¸®µË´Ï´Ù.
¼¼¼ÇÀº ÄíÅ°¸¦ ÀÌ¿ëÇؼ ±¸ÇöµË´Ï´Ù. ¼¼¼ÇID°¡ ÄíÅ°·Î ÀúÀåµÇ°í
name=value´Â ¼¹ö¿¡ ÀúÀåµË´Ï´Ù.
ÄíÅ°¸¦ Áö¿øÇÏÁö ¾Ê´Â
ºê¶ó¿ìÀú¸¦ À§ÇÏ¿© Link¿¡ ¼¼¼Ç ID¸¦ ºÙ¿©¼ »ç¿ëÇÒ ¼ö µµ ÀÖ½À´Ï´Ù.
Áï ¼¼¼ÇÀ» ÀÌ¿ëÇϸé ÄíÅ°¸¦ Áö¿øÇÏÁö ¾Ê°Å³ª »ç¿ëÇÏÁö ¾Ê´Â ºê¶ó¿ìÀú¿¡¼µµ
¼¼¼Ç °ü¸®¸¦ ÇÒ ¼ö ÀÖ½À´Ï´Ù.
Àúµµ ¹è¿ì´Â ÁßÀ̶ó µÎ¼¾øÀÌ ¼³¸íÇ߳׿ä....
´ÙÀ½À» Âü°íÇÏ¸é µµ¿òÀÌ µÉ°Ì´Ï´Ù.
http://java.sun.com/docs/books/tutorial/servlets/client-state/index.html
2.setting cookie
Çѱ۷ΠencodingÀ» ¹Ù²Ù±â Àü¿¡ Mime type ¼³Á¤½Ã ´ÙÀ½°ú °°ÀÌ Çϼ¼¿ä
res.setContentType("text/html; charset=euc-kr");
PrintStream out = new PrintStream(res.getOutputStream());
±×¸®°í Cookie ¼³Á¤Àº Import ÇÑÈÄ
Cookie º¯¼ö ÁöÁ¤À» ÇÑ´ÙÀ½ ÄíÅ°°ªÀ» ¼³Á¤ÇÏ¸é µË´Ï´Ù.
import sun.servlet.http.Cookie;
.
..
Cookie c,c1;
c = new Cookie("userid","xxx");
c1= new Cookie("paswd","xxx");
c.setComment("cookie test");
c.saveCookie(res);
c1.saveCookie(res);
À§ÀÇ resº¯¼ö´Â HttpServletResponse parameterÀ롃 ¾Æ½ÃÁÒ
±×¸®°í ¿©±â °Ô½ÃÆÇ¿¡ °ü·ÃµÈ ³»¿ëµéÀÌ ¸¹ÀÌ ÀÖ½À´Ï´Ù.
Âü°íÇϼ¼¿ä
JSDK 2.0¿¡¼ÀÇ ÄíÅ° »ç¿ë¹ý
¿ì¼±, ´ÙÀ½Àº ±è¿ëÁø ´ÔÀÌ Á¦½ÃÇϽŠCookie »ç¿ë¹ýÀÔ´Ï´Ù.
import sun.servlet.http.Cookie;
.
..
Cookie c,c1;
c = new Cookie("userid","xxx");
c1= new Cookie("paswd","xxx");
c.setComment("cookie test");
c.saveCookie(res);
c1.saveCookie(res);
JSDK 2.0 ¹Ì¸¸À̳ª JWS 1.0.x ¸¦ »ç¿ëÇϽô ºÐµéÀº
À§¿¡ ó·³ ÇÏ¸é µË´Ï´Ù. (Àúµµ ±×·¯´Ï±î¿ä...)
±×·¯³ª, JSDK 2.0 À̳ª JWS 1.1.x ¸¦ »ç¿ëÇϽô ºÐµéÀº
¾Æ·¡ ó·³ Á¶±Ý °íÃÄ ÁÖ¾î¾ß ÇÕ´Ï´Ù.
import javax.servlet.http.Cookie; // Ŭ·¡½º Cookie ÀÇ ¼Ò¼ÓÀÌ ´Þ¶óÁ³À½.
.
..
Cookie c,c1;
c = new Cookie("userid","xxx");
c1= new Cookie("paswd","xxx");
c.setComment("cookie test");
// JSDK 2.0 ¿¡¼´Â
// Cookie.saveCookie ¸Þ½îµå¿Í Cookie.deleteCookie ¸Þ½îµå °¡ ¾ø¾îÁ³À¸¸ç,
// Cookie.saveCookie ´ë½Å¿¡ javax.servlet.http.HttpServletResponse.addCookie ¸Þ½îµå¸¦
// »ç¿ëÇØ¾ß ÇÑ´Ù.
res.addCookie(c);
res.addCookie(c1);
3. cookie¿¡ »ç¿ë ¸øÇÏ´Â ¹®ÀÚ
ºóÄÀº ÄíÅ°°ª¿¡ »ç¿ëÇÏÁö ¸øÇÏ´Â ¹®ÀÚ ÁßÀÇ ÇϳªÀÔ´Ï´Ù.
ºóÄÀÖ´Â ÄíÅ°°ª¿¡ »ý¼ºÇÒ·Á¸é
BASE64 ÀÎÄÚµùÀ̳ª URL ÀÎÄÚµù ÀÌ·±°É »ç¿ëÇÕ´Ï´Ù.
ÄíÅ° °¡Á® ¿Ã ¶§´Â ´ç¿¬È÷ µðÄÚµùÀ» ÇØ¾ß °ÚÁö¿ä...
4. save multiple cookies
JSDK2.0À» »ç¿ëÇÏÁö ¾Ê´Â°¡ º¸±º¿ä
c1.saveCookie(response);
´Â CookieÀÇ method¿¡ ¾ø´Â °ÍÀÌ´õ±º¿ä.
JSDK 2.0ÀÌ ÀÖÀ¸´Ï 2.0À» »ç¿ëÇϽÃÁö¿ä
¾Æ·¡¿Í °°ÀÌ »ç¿ëÇÏ¸é µË´Ï´Ù.
Cookie c1 = new Cookie("agdffgsdg","aaaaaaaaaaaaaaa");
Cookie c2 = new Cookie("b35354355","bbbbbbbbbbbbbbb");
Cookie c3 = new Cookie("c453fsfee","ccccccccccccccc");
httpservletresponse.addCookie(c1);
httpservletresponse.addCookie(c2);
httpservletresponse.addCookie(c3);
5. connection pool
Àúµµ ±×¹®Á¦ ¶§¹®¿¡ °í¹ÎÀ» ¸¹ÀÌ ÇÏ¿´´Âµ¥.
¾î¶° ¿Ü±¹ »çÀÌÆ®¿¡¼ Connection POOLÀ» ÀÌ¿ëÇÏ´õ±º¿ä..
±×·¯´Ï±î Ãʱ⠿¬°á½Ã¿¡ ConnectionÀ» ¿©·¯°³ ÇÏ¿© stack³ª ¹è¿¿¡ ÀúÀåÇÏ¿© ³õ°í ¸Å-
¿¬°áÀÌ
ÀÌ·ç¾î Áú¶§¸¶´Ù connectionÀ» ¿Áö ¾Ê°í stack¿¡¼³ª ¹è¿¿¡¼ °¡Á®¿À´õ±º¿ä...
±×¸®°í ¸Ç¸¶Áö¸·¿¡ connectionÀ» Á¾·áÇϱ¸¿ä..
´ÙÀ½Àº ÀÌ·± °æ¿ìÀÇ Á¦°¡ ÀÛ¾÷ÇÏ´ø ¼Ò½ºÀÔ´Ï´Ù.
customregister.java
Last modified: Tue Aug 31 21:05:25 1999