RESTful 서비스에서 하나의 리소스는 여러개의 Represenation 을 가질 수 있음.


Spring MVC 에서 Content Negotiation 이 View 를 선택하는 방법은 3가지가 있음.

1. A path extension (suffix) in the URL : favorPathExtension(true)
 - 확장자를 보고 선택하는 방법으로
http://localhost/get/user.xml or http://localhost/get/user.json
과 같은 형태.

2. A URL parameter : favorParameter(true)
 - http://localhost/get/user?format=xml 과 같은 형태로 파라미터에 전달된 값으로
선택하는 방법. format 은 변경 가능한 값(parameterName("mediaType"))

3. Accept HTTP header property : ignoreAcceptHeader(false)
 - 마지막으로 Accept 헤더에 포함 된 media type 으로 선택하는 방법이 있다.

세가지 모두 설정 된 경우 우선순위는 1~3.

Content Negotiation 설정과 무관하게 Accept 헤더는 지원 가능한
representation 으로 요청 해야 한다.
당연히 지원 불가한 타입인 경우 Content Negotiation 처리 이전에 HttpMediaTypeNotAcceptableException 이 발생한다.

참조 : http://theblasfrompas.blogspot.kr/2013/10/spring-mvc-rest-content-negotiation.html

'Spring' 카테고리의 다른 글

Json Null 값 안보이게 하기  (0) 2014.01.27

이클립스에 특화된 툴

WireframeSketcher  이클립스 플러그인(http://wireframesketcher.com/)

'Eclipse' 카테고리의 다른 글

리눅스 Eclipse Svn 계정 변경  (0) 2014.05.07
Eclipse 3.7 + Svn  (0) 2011.12.01
이클립스 메모리 관리  (0) 2011.07.12
eclipse 3.6 HeliosにVisualEditor을 인스톨  (0) 2011.02.11
Eclipse + Tomcat6.0 + postgres8.3  (0) 2010.08.06


- 1번 게스트 확장

sudo apt-get install build-essential linux-headers-$(uname -r)

sudo apt-get install virtualbox-ose-guest-x11

sudo reboot

---------------------------------------------------------------------------------------

- 2번 게스트 확장

$sudo apt-get remove virtualbox-* 실행 후,

다시 $sudo apt-get install virtualbox-*

sudo reboot


1번 방식이 안 될경우 2번


'리눅스' 카테고리의 다른 글

도스 텍스트를 유닉스 텍스트로  (0) 2014.03.04
Too many open files  (0) 2012.01.26

+ Recent posts