11-15 06:12
Recent Posts
Recent Comments
๊ด€๋ฆฌ ๋ฉ”๋‰ด

miinsun

[Spring] ํ•œ๊ธ€ ํŒŒ๋ผ๋ฏธํ„ฐ ๊นจ์ง ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ๋ณธ๋ฌธ

WebApp/Spring

[Spring] ํ•œ๊ธ€ ํŒŒ๋ผ๋ฏธํ„ฐ ๊นจ์ง ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

miinsun 2022. 2. 3. 23:08

 

๐Ÿ“Œ ์›์ธ : ํ•œ๊ธ€ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๋„˜๊ฒจ api ํ…Œ์ŠคํŠธํ–ˆ์„ ๋•Œ ์œ„์™€ ๊ฐ™์ด ํ•œ๊ธ€์ด ๊นจ์ง„๋‹ค.

 

๐Ÿ“Œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

GET๊ณผ POST๋ฐฉ์‹์ด ์„œ๋กœ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์œผ๋กœ ํ•ด๊ฒฐ ๊ฐ€๋Šฅํ•˜๋‹ค.

 

1. POST ๋ฐฉ์‹ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

web.xml ์ถ”๊ฐ€

<filter>
	<filter-name>encodingFilter</filter-name> 
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    	<param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param> 
</filter>
<filter-mapping>
	<filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

 

2. GET ๋ฐฉ์‹ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

server.xml ์ถ”๊ฐ€

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>

 

 

๐Ÿ“Œ ํ•ด๊ฒฐ ์™„๋ฃŒ

์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ํ•„์š”ํ•œ '์ˆฒ'์„ ์ธ์‹ํ•ด ํ•„์š”ํ•œ ๊ฐ’์„ ๋ฆฌํ„ดํ•ด์ค€๋‹ค.

Comments