728x90
httpServletRequest & httpServletResponse
-> WAS(tomcat서버)가 패킷을 받을때 생성하는 요청객체 & 응답 객체
🎈httpServletRequest
-
Http프로토콜의 request 정보를 서블릿에게 전달
-
Header정보, Parameter, Cookie, URI, URL 등의 정보를 읽는 메소드를 가진 클래스
-
Body의 Stream을 읽어들이는 메소드를 가지고 있음
- was(tomcat)가 패킷을 받을때 생성하게
- 요청시 header와 body를 저장
🎈httpServletResponse
-
Servlet은 HttpServletResponse객체에 Content Type, 응답코드, 응답 메시지등을 담아서 전송함
🍭기본 URL 정보
http://127.0.0.1:8080/contextpath/main/main.do?no=1&cn=p0980
🍭httpServletRequest.getRequestURL()
http://127.0.0.1:8080/contextpath/main/main.do
🍭httpServletRequest.getRequestURI()
/contextpath/servlcetpath/main/main.do?
🍭httpServletRequest.getContextPath()
/contextpath
🍭httpServletRequest.getServletPath()
/servlcetpath/main/main.do
🍭httpServletRequest.getQueryString()
no=1&cn=p0980
🍭httpServletRequest.getServerName()
127.0.0.1
🍭httpServletRequest.getServerPort()
8080
728x90
'❤️01_Java' 카테고리의 다른 글
#MVC패턴이란 #MVC_design_pattern #Model #View #Controll #MVVM(Model-View_ViewModel (0) | 2023.11.16 |
---|---|
#Null #개발자숙제 #Null이야기 (0) | 2023.11.15 |
#java #exception #CheckedException #UncheckedException #Runtime Exception #Error (1) | 2023.11.14 |
#JDBC #HikariCP #ibatis #mybatis #jpa #java #FrameWork (0) | 2023.11.08 |
#SSE(Server-Sent-Events) #ShortPolling #LongPolling #WebSocket (0) | 2023.01.13 |
댓글