Posts Spring Web MVC 1
Post
Cancel

Spring Web MVC 1

Web MVC


๐Ÿ’ฟ Servlet

ํด๋ผ์ด์–ธํŠธ์˜ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๊ณ , ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” Servlet ํด๋ž˜์Šค์˜ ๊ตฌํ˜„ ๊ทœ์น™์„ ์ง€ํ‚จ ์ž๋ฐ” ์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ธฐ์ˆ 

  • ํŠน์ง•
    • ํด๋ผ์ด์–ธํŠธ์˜ ์š”์ฒญ์— ๋Œ€ํ•ด ๋™์ ์œผ๋กœ ์ž‘๋™ํ•˜๋Š” web-app Component
    • html์„ ์‚ฌ์šฉํ•˜์—ฌ ์š”์ฒญ์— ์‘๋‹ต
    • Java Thread๋ฅผ ์ด์šฉํ•˜์—ฌ ๋™์ž‘ํ•œ๋‹ค.
    • MVC ํŒจํ„ด์— Controller๋กœ ์ด์šฉ๋œ๋‹ค.
    • Http ์„œ๋น„์Šค๋ฅผ ์ง€์›ํ•˜๋Š” javax.servlet.http.HttpServlet Class๋ฅผ ์ƒ์†๋ฐ›๋Š”๋‹ค.
    • UDP๋ณด๋‹ค ์ฒ˜๋ฆฌ ์†๋„๊ฐ€ ๋Š๋ฆฌ๋‹ค.
    • Html ๋ณ€๊ฒฝ ์‹œ Servlet์„ ์žฌ ์ปดํŒŒ์ผํ•ด์•ผํ•œ๋Š ๋‹จ์ ์ด ์žˆ๋‹ค.

์›น์„œ๋ฒ„๋Š” ์ •์ ์ธ ํŽ˜์ด์ง€๋งŒ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋™์ ์ธ ํŽ˜์ด์ง€๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์›น์„œ๋ฒ„๋Š” ๋‹ค๋ฅธ ๊ณณ์— ๋„์›€์„ ์š”์ฒญํ•˜์—ฌ ๋™์ ์ธ ํŽ˜์ด์ง€๋ฅผ ์ž‘์„ฑํ•ด์•ผ ํ•จ ์›น์„œ๋ฒ„๊ฐ€ ๋™์ ์ธ ํŽ˜์ด์ง€๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋„๋ก

์—ฌ๊ธฐ์„œ ๋„์™€์ฃผ๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์„œ๋ธ”๋ฆฟ์ด๋ฉฐ, ๋™์ ์ธ ํŽ˜์ด์ง€๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด CGI์ž…๋‹ˆ๋‹ค.


๐Ÿ’ฟ Servlet Container ๋™์ž‘ ๋ฐฉ์‹

image

  1. Client๊ฐ€ URL์„ ์ž…๋ ฅํ•˜๋ฉด HTTP Request๊ฐ€ Servlet Container๋กœ ์ „์†ก
  2. ์š”์ฒญ์„ ์ „์†ก๋ฐ›์€ Servlet Container๋Š” HttpServletRequest, HttpResponse ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑ
  3. web.xml์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์‚ฌ์šฉ์ž๊ฐ€ ์š”์ฒญํ•œ URL์ด ์–ด๋Š ์„œ๋ธ”๋ฆฟ์— ๋Œ€ํ•œ ์š”์ฒญ์ธ์ง€ ์ฐพ์Œ
  4. ํ•ด๋‹น ์„œ๋ธ”๋ฆฟ์—์„œ service ๋ฉ”์†Œ๋ฅผ ํ˜ธ์ถœํ•œ ํ›„ Client์˜ GET, POST์— ๋”ฐ๋ผ doGet() doPost()๋ฅผ ํ˜ธ์ถœ
  5. doGet() or doPost() ๋ฉ”์†Œ๋“œ๋Š” ๋™์ ์ธ ํŽ˜์ด์ง€๋ฅผ ์ƒ์„ฑํ•œ ํ›„ HttpServletResponse ๊ฐ์ฒด์— ์‘๋‹ต์„ ๋ณด๋ƒ„
  6. ์‘๋‹ต์ด ๋๋‚˜๋ฉด HttpServletRequest, HttpServletResponse ๋‘ ๊ฐ์ฒด๋ฅผ ์†Œ๋ฉธ

๐Ÿ’ฟ Servlet ์ƒ๋ช…์ฃผ๊ธฐ

  • ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์„œ๋ธ”๋ฆฟ ์ธ์Šคํ„ด์Šค์˜ init() ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์ดˆ๊ธฐํ™” ํ•œ๋‹ค.
    • ์ตœ์ดˆ ์š”์ฒญ์„ ๋ฐ›์•˜์„ ๋•Œ ํ•œ๋ฒˆ ์ดˆ๊ธฐํ™” ํ•˜๊ณ  ๋‚˜๋ฉด ๊ทธ ๋‹ค์Œ ์š”์ฒญ๋ถ€ํ„ฐ๋Š” ์ด ๊ณผ์ •์„ ์ƒ๋žตํ•œ๋‹ค.
  • ์„œ๋ธ”๋ฆฟ์ด ์ดˆ๊ธฐํ™” ๋œ ๋‹ค์Œ๋ถ€ํ„ฐ ํด๋ผ์ด์–ธํŠธ์˜ ์š”์ฒญ์„ ์ฐจ๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐ ์š”์ฒญ์€ ๋ณ„๋„์˜ ์“ฐ๋ ˆ๋“œ๋กœ ์ฒ˜๋ฆฌํ•˜๊ณ  ์ด๋•Œ ์„œ๋ธ”๋ฆฟ ์ธ์Šคํ„ด์Šค์˜ service() ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.
    • ์ด ์•ˆ์—์„œ HTTP ์š”์ฒญ์„ ๋ฐ›๊ณ  Client๋กœ ๋ณด๋‚ผ HTTP ์‘๋‹ต์„ ๋งŒ๋“ ๋‹ค.
    • service()๋Š” ๋ณดํ†ต HTTP Method์— ๋”ฐ๋ผ doGet(), doPost() ๋“ฑ์œผ๋กœ ์ฒ˜๋ฆฌ๋ฅผ ์œ„์ž„ํ•œ๋‹ค.
    • ๋”ฐ๋ผ์„œ ๋ณดํ†ต doGet() ๋˜๋Š” doPost()๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค.
  • ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ ํŒ๋‹จ์— ๋”ฐ๋ผ ํ•ด๋‹น ์„œ๋ธ”๋ฆฟ์„ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ๋‚ด๋ ค์•ผ ํ•  ์‹œ์ ์— destroy()๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

๐Ÿ’ฟ Servlet Mapping

image

์œ„๋Š” ๋ฐฐํฌ์„œ์ˆ ์ž(Deployment Descriptor)๋ฅผ ์‚ฌ์šฉํ•œ ๋ฐฉ๋ฒ•

  • web.xml ํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ  web-app ํƒœ๊ทธ ๋‚ด๋ถ€์— ์„œ๋ธ”๋ฆฟ์„ ์ •์˜
  • ์ด๊ฒƒ๋“ค์€ ์„œ๋ธ”๋ฆฟ์œผ๋กœ ํ†ฐ์บฃ์ด ์‹คํ–‰ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ servlet3.0๋ถ€ํ„ฐ Annotation์„ ์ง€์›ํ•˜๋ฉด์„œ ๋ฐฐํฌ์„œ์ˆ ์ž ์—†์ด๋„ ์„œ๋ธ”๋ฆฟ ๋งคํ•‘ ๊ฐ€๋Šฅ

image

ํด๋ž˜์Šค ์œ„์— ์–ด๋…ธํ…Œ์ด์…˜์„ ์ด์šฉํ•ด์„œ URL ๋งคํ•‘์„ ์™„๋ฃŒํ–ˆ๊ณ  HttpServlet ํด๋ž˜์Šค๋ฅผ ์ƒ์†๋ฐ›์€ ํด๋ž˜์Šค๋ฅผ ๋งŒ๋“ค๊ณ  ์—ฌ๊ธฐ์„œ๋Š” doGet() ๋ฉ”์†Œ๋“œ๋ฅผ ์˜ค๋ฒ„๋ผ์ด๋“œ

๊ทธ๋Ÿฐ๋ฐ out.println() ์œผ๋กœ HTML ์ฝ”๋“œ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์€ ์ž‘์„ฑํ•˜๊ธฐ๋„ ๋ถˆํŽธํ•˜๊ณ  ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ๋‚˜ ์ƒˆ๋กœ์šด ์š”๊ตฌ์‚ฌํ•ญ์ด ์ถ”๊ฐ€ ๋˜์—ˆ์„ ๋•Œ ์ˆ˜์ •์„ ํ•˜๊ธฐ๋„ ์–ด๋ ค์šธ ์ˆ˜ ๋ฐ–์— ์—†์Šต๋‹ˆ๋‹ค. ์ž๋ฐ” ์ฝ”๋“œ ์•ˆ์—์„œ HTML ํƒœ๊ทธ๋ฅผ ๋„ฃ๋Š”๊ฒƒ์ด ์•„๋‹ˆ๋ผ ๋ฐ˜๋Œ€๋กœ HTML ์•ˆ์— ์ž๋ฐ” ์ฝ”๋“œ๋ฅผ ๋„ฃ์„ ์ˆ˜ ์žˆ๋‹ค๋ฉด ์ด๋Ÿฐ ๋ฌธ์ œ๋“ค์ด ํ•ด๊ฒฐ๋  ์ˆ˜ ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ ์—ญํ• ์„ ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด ๋ฐ”๋กœ JSP ์ž…๋‹ˆ๋‹ค.


๐Ÿ’ฟ CGI & WAS

๋ณ„๋„๋กœ ์ œ์ž‘๋œ ์›น์„œ๋ฒ„์™€ ํ”„๋กœ๊ทธ๋žจ ๊ฐ„์˜ ๊ตํ™˜๋ฐฉ์‹.

  • ์–ด๋– ํ•œ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์–ธ์–ด๋กœ๋„ ๊ตฌํ˜„์ด ๊ฐ€๋Šฅํ•˜๋ฉฐ ๋ณ„๋„๋กœ ๋งŒ๋“ค์–ด ๋†“์€ ํ”„๋กœ๊ทธ๋žจ์— HTML์˜ GET, POST ๋ฐฉ์‹์œผ๋กœ Client์˜ ๋ฐ์ดํ„ฐ๋ฅผ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋กœ ์ „๋‹ฌํ•˜๊ณ , ํ”„๋กœ๊ทธ๋žจ์˜ ํ‘œ์ค€ ์ถœ๋ ฅ ๊ฒฐ๊ณผ๋ฅผ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์ „์†กํ•˜๋Š” ๊ฒƒ

WAS์™€ CGI

์›น์„œ๋ฒ„: ์š”์ฒญ์— ๋Œ€ํ•œ ์ •์ ์ธ ๋ฆฌ์†Œ์Šค๋ฅผ ์‘๋‹ตํ•˜๋Š” ๋ชฉ์ ์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ ์„œ๋ฒ„

  • Apache, Nginx ๋“ฑ์ด ์žˆ์Œ

CGI (Common Gate Interface): ์›น์„œ๋ฒ„์™€ WAS ๊ฐ„์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›๋Š” ๊ทœ์น™์„ ํ†ต์ผํ•  ๊ทœ์•ฝ. ์ด์— ๋”ฐ๋ผ ๋งŒ๋“ค์–ด์ง„ ํ”„๋กœ๊ทธ๋žจ์„ CGI ํ”„๋กœ๊ทธ๋žจ์ด๋ผ ํ•จ(์˜›๋‚ ์— ๋‚˜์˜ด)

WAS (Web Application Server): ๋™์ ์ธ ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๊ณ  ์›น์„œ๋ฒ„๋กœ ๋ฆฌํ„ดํ•˜๋Š” ๋ชฉ์ ์œผ๋กœ ๋งŒ๋“  ์„œ๋ฒ„

  • ์›น์„œ๋ฒ„์™€ WAS๋Š” ๋‹ค๋ฅธ ์–ธ์–ด, ์ฒด๊ณ„๋กœ ๋งŒ๋“ค์–ด์กŒ๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ์ดํ„ฐ ๊ตํ™˜์ด ์–ด๋ ค์›€
  • Tomcat์ด๋‚˜ Zeus๋“ฑ์ด ์žˆ์Œ

WAS์˜ ์‹คํ–‰ ์œ ํ˜•

  1. Interpreter
    • ํ˜•ํƒœ: .php, .pl, .js, .py ๋“ฑ
    • Script ์—”์ง„์ด ํ•„์š”: ์›น์„œ๋ฒ„๊ฐ€ ์Šคํฌ๋ฆฝํŠธ ์—”์ง„์„ ์‹คํ–‰ํ•˜๊ณ  ์Šคํฌ๋ฆฝํŠธ ์—”์ง„์ด ์Šคํฌ๋ฆฝํŠธ๋ฅผ ํ•ด์„ -> ๋ฐ์ดํ„ฐ ๋ฆฌํ„ด
  2. Compile
    • ๊ธฐ๊ณ„์–ด๊ฐ€ ์ตœ์ข…๋ณธ, ์›น์„œ๋ฒ„๊ฐ€ ๋ฐ”๋กœ ์‹คํ–‰
  3. ์ž๋ฐ”์™€ CGI ํ”„๋กœ๊ทธ๋žจ
    • .class๋กœ ๋œ ์›น์•ฑ: .class๋Š” ๋ฐ”์ดํŠธ์ฝ”๋“œ(jvm์— ์˜ํ•ด ๊ธฐ๊ณ„์–ด๋กœ ๋ฒˆ์—ญ๋จ)
    • ์›น์„œ๋ฒ„๊ฐ€ ์›น์•ฑ ์‹คํ–‰ ๋ถˆ๊ฐ€: .class๋Š” jvm์— ์˜ํ•ด ๋ฒˆ์—ญ, ์‹คํ–‰๋˜์–ด์•ผ ํ•จ
    • ์›น์„œ๋ฒ„๊ฐ€ jvm์„? -> jvm์€ ์šด์˜์ฒด์ œ์— ์ข…์†์ 
    • ๊ทธ๋Ÿฌ๋ฉด jvm์ด ์‹คํ–‰๋˜๊ณ  ๊ทธ ์œ„์—์„œ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ ๊ด€๋ฆฌ์„œ๋ฒ„(Tomcat)์„ ๋งŒ๋“ค๊ณ  ์‹คํ–‰ํ•˜์ž
    • Tomcat: JSP ํ™˜๊ฒฝ์„ ํฌํ•จํ•˜๊ณ  ์žˆ๋Š” Servlet ์ปจํ…Œ์ด๋„ˆ(๊ด€๋ฆฌ์„œ๋ฒ„)

๋”ฐ๋ผ์„œ

image

  1. Client๋กœ ๋ถ€ํ„ฐ ์›น์„œ๋ฒ„๊ฐ€ ์š”์ฒญ์„ ๋ฐ›์œผ๋ฉด ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ ๊ด€๋ฆฌ ์„œ๋ฒ„(CGI) ์‹คํ–‰
  2. ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ ๊ด€๋ฆฌ ์„œ๋ฒ„(CGI)๋Š” ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ(jvm์œ„์—์„œ) ์‹คํ–‰
  3. ๋ฆฌํ„ด๋ฐ›์€ ๊ฐ’์„ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ ๊ด€๋ฆฌ ์„œ๋ฒ„๊ฐ€ ๊ฒฐ๊ณผ๊ฐ’์„ ์›น์„œ๋ฒ„๋กœ: ๋ฐ์ดํ„ฐ ์ „๋‹ฌํ•ด์ฃผ๋Š” ์—ญํ•  ์ˆ˜ํ–‰

์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๋ž€

  1. ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ ๊ด€๋ฆฌ ์„œ๋ฒ„์˜ ์ด๋ฆ„
  2. ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ์„ ์„œ๋ธ”๋ฆฟ์ด๋ผ ํ•จ: .class, ์›น์•ฑ
  3. ์š”์ฒญ์ด ์˜ค๋ฉด ํ˜ธ์ถœ(์ƒ์„ฑ, ์‹คํ–‰)๋ฟ ์•„๋‹ˆ๋ผ ์†Œ๋ฉธ๊นŒ์ง€ ๊ด€๋ฆฌ: lifeCycle ๊ด€๋ฆฌ
    • ์Šคํฌ๋ฆฝํŠธ์˜ ๊ฒฝ์šฐ ใ…‡ใ…‡ใ…‡์—”์ง„์ด๋ผ ํ•จ
  4. ์—ฌ๋Ÿฌ ์š”์ฒญ: ํŒŒ๋‚˜์˜ ํ”„๋กœ์„ธ์Šค์—์„œ ๋ฉ€ํ‹ฐ ์“ฐ๋ ˆ๋“œ ์ฒ˜๋ฆฌ๋“ฑ app ๊ด€๋ฆฌ ๊ธฐ๋Šฅ๊นŒ์ง€
  5. ๋Œ€ํ‘œ์ ์œผ๋กœ ํ†ฐ์บฃ(์•„ํŒŒ์น˜ ์•„๋‹˜), ์ œ์šฐ์Šค, ์›น๋กœ์ง ๋“ฑ์ด ์žˆ์Œ
  6. WAS๋ผ์†Œ ํ•จ: ์›น์„œ๋ฒ„๋กœ ๋ถ€ํ„ฐ ์š”์ฒญ์„ ์ „๋‹ฌ๋ฐ›๊ณ  ์›น์•ฑ(์„œ๋ธ”๋ฆฟ)์„ ์‹คํ–‰์‹œํ‚ค๊ณ  ์–ป์€ ๊ฒฐ๊ณผ๊ฐ’์„ ์›น์„œ๋กœ ์ „๋‹ฌํ•ด ์ฃผ๋Š” ์—ญํ• 

Http๋ฅผ ์ด์šฉํ•œ Server ์™€ Client์˜ ํ†ต์‹ 

  1. ํด๋ผ์ด์–ธํŠธ๋Š” ์ •๋ณด๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด ์„œ๋ฒ„๋กœ HTTP ์š”์ฒญ์„ ์ „์†กํ•˜๊ณ ,
  2. ์„œ๋ฒ„๋Š” ์ด๋ฅผ ํ•ด์„ํ•˜์—ฌ ์ •์  ์ž์›์— ๋Œ€ํ•œ ์š”์ฒญ์ผ ๊ฒฝ์šฐ ์ž์›์„ ๋ฐ˜ํ™˜ํ•ด์ฃผ๊ณ , ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ CGI ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰์‹œ์ผœ ํ•ด๋‹น ๊ฒฐ๊ณผ๋ฅผ ๋ฆฌํ„ด
  3. ์ด๋•Œ ์„œ๋ฒ„๋Š” CGI ํ”„๋กœ๊ทธ๋žจ์—๊ฒŒ ์š”์ฒญ์„ ์ „๋‹ฌํ•ด์ฃผ๊ณ , ๊ฒฐ๊ณผ๋ฅผ ์ „๋‹ฌ๋ฐ›๊ธฐ ์œ„ํ•œ ํŒŒ์ดํ”„๋ผ์ธ์„ ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.
  4. CGI ํ”„๋กœ๊ทธ๋žจ์€ ์ž…๋ ฅ์— ๋Œ€ํ•œ ์„œ๋น„์Šค๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ณ , ๊ฒฐ๊ณผ๋ฅผ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์ „๋‹ฌํ•˜๊ธฐ ์œ„ํ•ด ๊ฒฐ๊ณผ ํŽ˜์ด์ง€์— ํ•ด๋‹นํ•˜๋Š” MIME ํƒ€์ž…์˜ ์ปจํ…์ธ ๋ฐ์ดํ„ฐ๋ฅผ ์›น ์„œ๋ฒ„์™€ ์—ฐ๊ฒฐ๋œ ํŒŒ์ดํ”„๋ผ์ธ์— ์ถœ๋ ฅํ•˜์—ฌ ์„œ๋ฒ„์— ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค.
  5. ์„œ๋ฒ„๋Š” ํŒŒ์ดํ”„๋ผ์ธ์„ ํ†ตํ•ด CGI ํ”„๋กœ๊ทธ๋žจ์—์„œ ์ถœ๋ ฅํ•œ ๊ฒฐ๊ณผ ํŽ˜์ด์ง€์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์–ด, HTTP ์‘๋‹ตํ—ค๋”๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ํ•จ๊ป˜ ๋ฐ˜ํ™˜ํ•ด์ค๋‹ˆ๋‹ค.

๐Ÿ’ฟ Tomcat Container

Stand-alone servlet containers(Tomcat์˜ ๊ธฐ๋ณธ ๋ชจ๋“œ)

  • ๋‚ด์žฅ๋œ ์›น์„œ๋ฒ„์˜ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ
  • ๊ธฐ๋Šฅ๋ฉด์—์„œ JavaWebServer์˜ ๋ถ€๋ถ„์ธ Serlvet ์ปจํ…Œ์ด๋„ˆ์™€ Java ๊ทผ๊ฐ„ ์›น ์„œ๋ฒ„๋ฅผ ์‚ฌ์šฉ

In-process servlet containers

  • Servlet ์ปจํ…Œ์ด๋„ˆ๋Š” ์›น์„œ๋ฒ„ ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ Java ์ปจํ…Œ์ด๋„ˆ ๊ตฌํ˜„
  • ์›น์„œ๋ฒ„ ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ์›น์„œ๋ฒ„์˜ ์ฃผ์†Œ ๊ณต๊ฐ„ ๋‚ด์— JVM์„ ์—ด๊ณ  ๊ทธ ์•ˆ์—์„œ JAVA ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์‹คํ–‰๋˜๋„๋ก ํ•œ๋‹ค.
  • ๋‹ค์ค‘ ์Šค๋ ˆ๋“œ์˜ ๋‹จ์ผ ํ”„๋กœ์„ธ์Šค ์„œ๋ฒ„์— ์ ๋‹นํ•˜๊ณ  ํผํฌ๋จผ์Šค๋„ ์ข‹์ง€๋งŒ ํ™•์žฅ์„ฑ์— ํ•œ๊ณ„๊ฐ€ ์žˆ์Œ

Out-of-process servlet containers

  • ์›น์„œ๋ฒ„ ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ ์›น์„œ๋ฒ„์˜ ์™ธ๋ถ€ JVM์—์„œ ์‹คํ–‰ํ•˜๋Š” JAVA ์ปจํ…Œ์ด๋„ˆ ๊ตฌํ˜„
  • ์›น์„œ๋ฒ„ ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ JAVA ์ปจํ…Œ์ด๋„ˆ JVM์€ ๋ช‡๋ช‡ IPC(๋ณดํ†ต์€ TCP/IP ์†Œ์ผ“)๋ฅผ ์‚ฌ์šฉํ•ด์„œ ํ†ต์‹ 
  • Out-of-process ์—”์ง„์˜ ๋ฐ˜์‘ ์‹œ๊ฐ„์€ in-process ๋งŒํผ ์ข‹์ง€ ์•Š์ง€๋งŒ out-of-process ์—”์ง„์€ ํ™•์žฅ์„ฑ๊ณผ ์•ˆ์ „์„ฑ ๋ฉด์€ In-process๋ณด๋‹ค ์ข‹๋‹ค.

๐Ÿ’ฟ Servlet ๊ตฌ์กฐ

image

  • ์„œ๋ธ”๋ฆฟ:
    • ์›น์„œ๋ฒ„๋Š” ์ •์ ์ธ ํŽ˜์ด์ง€๋ฅผ ์ œ๊ณตํ•˜๋Š” ์—ญํ• ๋งŒ ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ž‘์„ฑ๋œ ํŽ˜์ด์ง€๋ฅผ ์ œ๊ณตํ•˜๊ฑฐ๋‚˜ ์„œ๋ฒ„ ์ƒ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๋Š” ์ผ์€ ์›น์„œ๋ฒ„๊ฐ€ ํ•  ์ˆ˜ ์—†์Œ
    • ๋”ฐ๋ผ์„œ ์›น์„œ๋ฒ„๋Š” ์š”์ฒญ์„ servlet์— ์š”์ฒญ์„ ์ „๋‹ฌํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋จ
  • ์ปจํ…Œ์ด๋„ˆ:
    • ์š”์ฒญ์ด ๋“ค์–ด์˜ค๋ฉด ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•  ์ƒˆ๋กœ์šด ์Šค๋ ˆ๋“œ๋ฅผ ๋งŒ๋“ค์–ด์•ผ ํ•˜๊ณ  ์„œ๋ธ”๋ฆฟ์—์„œ ํ•„์š”ํ•œ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•ด์•ผ ํ•จ
    • ์›น์„œ๋ฒ„๋Š” ์š”์ฒญ์„ ์ปจํ…Œ์ด๋„ˆ๋กœ ๋ณด๋‚ด๊ณ  Container๋Š” ์„œ๋ธ”๋ฆฟ์„ ์ฐพ์•„ ํ•„์š”ํ•œ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœ(doGet(), doPost())
This post is licensed under CC BY 4.0 by the author.

Tensorflow2

JVM