Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
2af89168
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2af89168
编写于
7月 31, 2013
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
Issue: SPR-10752 Issue: SPR-10627 (cherry picked from commit
ae0f23e9
)
上级
85c9ed00
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
25 deletion
+25
-25
spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java
...p/converter/json/MappingJackson2HttpMessageConverter.java
+9
-9
spring-web/src/main/java/org/springframework/http/converter/json/MappingJacksonHttpMessageConverter.java
...tp/converter/json/MappingJacksonHttpMessageConverter.java
+2
-1
spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java
...mework/web/servlet/view/json/MappingJackson2JsonView.java
+9
-10
spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJacksonJsonView.java
...amework/web/servlet/view/json/MappingJacksonJsonView.java
+5
-5
未找到文件。
spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java
浏览文件 @
2af89168
...
...
@@ -20,6 +20,14 @@ import java.io.IOException;
import
java.lang.reflect.Type
;
import
java.nio.charset.Charset
;
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.HttpOutputMessage
;
import
org.springframework.http.MediaType
;
...
...
@@ -29,14 +37,6 @@ import org.springframework.http.converter.HttpMessageNotReadableException;
import
org.springframework.http.converter.HttpMessageNotWritableException
;
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} that
* can read and write JSON using <a href="http://jackson.codehaus.org/">Jackson 2.x's</a> {@link ObjectMapper}.
...
...
@@ -115,7 +115,7 @@ public class MappingJackson2HttpMessageConverter extends AbstractHttpMessageConv
* @see #setJsonPrefix
*/
public
void
setPrefixJson
(
boolean
prefixJson
)
{
this
.
jsonPrefix
=
prefixJson
?
"{} && "
:
null
;
this
.
jsonPrefix
=
(
prefixJson
?
"{} && "
:
null
)
;
}
/**
...
...
spring-web/src/main/java/org/springframework/http/converter/json/MappingJacksonHttpMessageConverter.java
浏览文件 @
2af89168
...
...
@@ -26,6 +26,7 @@ import org.codehaus.jackson.JsonProcessingException;
import
org.codehaus.jackson.map.ObjectMapper
;
import
org.codehaus.jackson.map.SerializationConfig
;
import
org.codehaus.jackson.type.JavaType
;
import
org.springframework.http.HttpInputMessage
;
import
org.springframework.http.HttpOutputMessage
;
import
org.springframework.http.MediaType
;
...
...
@@ -112,7 +113,7 @@ public class MappingJacksonHttpMessageConverter extends AbstractHttpMessageConve
* @see #setJsonPrefix
*/
public
void
setPrefixJson
(
boolean
prefixJson
)
{
this
.
jsonPrefix
=
prefixJson
?
"{} && "
:
null
;
this
.
jsonPrefix
=
(
prefixJson
?
"{} && "
:
null
)
;
}
/**
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java
浏览文件 @
2af89168
...
...
@@ -23,28 +23,27 @@ import java.util.Collections;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.fasterxml.jackson.core.JsonEncoding
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.servlet.View
;
import
org.springframework.web.servlet.view.AbstractView
;
import
com.fasterxml.jackson.core.JsonEncoding
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
/**
* Spring MVC {@link View} that renders JSON content by serializing the model for the current request
* using <a href="http://jackson.codehaus.org/">Jackson 2
.x
's</a> {@link ObjectMapper}.
* using <a href="http://jackson.codehaus.org/">Jackson 2's</a> {@link ObjectMapper}.
*
* <p>By default, the entire contents of the model map (with the exception of framework-specific classes)
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as
*
JSON alone via
{@link #setExtractValueFromSingleKeyModel}.
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as
JSON
*
alone via
{@link #setExtractValueFromSingleKeyModel}.
*
* @author Jeremy Grelle
* @author Arjen Poutsma
...
...
@@ -142,7 +141,7 @@ public class MappingJackson2JsonView extends AbstractView {
* @see #setJsonPrefix
*/
public
void
setPrefixJson
(
boolean
prefixJson
)
{
this
.
jsonPrefix
=
prefixJson
?
"{} && "
:
null
;
this
.
jsonPrefix
=
(
prefixJson
?
"{} && "
:
null
)
;
}
/**
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJacksonJsonView.java
浏览文件 @
2af89168
...
...
@@ -23,7 +23,6 @@ import java.util.Collections;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -31,6 +30,7 @@ import org.codehaus.jackson.JsonEncoding;
import
org.codehaus.jackson.JsonGenerator
;
import
org.codehaus.jackson.map.ObjectMapper
;
import
org.codehaus.jackson.map.SerializationConfig
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.BindingResult
;
...
...
@@ -39,11 +39,11 @@ import org.springframework.web.servlet.view.AbstractView;
/**
* Spring MVC {@link View} that renders JSON content by serializing the model for the current request
* using <a href="http://jackson.codehaus.org/">Jackson
1.x
's</a> {@link ObjectMapper}.
* using <a href="http://jackson.codehaus.org/">Jackson's</a> {@link ObjectMapper}.
*
* <p>By default, the entire contents of the model map (with the exception of framework-specific classes)
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as
*
JSON alone via
{@link #setExtractValueFromSingleKeyModel}.
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as
JSON
*
alone via
{@link #setExtractValueFromSingleKeyModel}.
*
* @author Jeremy Grelle
* @author Arjen Poutsma
...
...
@@ -141,7 +141,7 @@ public class MappingJacksonJsonView extends AbstractView {
* @see #setJsonPrefix
*/
public
void
setPrefixJson
(
boolean
prefixJson
)
{
this
.
jsonPrefix
=
prefixJson
?
"{} && "
:
null
;
this
.
jsonPrefix
=
(
prefixJson
?
"{} && "
:
null
)
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录