반응형

httpservletrequestwrapper

    Spring Interceptor와 Filter에서 POST 방식으로 전달된 JSON 데이터 처리하기

    이번 회사 프로젝트에서 진행할 때 parameter값이 아니라 Josn 데이터가 필요할 때가 있었다. 이를 위해서는 HttpServletRequest에서 InputStream으로 데이터를 추출해야한다. 하지만 HttpServletRequest에서 InputStream을 한번 추출하게되면, Controller에서 parameter를 매핑하려고 데이터를 바인딩할 때 다음과 같은 오류가 발생한다. 이는 톰캣에서 막아놓았기 때문이다. [에러내용] 12java.lang.IllegalStateException: getReader() has already been called for this requestorg.springframework.http.converter.HttpMessageNotReadableExcept..

반응형