URI란?
Uniform: 리소스를 식별하는 통일된 방식
Resource: 자원, URI로 식별할 수 있는 모든 것(제한 없음. html이나 사진 등 모든 것)
Identifier: 다른 항목과 구분하는데 필요한 정보
URL: Uniform Resource Locator
- Locator: 리소스가 있는 위치를 특정. 홍길동이 사는 아파트에 가면 홍길동이 있다.
URN: Uniform Resource Name
- Name: 리소스에 이름을 부여. 홍길동.
위치는 변할 수 있지만, 이름은 변하지 않는다.
URN 이름만으로 실제 리소스를 찾을 수 있는 방법이 보편화되어 있지 않다. (== 잘 쓰지 않는다)
상용: URI == URL
URI의 문법
scheme
scheme://[userinfo@]host[:port][/path][?query][#fragment]
https://www.google.com:443/search?q=hello&hl=ko
- 주로 프로토콜 사용
- 프로토콜: 어떤 방식으로 자원에 접근할 것인가 하는 약속. 규칙.
- http -> 80, https -> 443, 포트는 생략 가능
- https는 http에 보안을 추가한 것.
userinfo
scheme://[userinfo@]host[:port][/path][?query][#fragment]
https://www.google.com:443/search?q=hello&hl=ko
- URL에 사용자 정보를 포함해서 인증
- 거의 사용하지 않음
host
scheme://[userinfo@]host[:port][/path][?query][#fragment]
https://www.google.com:443/search?q=hello&hl=ko
- 호스트 명(localhost)
- 도메인 명 또는 IP 주소를 직접 사용 가능
PORT
scheme://[userinfo@]host[:port][/path][?query][#fragment]
https://www.google.com:443/search?q=hello&hl=ko
- 접속 포트
- 일반적으로 생략. 생략시 http는 80, https는 443
path
scheme://[userinfo@]host[:port][/path][?query][#fragment]
https://www.google.com:443/search?q=hello&hl=ko
- 리소스 경로, 계층적 구조
- /board/boardCreate
query
scheme://[userinfo@]host[:port][/path][?query][#fragment]
https://www.google.com:443/search?q=hello&hl=ko
- key=value 형태
- ?로 시작, &로 추가 가능 ?keyA=valueA&keyB=valueB
- query parameter, query string 등으로 불림. 웹서버에 제공하는 파라미터, 문자 형태
fragment
scheme://[userinfo@]host[:port][/path][?query][#fragment]
https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started.html#getting-started.introducing-spring-boot
- html 내부 북마크 등에 사용
- 서버에 전송하는 정보 아님
'Computer Science > Network' 카테고리의 다른 글
HTTP 메서드의 분류 및 방식 (0) | 2022.07.11 |
---|---|
HTTP(HyperText Transfer Protocol) 기본 (0) | 2022.07.07 |
www.naver.com이 나타나는 과정 (0) | 2022.07.07 |
인터넷 네트워크(IP, TCP/UDP, PORT, DNS) (0) | 2022.07.07 |
OSI 7계층(OSI 7 Layer)? TCP/IP 4계층? (0) | 2022.07.05 |