JSON 응답을 반환하기 위해 Spring 애플리케이션에 JacksonMessageConverter가 있습니다. 하지만 JSON이 반환되기 전에 Ajax Security - Preventing JSON hijacking에 주어진대로 JSON을 오염시키고 싶습니다. 메시지 변환기를 사용할 때 그렇게 할 수 있습니까?Spring JSON 오염 응답 (JacksonMessageConverter)
암이 spring prefixjson with responsebody 유사한 솔루션을 찾고 있지만 이미 구성이 올바르게 설정되어
업데이트.
<bean id="jacksonMessageConverter"
class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<property name="prefixJson" value="true" />
<property name="supportedMediaTypes" value = "text/plain;charset=UTF-8" />
</bean>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="jacksonMessageConverter"/>
</list>
</property>
</bean>
그러나 PFB
은 여전히 반환 된 JSON은 "& & {}"로 시작되지 않습니다.참고 : Ajax Security - Preventing JSON hijacking 에 설명 된 JSON에 다른 접두사를 사용하고 싶지만 Jackson에서 제공되는 기본 지원조차도 작동하지 않는 것 같습니다. 어떤 아이디어?
응답 해 주셔서 감사합니다. 현재이 접근법을 시도하고 있습니다. 한 번 해답으로 게시물을 업데이트합니다. – Raghav