|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2012 the original author or authors. |
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -21,6 +21,14 @@ import java.lang.reflect.Type; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonEncoding; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonGenerator; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JavaType; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.SerializationFeature; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.http.HttpInputMessage; |
|
|
|
import org.springframework.http.HttpInputMessage; |
|
|
|
import org.springframework.http.HttpOutputMessage; |
|
|
|
import org.springframework.http.HttpOutputMessage; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
@ -30,14 +38,6 @@ import org.springframework.http.converter.HttpMessageNotReadableException; |
|
|
|
import org.springframework.http.converter.HttpMessageNotWritableException; |
|
|
|
import org.springframework.http.converter.HttpMessageNotWritableException; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonEncoding; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonGenerator; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JavaType; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.SerializationFeature; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} |
|
|
|
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} |
|
|
|
* that can read and write JSON using <a href="http://jackson.codehaus.org/">Jackson 2's</a> {@link ObjectMapper}. |
|
|
|
* that can read and write JSON using <a href="http://jackson.codehaus.org/">Jackson 2's</a> {@link ObjectMapper}. |
|
|
|
@ -119,7 +119,7 @@ public class MappingJackson2HttpMessageConverter extends AbstractHttpMessageConv |
|
|
|
* @see #setJsonPrefix |
|
|
|
* @see #setJsonPrefix |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setPrefixJson(boolean prefixJson) { |
|
|
|
public void setPrefixJson(boolean prefixJson) { |
|
|
|
this.jsonPrefix = prefixJson ? "{} && " : null; |
|
|
|
this.jsonPrefix = (prefixJson ? "{} && " : null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|