studying...
  • 노트의목적
  • 웹전반
    • HTTP
      • 1. HTTP
      • 2. HTTP_Client
      • 3. HTTP_Server
      • 4. JAVA_HTTP_Server
      • 5. Spring_Web_MVC
    • REST_API
      • 1. REST_API
      • 2. URI&MIME_type
      • 3. COLLECTION_Pattern
      • 4. COLLECTION_Pattern_adjustment
      • 5. Spring_Web_MVC
    • DTO_JSON_CORS
      • 1. DTO
      • 2. 직렬화
      • 3. Jackson
      • 4. CORS
    • Layered_Architecture
      • 1. Layered_Architecure
      • 2. Data_Access
      • 3. Domain_Model
    • DI&Spring_Test
      • 1. Dependency_Injection
      • 2. Unit_Test
      • 3. Spring_Test
      • 4. TDD
    • Database
      • 1. Database
      • 2. Relational_Model
      • 3. JDBC
    • JPA
      • 1. ORM
      • 2. Hibernate
      • 3. Embeddable
      • 4. Relationship Mapping
      • 5. Spring Data JPA
    • 도메인_주도_설계
      • 1. DDD
      • 2. Strategic Design
      • 3. Entity, Value Object
      • 4. Aggregate
      • 5. Repository
    • Hexagonal_Architecture
      • 1. SOLID
      • 2. Hexagonal_Architecture
      • 3. 도메인 주도 설계 핵심
    • Spring_Security
      • 1. 애플리케이션 보안
      • 2. 인증
      • 3. 로그인 & 로그아웃
      • 4. 회원가입
      • 5. JWT&Authority
    • File_Upload
      • 1. Multipart_FormData
      • 2. Separation_of_Concerns
      • 3. Cloudinary
    • CQRS
      • 1. CQRS
      • 2. Redis
  • 면접대비
  • book
    • RealMySQL8.0
      • 4장
      • 5장
      • 8장
      • 9장
    • Object
      • 1장
      • 2장
      • 3장
      • 4장
      • 5장
      • 6장
      • 7장
      • 8장
      • 9장
    • ModernJava
      • ch1
      • ch2
    • 클라우드네이티브를위한 쿠버네티스 실전 프로젝트
      • 1장
      • 2장
      • 3장
      • 4장
    • 테라폼 쿡북
      • 2장
      • 3장
      • 4장
      • 5장
      • 6장
  • lecture
    • 외워서끝내는네트워크기초
    • 외워서끝내는네트워크심화
    • aws
      • Architecting_on_AWS
      • Architecrting-advanced
      • Developing_on_AWS
      • migration_essentials
      • Resilience
      • Running_Containers_on_EKS
    • Ansible
    • k8s
      • section2
      • section3
    • Terraform
  • experiences
    • workshops
      • EKS
Powered by GitBook
On this page
  • URI & URL & URN
  • MIME type
  • 개별타입
  • 멀티파트 타입
  1. 웹전반
  2. REST_API

2. URI&MIME_type

Previous1. REST_APINext3. COLLECTION_Pattern

Last updated 1 year ago

URI & URL & URN

정리되어 있다.

MIME type

클라이언트에게 전송된 문서의 다양성을 알려주기 위한 메커니즘으로 브라우저들은 리소스를 내려받았을 때 해야 할 동작이 무엇인지 결정하기 위해 MIME 타입을 사용한다. MIME 타입의 구성은 다음과 같다.

type/subtype

/로 구분된 타입과 서브타입으로 구성되는데 type은 카테고리를 나타내며 개별 혹은 멀티파트 타입이 될 수 있다. subtype은 각각의 타입에 한정된다.

개별타입

개별타입의 종류는 다음과 같다

타입
설명
일반적 서브타입

text

텍스트를 포함하는 모든 문서

text/plain, text/html, text/css, text/javascript

image

모든 종류의 이미지

image/gif, image/png, image/jpeg

audio

오디오 파일

audio/midi, audio/mpeg

video

비디오 파일

video/webm

application

이진데이터

application/xml, application/octet-stream

application/x-www-form-urlencoded

폼을 이용한 POST 전송중에 가장 단순한 방식이 application/x-www-form-urlencoded 방식인데 이는 body의 key와 value가 =, 각각의 요소는 &로 연결된다.

application/octet-stream

이진 파일을 위한 기본값으로 Content-Disposition 헤더가 attachment와 함께 설정되어 save 여부를 결정한다.

멀티파트 타입

멀티파트 타입은 다른 MIME타입들을 지닌 개별적인 파트들로 나누어지는 문서의 카테고리를 가리킨다.

multipart/form-data는 브라우저에서 HTML 폼을 전송시 사용할 수 있는데 --로 구분되어지는 다른 파트들로 구성된다.

POST / HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=---------------------------8721656041911415653955004498
Content-Length: 465

-----------------------------8721656041911415653955004498
Content-Disposition: form-data; name="myTextField"

Test
-----------------------------8721656041911415653955004498
Content-Disposition: form-data; name="myCheckBox"

on
-----------------------------8721656041911415653955004498
Content-Disposition: form-data; name="myFile"; filename="test.txt"
Content-Type: text/plain

Simple file.
-----------------------------8721656041911415653955004498--

일전에 폼 데이터 인코딩이 두번돼서 오는 문제가 있었던 적이 있었는데 스트럿츠 기반의 오래된 시스템이라 이해가 안되고 어느 부분에서 인코딩 되는지도 몰라서 그냥 서버에서 두번 디코딩 하는 임시방편을 썼었는데. 브라우저가 하고있었구나..

출처

나 몰래
mozilla
URI & URL & URN
MIME type
개별타입
application/x-www-form-urlencoded
application/octet-stream
멀티파트 타입
http-client