[Spring] CH04 MIME 타입 (책)

jaegeunsong97·2023년 2월 18일
0

[Fast Campus] Spring

목록 보기
4/44
post-thumbnail

📕 MIME 타입이란

MIME 타입이란 클라이언트에게 전송된 문서의 다양성을 알려주기 위한 메커니즘입니다: 웹에서 파일의 확장자는 별 의미가 없습니다. 그러므로, 각 문서와 함께 올바른 MIME 타입을 전송하도록, 서버가 정확히 설정하는 것이 중요합니다. 브라우저들은 리소스를 내려받았을 때 해야 할 기본 동작이 무엇인지를 결정하기 위해 대게 MIME 타입을 사용합니다.

https://developer.mozilla.org/ko/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types

📕 중간 언어 이해

JavaScript Object Notation (JSON)은 Javascript 객체 문법으로 구조화된 데이터를 표현하기 위한 문자 기반의 표준 포맷입니다. 웹 어플리케이션에서 데이터를 전송할 때 일반적으로 사용합니다(서버에서 클라이언트로 데이터를 전송하여 표현하려거나 반대의 경우)

📜 <javascript, class, json, xml, yaml>

🔔 javascript

let transaction = {
	id:6,
	gubun:"입금",
	sender:"ATM",
	reciver:1111,
	amount:100,
	createdAt:"2023-01-08 12:13:40"
}

🔔 java class

public class Transaction {
	Long id=6;
	String gubun="입금";
	String sender="ATM";
	String reciver=1111;
	Long amount=100;
	String createdAt="2023-01-08 12:13:40";
}

🔔 json

{
	"id":6,
	"gubun":"입금",
	"sender":"ATM",
	"reciver":1111,
	"amount":100,
	"createdAt":"2023-01-08 12:13:40"
}

🔔 xml

<transaction>
	<id>6</id>
	<gubun>입금</gubun>
	<sender>ATM</sender>
	<reciver>1111</reciver>
	<amount>100</amount>
	<createdAt>2023-01-08 12:13:40</createdAt>
</transaction>

🔔 yaml

id: 6
gubun: 입금
sender: ATM
reciver: 1111
amount: 100
createdAt: 2023-01-08 12:13:40

📕 GSON 라이브러리 실습

📜 라이브러리 다운로드

https://mvnrepository.com/artifact/com.google.code.gson/gson/2.10.1

📜 블로그 라이브러리 다운로드

https://blog.naver.com/getinthere/223009231524

📜 소스코드

https://github.com/codingspecialist/socket-study.git

📕 반이중 통신으로 인터페이스에 맞게 데이터 전달하고 받기

📜 멀티쓰레드 프로세스

📜 반이중 구현

📜 msg -> application/json

📜 msg -> application/x-www-form-urlencoded

📜 msg-> text/html

📜 msg -> text/plain

class Data {
	private String title;
	private String content;
}

요청에 따라, 파싱하여 응답하는 소켓 서버를 구현하라. 반이중으로 구현하고, 멀티쓰레드 프로세스가 되어야 한다

📜 소스코드

https://github.com/codingspecialist/socket-study.git

profile
블로그 이전 : https://medium.com/@jaegeunsong97

0개의 댓글