๐Ÿฅž BE
home

Servlet

Date
2024/08/09
Category
Web
Tag
Basic
Detail

Java SE ์™€ Java EE

Java SE (Java Standard Edition)

Java SE๋Š” Java์˜ ํ•ต์‹ฌ API์™€ ๊ธฐ๋Šฅ๋“ค์„ ์ œ๊ณตํ•˜๋Š” ์—๋””์…˜์ด๋‹ค.
๊ฐ„๋‹จํ•œ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ๊ณผ ์„œ๋ฒ„ ๊ตฌ์ถ•์ด ๊ฐ€๋Šฅํ•˜๋‹ค.
์ฃผ์š” ๊ตฌ์„ฑ ์š”์†Œ:
1.
JVM (Java Virtual Machine): ์ž๋ฐ” ๋ฐ”์ดํŠธ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๊ฐ€์ƒ ๋จธ์‹ ์œผ๋กœ, ํ”Œ๋žซํผ ๋…๋ฆฝ์„ฑ์„ ์ œ๊ณตํ•œ๋‹ค.
2.
JDK (Java Development Kit): ์ž๋ฐ” ์ปดํŒŒ์ผ๋Ÿฌ(javac), ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ, ์‹คํ–‰ ํ™˜๊ฒฝ์„ ํฌํ•จํ•œ ๊ฐœ๋ฐœ ๋„๊ตฌ ๋ชจ์Œ
3.
JRE (Java Runtime Environment): ์ž๋ฐ” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ํ™˜๊ฒฝ์œผ๋กœ, JVM๊ณผ ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํฌํ•จํ•œ๋‹ค.
4.
ํ•ต์‹ฌ API: ์ž๋ฐ” SE๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‹ค์–‘ํ•œ API๋ฅผ ์ œ๊ณตํ•œ๋‹ค.
โ€ข
java.lang: ๊ธฐ๋ณธ์ ์ธ ์ž๋ฐ” ํด๋ž˜์Šค(์˜ˆ: String, Math, System ๋“ฑ)
โ€ข
java.util: ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ์™€ ์œ ํ‹ธ๋ฆฌํ‹ฐ ํด๋ž˜์Šค(์˜ˆ: List, Map, Date ๋“ฑ)
โ€ข
java.io: ์ž…๋ ฅ๊ณผ ์ถœ๋ ฅ ์ŠคํŠธ๋ฆผ ์ฒ˜๋ฆฌ
โ€ข
java.nio: ๋น„๋™๊ธฐ ์ž…์ถœ๋ ฅ ์ฒ˜๋ฆฌ
โ€ข
java.net: ๋„คํŠธ์›Œํ‚น ๊ธฐ๋Šฅ(์˜ˆ: URL, Socket ๋“ฑ)
โ€ข
java.sql: JDBC๋ฅผ ํ†ตํ•œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ ‘๊ทผ
โ€ข
java.time: ๋‚ ์งœ์™€ ์‹œ๊ฐ„ API

Java EE (Java Enterprise Edition)

โ€ข
Java EE๋Š” Java SE์˜ ํ™•์žฅ ๋ฒ„์ „์œผ๋กœ ์„œ๋ฒ„ ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ํ™•์žฅ๋œ API์™€ ๋Ÿฐํƒ€์ž„ ํ™˜๊ฒฝ์„ ์ œ๊ณตํ•˜๋Š” ํ”Œ๋žซํผ์ด๋‹ค.
โ€ข
Tomcatย ๋“ฑ์˜ WAS๋ฅผ ์ด์šฉํ•˜๋Š” ์„œ๋ฒ„ ๊ฐœ๋ฐœ์€ Java EE์—์„œ ์ถ”๊ฐ€๋กœ ์ œ๊ณตํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•œ๋‹ค.
โ€ข
ํŠนํžˆย JSP์™€ย Servlet์„ ๋งŒ๋“ค๊ณ  ์‹คํ–‰ํ•˜๋Š” ๊ทœ์น™๊ณผย EJB(Enterpise JavaBeans)์˜ ๋ถ„์‚ฐ ์ปดํฌ๋„ŒํŠธ, ์›น ์„œ๋น„์Šค ๊ทœ์น™ ๋“ฑ์„ ์ถ”๊ฐ€๋กœ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉฐ, ์„œ๋ธ”๋ฆฟ๊ณผ JSP๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๊ธฐ๋Šฅ์„ย ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๋ผ๊ณ  ํ•œ๋‹ค.
์ฃผ์š” ๊ตฌ์„ฑ ์š”์†Œ:
1.
์›น ๊ธฐ์ˆ :
โ€ข
Servlet: ์„œ๋ฒ„ ์ธก์—์„œ HTTP ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์ž๋ฐ” ํด๋ž˜์Šค
โ€ข
JSP (JavaServer Pages): HTML๊ณผ ์ž๋ฐ” ์ฝ”๋“œ๋ฅผ ๊ฒฐํ•ฉํ•˜์—ฌ ๋™์ ์ธ ์›น ํŽ˜์ด์ง€๋ฅผ ์ƒ์„ฑ
โ€ข
JSF (JavaServer Faces): ์ปดํฌ๋„ŒํŠธ ๊ธฐ๋ฐ˜ ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค ํ”„๋ ˆ์ž„์›Œํฌ
2.
EJB (Enterprise JavaBeans): ๋ถ„์‚ฐ ์ปดํ“จํŒ… ๋ฐ ํŠธ๋žœ์žญ์…˜ ์ฒ˜๋ฆฌ๋ฅผ ์ง€์›ํ•˜๋Š” ์„œ๋ฒ„ ์ธก ๊ตฌ์„ฑ ์š”์†Œ
โ€ข
Session Beans: ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์„ ๊ตฌํ˜„
โ€ข
Message-Driven Beans: ๋น„๋™๊ธฐ ๋ฉ”์‹œ์ง•์„ ์ฒ˜๋ฆฌ
3.
JPA (Java Persistence API): ๊ฐ์ฒด-๊ด€๊ณ„ ๋งคํ•‘(ORM) ํ”„๋ ˆ์ž„์›Œํฌ๋กœ, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์ž๋ฐ” ๊ฐ์ฒด ๊ฐ„์˜ ๋งคํ•‘์„ ์ง€์›ํ•œ๋‹ค.

JSP์™€ Servlet

Servlet

โ€ข
ํ™•์žฅ์ž๊ฐ€ java ํŒŒ์ผ
โ€ข
์ž๋ฐ”์˜ ์ผ๋ฐ˜์ ์ธ ํด๋ž˜์Šค์™€ ๋™์ผํ•œ ๊ฐœ๋…
โ€ข
์›น์„ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” โ€œHttpServletโ€ ํด๋ž˜์Šค๋ฅผ ์ƒ์†๋ฐ›์€ ํด๋ž˜์Šค๋ฅผ ์˜๋ฏธ
โ€ข
์ž๋ฐ” ์›น ์„œ๋ฒ„๋กœ ์›น ํŽ˜์ด์ง€๋ฅผ ์ œ๊ณตํ•  ๋•Œ, ๋™์ ์ธ ๋ฐ์ดํ„ฐ๋ฅผ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์„ ๋„์™€์ฃผ๋Š” ์ž๋ฐ” ์†Œํ”„ํŠธ์›จ์–ด ์ปดํฌ๋„ŒํŠธ
@WebServlet("/home") public class HomeController extends HttpServlet{ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { OutputStream out = response.getOutputStream(); PrintStream writer = new PrintStream(out, true); writer.println("<html>"); writer.println("<head>"); writer.println("</head>"); writer.println("<body>"); writer.println("<h1>helloWorld~</h1>"); writer.println("name : " + request.getParameter("name") + "<br/>"); writer.println("</body>"); writer.println("</html>"); writer.close(); } }
Java
๋ณต์‚ฌ
Servlet์—์„œ ์‚ฌ์šฉ์ž์—๊ฒŒ ์‘๋‹ตํ•  html ์ฝ”๋“œ๋ฅผ ์ถœ๋ ฅํ•˜๊ธฐ ์œ„ํ•ด์„œ ์ŠคํŠธ๋ฆผ ๊ฐ์ฒด์— printํ•˜๋Š” ์ฝ”๋“œ.
Servlet ๋‹จ๋… ์‚ฌ์šฉ์˜ ๋ฌธ์ œ์ 
โ€ข
์ž๋ฐ”์•ˆ์— html ์ฝ”๋“œ๊ฐ€ ๋“ค์–ด๊ฐ€ ์žˆ์ง€๋งŒ ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•˜๋Š”๊ฒŒ ์•„๋‹Œ ๊ทธ์ € ์ถœ๋ ฅํ•ด์ฃผ๋Š” ๋ฐฉ์‹
โ€ข
๋ณต์žกํ•œ ๋ ˆ์ด์•„์›ƒ์„ ๊ฐ€์ง„ ํŽ˜์ด์ง€๋ฅผ ์‘๋‹ตํ•˜๋ ค๋ฉด ์ฝ”๋“œ๊ฐ€ ๊ธธ์–ด์งˆ ์ˆ˜ ๋ฐ–์— ์—†๋‹ค.

JSP(Java Server Page)

โ€ข
ํ™•์žฅ์ž๊ฐ€ .jsp ํŒŒ์ผ
โ€ข
Servlet์„ ์‚ฌ์šฉํ•ด ์›น์„ ๋งŒ๋“ค ๊ฒฝ์šฐ ํ™”๋ฉด ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌํ˜„์ด ์–ด๋ ต๋‹ค๋Š” ๋‹จ์ ์„ ๋ณด์™„ํ•˜๊ธฐ ์œ„ํ•ด ๋งŒ๋“  ์Šคํฌ๋ฆฝํŠธ ์–ธ์–ด
โ€ข
Servlet์€ ์ž๋ฐ” ์–ธ์–ด์•ˆ์— html์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๊ฒƒ์ด๋ผ๋ฉด, JSP๋Š” html์ฝ”๋“œ ์•ˆ์— ์ž๋ฐ” ์–ธ์–ด๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๋ฐฉ์‹
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>JSP ์˜ˆ์ œ</title> </head> <body> <h1>hello world</h1> <% for(int i = 0; i < 10; i++){ out.println(i); } %> </body> </html>
HTML
๋ณต์‚ฌ
JSP์˜ ์‹คํ–‰๊ณผ์ •
1.
JSP ํŒŒ์ผ์„ Servlet ํŒŒ์ผ(.java)๋กœ ๋ณ€ํ™˜
2.
๋ณ€ํ™˜๋œ Servlet ํŒŒ์ผ์„ ์ปดํŒŒ์ผํ•ด์„œ ์ž๋ฐ” ๋ฐ”์ดํŠธ ์ฝ”๋“œ ํŒŒ์ผ(.class)์„ ์ƒ์„ฑ
3.
์ปดํŒŒ์ผ๋œ ํŒŒ์ผ์„ ์‹คํ–‰ ๊ฒฐ๊ณผ ์ž๋ฐ” ์–ธ์–ด๊ฐ€ ๋ชจ๋‘ ์‚ฌ๋ผ์ง„ html ์ฝ”๋“œ๋ฅผ ์ถœ๋ ฅ
์œ„์˜ for๋ฌธ์œผ๋กœ 0~9๊นŒ์ง€ ์ถœ๋ ฅํ•œ JSP ํŒŒ์ผ์€ ์•„๋ž˜์™€ ๊ฐ™์ด ์„œ๋ธ”๋ฆฟ ํŒŒ์ผ๋กœ ๋ณ€ํ™˜๋˜์–ด ์ปดํŒŒ์ผ ๋œ ๋’ค, ์ตœ์ข…์ ์œผ๋กœ HTML๋กœ ๋ณ€ํ™˜๋˜์–ด ์‚ฌ์šฉ์ž์—๊ฒŒ ๋‚ ์•„๊ฐ„๋‹ค. ์งง์€ ๊ตฌ๋ฌธ์ž„์—๋„ ์„œ๋ธ”๋ฆฟ ํŒŒ์ผ๋กœ ๋ณ€ํ™˜๋˜๋ฉด ์—„์ฒญ๋‚œ ๊ธธ์ด์˜ ์ฝ”๋“œ๊ฐ€ ๋œ๋‹ค.
โ€ข
JSP(.jsp) โ†’ Servlet(.java)์œผ๋กœ ๋ณ€ํ™˜๋œ ์ฝ”๋“œ
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/9.0.30 * Generated at: 2020-02-12 15:41:55 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class Sample2_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent, org.apache.jasper.runtime.JspSourceImports { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String, java.lang.Long> _jspx_dependants; private static final java.util.Set<java.lang.String> _jspx_imports_packages; private static final java.util.Set<java.lang.String> _jspx_imports_classes; static { _jspx_imports_packages = new java.util.HashSet<>(); _jspx_imports_packages.add("javax.servlet"); _jspx_imports_packages.add("javax.servlet.http"); _jspx_imports_packages.add("javax.servlet.jsp"); _jspx_imports_classes = null; } private volatile javax.el.ExpressionFactory _el_expressionfactory; private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String, java.lang.Long> getDependants() { return _jspx_dependants; } public java.util.Set<java.lang.String> getPackageImports() { return _jspx_imports_packages; } public java.util.Set<java.lang.String> getClassImports() { return _jspx_imports_classes; } public javax.el.ExpressionFactory _jsp_getExpressionFactory() { if (_el_expressionfactory == null) { synchronized (this) { if (_el_expressionfactory == null) { _el_expressionfactory = _jspxFactory .getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); } } } return _el_expressionfactory; } public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { if (_jsp_instancemanager == null) { synchronized (this) { if (_jsp_instancemanager == null) { _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory .getInstanceManager(getServletConfig()); } } } return _jsp_instancemanager; } public void _jspInit() { } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { if (!javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { final java.lang.String _jspx_method = request.getMethod(); if ("OPTIONS".equals(_jspx_method)) { response.setHeader("Allow", "GET, HEAD, POST, OPTIONS"); return; } if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method)) { response.setHeader("Allow", "GET, HEAD, POST, OPTIONS"); response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSP๋“ค์€ ์˜ค์ง GET, POST ๋˜๋Š” HEAD ๋ฉ”์†Œ๋“œ๋งŒ์„ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. Jasper๋Š” OPTIONS ๋ฉ”์†Œ๋“œ ๋˜ํ•œ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค."); return; } } final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=EUC-KR"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("<!DOCTYPE html>\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta charset=\"EUC-KR\">\r\n"); out.write("<title>Insert title here</title>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("\r\n"); out.write('\r'); out.write('\n'); for (int i = 0; i < 10; i++) { out.println(i); } out.write("\r\n"); out.write("\r\n"); out.write("</body>\r\n"); out.write("</html>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
Java
๋ณต์‚ฌ
โ€ข
JSP(.jsp) โ†’ Servlet(.java) โ†’ .class ํŒŒ์ผ ๋ณ€ํ™˜ ํ›„ ์ตœ์ข…์ ์œผ๋กœ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ „๋‹ฌ๋œ ์ฝ”๋“œ
<!DOCTYPE html> <html> <head> <meta charset="EUC-KR"> <title>Insert title here</title> </head> <body> 0 1 2 3 4 5 6 7 8 9 </body> </html>
HTML
๋ณต์‚ฌ
์œ„์™€ ๊ฐ™์€ ํŠน์ง•์œผ๋กœ ์ธํ•ด ์ผ๋ฐ˜์ ์œผ๋กœ JSP๋Š” ํ™”๋ฉด๊ตฌ์„ฑ์— ์‚ฌ์šฉ๋˜๊ณ  ์„œ๋ธ”๋ฆฟ์€ ๋กœ์ง์„ ์ˆ˜ํ–‰ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค.
ย : ใ…‡ใ…‹ใ…‡ใ…‹ ํด๋ผ์ด์–ธํŠธ-์„œ๋ฒ„ ์•„ํ‚คํ…์ฒ˜์—์„œ WEB์—์„œ HTTP ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๊ณ  ์‘๋‹ต์„ ๋ฐ˜ํ™˜ํ•˜๊ธฐ ์œ„ํ•ด ์„œ๋ธ”๋ฆฟ์ด ์‚ฌ์šฉ๋˜๋Š”๊ฑด ์•Œ๊ฒ ์–ด. ๊ทธ๋Ÿผ ์„œ๋ธ”๋ฆฟ์ด ์™œ ์ข‹์€๊ฑด๋ฐ?
์„œ๋ธ”๋ฆฟ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์ง์ ‘ HTTP ํ†ต์‹ ์œผ๋กœ ์˜ค๊ณ ๊ฐ€๋Š” ๋ฌธ์ž์—ด์„ ํŒŒ์‹ฑํ•˜์—ฌ ์„œ๋ธ”๋ฆฟ๊ณผ ๊ฐ™์€ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•ด๋„ ๋ฌด๋ฐฉํ•˜์ง€๋งŒ, ์ด๋ฏธ ํŽธ๋ฆฌํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์„œ๋ธ”๋ฆฟ์„ ๋†”๋‘๊ณ  ์ง์ ‘ ๋ฌธ์ž์—ด ํŒŒ์‹ฑ์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์€ ๊ฐœ๋ฐœ์ž๊ฐ€ ์˜จ์ „ํžˆ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์— ์ง‘์ค‘ํ•˜์ง€ ๋ชปํ•˜๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.
์šฐ๋ฆฌ๋Š” ์„œ๋ธ”๋ฆฟ์„ ํ†ตํ•ด ๋ฌธ์ž์—ด ํŒŒ์‹ฑ ๋“ฑ์— ์—ด์˜ฌ๋ฆฌ์ง€ ์•Š๊ณ  ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์— ๋”์šฑ ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๋‹ค.
์ง์ ‘ ๋งŒ๋“ค๋ฉด ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์„ ์งœ๊ธฐ ์ „์— ์ˆ˜ ๋งŽ์€ ๊ทœ์•ฝ๊ณผ ๋ฌธ์ž์—ด ๊ฒ€์ฆ์— ์ •์‹ ์ด ๋‚˜๊ฐ€๋ฒ„๋ฆด ์ˆ˜ ์žˆ๋‹ค.
๊ทธ๋ฆฌ๊ณ ..

CGI์™€ Servlet

์„œ๋ธ”๋ฆฟ ์ด์ „์— CGI๊ฐ€ ์žˆ์—ˆ๋‹ค.

CGI(Common Gateway Interface)๋Š” ์„œ๋ธ”๋ฆฟ์˜ ์กฐ์ƒ์ฏค ๋˜๋Š” ๊ธฐ์ˆ ์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋œ๋‹ค. CGI ์ด์ „์˜ ์›น์„œ๋ฒ„๋Š” ๋‹จ์ˆœํžˆ ์‚ฌ์šฉ์ž๊ฐ€ ํŠน์ • ๊ฒฝ๋กœ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๊ทธ ๊ฒฝ๋กœ์— ํ•ด๋‹นํ•˜๋Š” ๋ฆฌ์†Œ์Šค๋งŒ ๋ฟŒ๋ ค์ฃผ๋Š” ์—ญํ• ์ด์—ˆ๋‹ค.
๊ทธ๋Ÿฐ๋ฐ CGI๊ฐ€ ๋‚˜์˜ค๋ฉด์„œย ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ๊ฐ’์„ ์ธ์ž๋กœ ๋„ฃ์€ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰์‹œํ‚จ ๊ฒฐ๊ณผ๋ฅผ ์›น์œผ๋กœ ๋ฟŒ๋ ค์ค„ ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค.ย ๊ฐ„๋‹จํžˆ ์ •์˜ํ•˜๋ฉด CGI๋Š”ย ์›น์„œ๋ฒ„์—์„œ ๋™์ ์ธ ํŽ˜์ด์ง€๋ฅผ ๋ณด์—ฌ์ฃผ๊ธฐ ์œ„ํ•ด ์ž„์˜์˜ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ๊ธฐ์ˆ ย ์ด์—ˆ๋‹ค.

๊ธฐ์กด CGI์˜ ๋‹จ์ ๊ณผ ๊ทธ ๋‹จ์ ์„ ํ•ด๊ฒฐํ•œ ์„œ๋ธ”๋ฆฟ

โ€ข
๊ธฐ์กด CGI์˜ ๋™์ž‘๋ฐฉ์‹
CGI๋Š” ๋ธŒ๋ผ์šฐ์ €์—์„œ ์›น์„œ๋ฒ„์— ์š”์ฒญ์ด ๊ฐ”์„ ๋•Œ, ๊ฐ๊ฐ์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ ํ”„๋กœ์„ธ์Šค๋ฅผ ๋งŒ๋“ค์–ด๋‚ธ๋‹ค๋Š” ๋‹จ์ ์ด ์žˆ์—ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋Œ€๋Ÿ‰์˜ ํŠธ๋ž˜ํ”ฝ์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ์—๋Š” ์•ฝ๊ฐ„ ๋ฌด๋ฆฌ๊ฐ€ ์žˆ์—ˆ๋‹ค.
โ€ข
์„œ๋ธ”๋ฆฟ์˜ ๋™์ž‘๋ฐฉ์‹
์„œ๋ธ”๋ฆฟ์€ ๊ฐ ์š”์ฒญ์— ๋Œ€ํ•œ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ํ”„๋กœ์„ธ์Šค 1๊ฐœ๊ฐ€ ์žˆ๊ณ  ๊ทธ ๋‚ด๋ถ€์— ์Šค๋ ˆ๋“œ ํ’€์ด๋ผ๋Š” ์Šค๋ ˆ๋“œ๋“ค์ด ์ƒ์„ฑ๋  ์ˆ˜ ์žˆ๋Š” ๊ณต๊ฐ„์„ ๋งŒ๋“ค์–ด ์Šค๋ ˆ๋“œ๋กœ ์ฒ˜๋ฆฌํ–ˆ๋‹ค.
๋˜ํ•œ ์Šค๋ ˆ๋“œ ํ’€์€ ๊ฐœ์ˆ˜๋ฅผ ์ง€์ •ํ•˜์—ฌ ์ผ์ • ์ด์ƒ์˜ ์š”์ฒญ์ด ๋“ค์–ด์™”์„ ๋•Œ๋Š” ๋Œ€๊ธฐํ•˜๋„๋ก ๋งŒ๋“ค์–ด์„œ ๋Œ€๋Ÿ‰์˜ ์š”์ฒญ์ด ๋“ค์–ด์™”์„ ๋•Œ๋„ ์กฐ๊ธˆ ๋” ์•ˆ์ •์„ฑ์ด ์ฆ๊ฐ€ํ–ˆ๋‹ค.
๊ทธ๋ฆฌ๊ณ  ์‚ฌ์‹ค ๋น„์Šทํ•œ ๊ฒฝ๋กœ์— ์š”์ฒญ์„ ํ•œ ํด๋ผ์ด์–ธํŠธ๋“ค์˜ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์€ ๋Œ€๋ถ€๋ถ„ ์ค‘๋ณต๋˜๋Š” ๋ถ€๋ถ„์ด๋ฏ€๋กœ, ์Šค๋ ˆ๋“œ ์‚ฌ์ด์— ์žˆ๋Š” ๊ณต์œ  ์ž์› (Code,ย Data,ย Heap)์„ ํ†ตํ•ด ๋”์šฑ ํšจ์œจ์ ์ธ ์ฒ˜๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ–ˆ๋‹ค.

์„œ๋ธ”๋ฆฟ๊ณผ CGI์˜ ๊ฒฐ์ •์  ์ฐจ์ด๋Š”?

์„œ๋ธ”๋ฆฟ๋„ CGI ๊ทœ์น™์— ๋”ฐ๋ผ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ  ๋ฐ›๋Š” ๊ฒƒ๊นŒ์ง€๋Š” ๊ฐ™์ง€๋งŒ, ์„œ๋ธ”๋ฆฟ์€ ์„œ๋ธ”๋ฆฟ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ์—๊ฒŒ ์ด ์ผ์„ ์œ„์ž„ํ•œ๋‹ค. ๋Œ€์‹  ์ฒด๊ณ„์ ์œผ๋กœ ์ด๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ์™€ ์„œ๋ธ”๋ฆฟ ์‚ฌ์ด์˜ ๊ทœ์น™์ด ์กด์žฌํ•˜๊ฒŒ ๋œ๋‹ค.
ย : ใ…‡ใ…‹ใ…‡ใ…‹ ์„œ๋ธ”๋ฆฟ์ด ์ข‹์€ ๊ธฐ์ˆ ์ด๋ผ๋Š”๊ฑฐ ์•Œ๊ฒ ์–ด. ๊ทธ๋Ÿผ ํ”„๋กœ๊ทธ๋žจ ๋‚ด๋ถ€์ ์œผ๋กœ๋Š” ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๊ณ  ์–ด๋–ค ๊ฒƒ๋“ค๋กœ ๊ตฌ์„ฑ๋˜๋Š”๋ฐ?

Servlet ๋‚ด๋ถ€ ํ”„๋กœ์„ธ์Šค

์„œ๋ธ”๋ฆฟ ๊ฐœ๋ฐœ ํ๋ฆ„

1.
๊ฐœ๋ฐœ์ž๊ฐ€ ์ž๋ฐ” ์„œ๋ธ”๋ฆฟ ์†Œ์Šค์ฝ”๋“œ(.java)๋ฅผ ์ž‘์„ฑํ•œ๋‹ค. (์œ„์—์„œ๋Š” ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์ด์šฉํ•ด ์ž‘์„ฑ)
2.
ํ•ด๋‹น ์ž๋ฐ” ์„œ๋ธ”๋ฆฟ ์†Œ์Šค๊ฐ€ ๋นŒ๋“œ์‹œ ์ปดํŒŒ์ผ๋˜๋ฉฐ ์„œ๋ธ”๋ฆฟ ํด๋ž˜์Šค(.class)๊ฐ€ ๋œ๋‹ค.
3.
ํ•ด๋‹น ์ž๋ฐ” ์„œ๋ธ”๋ฆฟ ํด๋ž˜์Šค๊ฐ€ ํ†ฐ์บฃ๊ณผ ๊ฐ™์€ ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ์— ๋“ฑ๋ก๋œ๋‹ค.
4.
ํด๋ผ์ด์–ธํŠธ๊ฐ€ ํŠน์ • ๊ฒฝ๋กœ์— ๋Œ€ํ•œ HTTP Request๋ฅผ ๋ณด๋‚ธ๋‹ค.
5.
HTTP Request์— ์ƒ์‘ํ•˜๋Š” ์„œ๋ธ”๋ฆฟ์ด ์‹คํ–‰๋œ๋‹ค.
6.
์„œ๋ธ”๋ฆฟ ๋ฉ”์†Œ๋“œ(๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง)๊ฐ€ ์‹คํ–‰๋œ๋‹ค.
7.
DB ์—ฐ๋™ ์ž‘์—…์ด ์žˆ๋Š” ๊ฒฝ์šฐ DB ์—ฐ๋™์ด ๋˜์–ด ๋ฐ์ดํ„ฐ๋ฅผ CRUDํ•œ๋‹ค.
8.
์™„์„ฑ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ฐ˜ํ™˜ํ•ด์ค€๋‹ค.

์„œ๋ธ”๋ฆฟ ๋ผ์ดํ”„์‚ฌ์ดํด

1.
์„œ๋ธ”๋ฆฟ์€ ์ƒ์„ฑ ์ดํ›„์—ย init()ย ๋ฉ”์†Œ๋“œ๋ฅผ ํ†ตํ•ด ์ดˆ๊ธฐํ™”๋œ๋‹ค.
2.
ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋น„์Šค(service())๋กœ ๋ณด๋‚ธ ์š”์ฒญ๋“ค์„ ์ฒ˜๋ฆฌํ•œ๋‹ค.
3.
์„œ๋ธ”๋ฆฟ์€ ์‚ฌ์šฉ ์ค‘์ง€๋œ ํ›„,ย destroy()๋ฅผ ์ด์šฉํ•ด ์ œ๊ฑฐ๋œ๋‹ค.
์ดˆ๊ธฐ์˜ CGI์ฒ˜๋Ÿผ ํ•˜๋‚˜์˜ ์š”์ฒญ์— ํ•˜๋‚˜์˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ผœ์ง€๋Š” ๊ตฌ์กฐ๋ฅผ ํƒˆํ”ผํ•˜์—ฌ Servlet์ด ํŠน์ •ํ•œ ๋ผ์ดํ”„์‚ฌ์ดํด์„ ๊ฐ–๊ณ  ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์—์„œ ์“ฐ๋ ˆ๋“œ ๋‹จ์œ„๋กœ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•œ๋‹ค.
์ด ๊ณผ์ •์—์„œ ํ๋ฆ„์„ ๊ฐœ๋ฐœ์ž๊ฐ€ ์•„๋‹Œ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ œ์–ดํ•˜๋Š”๋ฐ, ์ด๋ฅผ IoC (Inversion of Control)๋ผ๊ณ  ํ•œ๋‹ค.

init ๋ฉ”์†Œ๋“œ

void init(ServletConfig config) throws ServletException
Java
๋ณต์‚ฌ
์–ด๋–ค ์„œ๋ธ”๋ฆฟ์ด ์„œ๋น„์Šค์— ๋ฐฐ์น˜ ๋˜๊ณ  ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•ด ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๋กœ๋ถ€ํ„ฐ ํ˜ธ์ถœ๋˜๋Š” ๋ฉ”์†Œ๋“œ์ด๋‹ค. init()ย ๋ฉ”์†Œ๋“œ๋Š” ์„œ๋ธ”๋ฆฟ์ด ์š”์ฒญ์„ ๋ฐ›๊ธฐ ์ „์— ๋ฐ˜๋“œ์‹œ ์„ฑ๊ณต์ ์œผ๋กœ ๋๋งˆ์ณ์ ธ์•ผ ํ•œ๋‹ค.
๋งŒ์ผย init()ย ๋ฉ”์†Œ๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋‹ค๊ฐ€ ์•„๋ž˜์™€ ๊ฐ™์€ ํ˜„์ƒ์ด ์ผ์–ด๋‚˜๋ฉด ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๋Š” ์„œ๋ธ”๋ฆฟ์„ ๋“ฑ๋กํ•  ์ˆ˜ ์—†๋‹ค.
1.
ServletExceptionย ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ–ˆ๊ฑฐ๋‚˜
2.
์›น ์„œ๋ฒ„์— ์˜ํ•ด ์ •ํ•ด์ง„ ์‹œ๊ฐ„ ๋‚ด์— ๋ฐ˜ํ™˜๋˜์ง€ ์•Š๋Š”๋‹ค๋ฉด,
์ปจํ…Œ์ด๋„ˆ๋Š” ์„œ๋ธ”๋ฆฟ์„ ๋“ฑ๋กํ•  ์ˆ˜ ์—†๋‹ค.

service ๋ฉ”์†Œ๋“œ

void service(ServletRequest req, ServletResponse res) throws ServletException, java.io.IOException
Java
๋ณต์‚ฌ
์„œ๋ธ”๋ฆฟ์ด ์š”์ฒญ์— ์‘๋‹ตํ•˜๋„๋ก ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ์—์„œ ํ˜ธ์ถœ๋˜๋Š” ๋ฉ”์†Œ๋“œ์ด๋‹ค. ์„œ๋ธ”๋ฆฟ์˜ย init()ย ๋ฉ”์†Œ๋“œ๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ๋๋‚œ ์ดํ›„์— ์ด ๋ฉ”์†Œ๋“œ๊ฐ€ ์‹คํ–‰๋œ๋‹ค. ์‘๋‹ต์˜ ์ƒํƒœ ์ฝ”๋“œ๋Š” ํ•ญ์ƒ ์—๋Ÿฌ๋ฅผ ๋ณด๋‚ด๊ฑฐ๋‚˜ ๋˜์ง€๊ธฐ ์œ„ํ•ด ์„ค์ •๋˜์–ด์•ผ ํ•œ๋‹ค.
์„œ๋ธ”๋ฆฟ๋“ค์€ ์ผ๋ฐ˜์ ์œผ๋กœ ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๋“ค ๋‚ด๋ถ€์—์„œ ์‹คํ–‰๋œ๋‹ค. ์ด ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๋“ค์€ ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์š”์ฒญ์„ ๋™์‹œ๋‹ค๋ฐœ์ ์œผ๋กœ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐœ๋ฐœ์ž๋Š” ๊ณต์œ ๋œ ์ž์›์— ๋Œ€ํ•œ ์ ‘๊ทผ, ๋„คํŠธ์›Œํฌ ์ปค๋„ฅ์…˜, ์„œ๋ธ”๋ฆฟ ํด๋ž˜์Šค ์ ‘๊ทผ, ์„œ๋ธ”๋ฆฟ ์ธ์Šคํ„ด์Šค ๋ณ€์ˆ˜ ์ ‘๊ทผ ๋“ฑ์„ ๋ฐ˜๋“œ์‹œ ๋™๊ธฐํ™” ์‹œ์ผœ์ฃผ์–ด์•ผ ํ•œ๋‹ค.

์„œ๋ธ”๋ฆฟ ๊ฐ์ฒด์˜ ์žฌ์‚ฌ์šฉ

์ผ๋‹จ ์ƒ์„ฑ๋œย Servletย ๊ฐ์ฒด๋Š” ๋ฉ”๋ชจ๋ฆฌ์— ๋‚จ๊ฒจ๋‘์–ด, ๋™์ผํ•œ ์„œ๋ธ”๋ฆฟ์— ๋Œ€ํ•ด ์š”์ฒญ์ด ์˜จ๋‹ค๋ฉด ๋‹ค์‹œย init()ย ๋ถ€ํ„ฐ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ์ด์ „์— ๋ฉ”๋ชจ๋ฆฌ์— ๋‚จ๊ฒจ๋‘์—ˆ๋˜ ๊ฒƒ์„ ์žฌ์‚ฌ์šฉํ•œ๋‹ค.
๊ทธ๋ž˜์„œ ์ž๋ฐ” ์„œ๋ธ”๋ฆฟ์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ ํŽ˜์ด์ง€๋Š” ์ฒซ ๋กœ๋”ฉ ๋•Œ๋Š” ์ƒ๋Œ€์ ์œผ๋กœ ๋Š๋ ธ๋‹ค๊ฐ€ ๊ทธ ์ดํ›„์—๋Š” ๋ฏธ๋ฆฌ ๋กœ๋”ฉ๋œ ์„œ๋ธ”๋ฆฟ์„ ์ด์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ƒ๋Œ€์ ์œผ๋กœ ๋น ๋ฅด๋‹ค.

Tomcat์—์„œ์˜ Servlet

๊ณต์‹ ๋ฌธ์„œ ์ฐธ์กฐ

์„œ๋ธ”๋ฆฟ ์ธํ„ฐํŽ˜์ด์Šค

โ€ข
์„œ๋ธ”๋ฆฟ์€ ์›น์„œ๋ฒ„ ๋‚ด๋ถ€์—์„œ ๋™์ž‘ํ•˜๋Š” ์ž‘์€ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ์ด๋‹ค.
โ€ข
์„œ๋ธ”๋ฆฟ์€ ์›นํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์š”์ฒญ์„ ๋ฐ›๊ณ  ๊ทธ์— ์‘๋‹ต์„ ํ•ด์ค€๋‹ค.
โ—ฆ
์ฃผ๋กœ HTTP๋ฅผ ํ†ตํ•œ๋‹ค.
โ€ข
javax.servletGenericServletย ํ˜น์€ย javax.servlet.http.HttpServlet์„ ์ƒ์†๋ฐ›์•„์„œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ตฌํ˜„ ๊ฐ€๋Šฅํ•˜๋‹ค.

GenericServlet๊ณผ HttpServlet

โ€ข
GenericServlet์ด๋ž€?
.service()ย ๋ฉ”์†Œ๋“œ๋ฅผ ์ œ์™ธํ•œ ๋‚˜๋จธ์ง€๋‹ค. Servlet ์ธํ„ฐํŽ˜์ด์Šค ๋ฉ”์†Œ๋“œ๋ฅผ ๊ตฌํ˜„ํ•ด๋†“์€ย abstract class HTTPย ํ”„๋กœํ† ์ฝœ ์™ธย ๋…๋ฆฝ์ ์ธ ํ”„๋กœํ† ์ฝœ ์„œ๋ธ”๋ฆฟ์„ ๋งŒ๋“ค ๋•Œ ์‚ฌ์šฉ๋œ๋‹ค.
โ€ข
HttpServlet
์šฐ๋ฆฌ๊ฐ€ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ์„œ๋ธ”๋ฆฟ์ด๋‹ค.ย GenericServlet์„ ์ƒ์†๋ฐ›๊ณ  ์ถ”๊ฐ€๋กœย HTTP ํ”„๋กœํ† ์ฝœ์˜ ๊ธฐ๋Šฅย (doGet, doPost, ...)์„ ์ œ๊ณตํ•œ๋‹ค.

์Šคํ”„๋ง ์„œ๋ธ”๋ฆฟ์˜ ์ƒ์† ๊ด€๊ณ„

์œ„์™€ ๊ฐ™์€ ์ƒ์† ๊ด€๊ณ„๋ฅผ ๊ฐ–๋Š”๋‹ค. HttpServlet๊นŒ์ง€๋Š”ย WAS๋ผ ๋ถˆ๋ฆฌ๋Š” ํ†ฐ์บฃ์—์„œ ๊ตฌํ˜„๋˜๊ณ , ์Šคํ”„๋ง์€ย WAS๋กœ ๋ถ€ํ„ฐ ์ƒ์†๋ฐ›์€ย HttpServlet์„ ์ด์šฉํ•˜์—ฌ ์Šคํ”„๋ง์—์„œ ์“ฐ์ด๋Š”ย Servlet๋“ค์„ ๊ตฌํ˜„ํ•œ๋‹ค.

Reference

[Tomcat] Tomcat, JSP, Servlet ๊ฐœ๋… ๋ฐ ๊ตฌ์กฐ
1. Servlet๊ณผ JSP JSP(Java Server Page) ํ™•์žฅ์ž๊ฐ€ .jsp ํŒŒ์ผ html ๋ฌธ์„œ์•ˆ์— ์ž๋ฐ” ์–ธ์–ด๋ฅผ ์‚ฝ์ž…ํ•ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋กํ•จ Servlet์„ ์‚ฌ์šฉํ•ด ์›น์„ ๋งŒ๋“ค ๊ฒฝ์šฐ ํ™”๋ฉด ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌํ˜„์ด ์–ด๋ ต๋‹ค๋Š” ๋‹จ์ ์„ ๋ณด์™„ํ•˜๊ธฐ ์œ„ํ•ด ๋งŒ๋“  ์Šคํฌ๋ฆฝํŠธ ์–ธ์–ด Servlet ํ™•์žฅ์ž๊ฐ€ java ํŒŒ์ผ ์ž๋ฐ”์˜ ์ผ๋ฐ˜์ ์ธ ํด๋ž˜์Šค์™€ ๋™์ผํ•œ ๊ฐœ๋… ์›น์„ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” โ€œHttpServletโ€ ํด๋ž˜์Šค๋ฅผ ์ƒ์†๋ฐ›์€ ํด๋ž˜์Šค๋ฅผ ์˜๋ฏธํ•จ ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์ˆ˜ํ–‰๊ณผ์ • ์‚ฌ์šฉ์ž๊ฐ€ URL(๋˜๋Š” IP)์„ ํ†ตํ•ด WEB ์„œ๋ฒ„๋ฅผ ํ˜ธ์ถœํ•˜๊ณ  ์š”์ฒญ์‚ฌํ•ญ์„ ๊ฐ์ฒด(request)์— ๋‹ด์•„์„œ ์ „์†กํ•จ WEB ์„œ๋ฒ„๋Š” ์š”์ฒญ ๊ฐ์ฒด(request)์„ ๋ฐ›์•„์„œ ๋ฐ”๋กœ ์ฒ˜๋ฆฌํ•˜๊ฑฐ๋‚˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„(WAS)๋กœ ๊ฐ์ฒด๋ฅผ ์ „๋‹ฌํ•จ WAS ์„œ๋ฒ„๋Š” ์š”์ฒญ์— ๋Œ€ํ•œ ๋‚ด์šฉ๊ณผ ์š”์ฒญ ๊ฐ์ฒด(..