public class JsonRender extends Render
IE 不支持content type 为 application/json, 在 ajax 上传文件完成后返回 json时 IE 提示下载文件,
解决办法是使用: render(new JsonRender(params).forIE());
| 限定符和类型 | 字段和说明 |
|---|---|
protected String[] |
attrs |
protected static String |
contentType
http://zh.wikipedia.org/zh/MIME
在wiki中查到: 尚未被接受为正式数据类型的subtype,可以使用x-开始的独立名称(例如application/x-gzip)
所以以下可能要改成 application/x-json
通过使用firefox测试,struts2-json-plugin返回的是 application/json, 所以暂不改为 application/x-json
1: 官方的 MIME type为application/json, 见 http://en.wikipedia.org/wiki/MIME_type
2: IE 不支持 application/json, 在 ajax 上传文件完成后返回 json时 IE 提示下载文件
|
protected static String |
contentTypeForIE |
protected static Set<String> |
excludedAttrs
It creates the extra attribute below while tomcat take SSL open.
|
protected boolean |
forIE |
protected String |
jsonText |
| 构造器和说明 |
|---|
JsonRender() |
JsonRender(Object object) |
JsonRender(String jsonText) |
JsonRender(String[] attrs) |
JsonRender(String key,
Object value) |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addExcludedAttrs(String... attrs)
仅对无参 renderJson() 起作用
|
protected void |
buildJsonText() |
static void |
clearExcludedAttrs() |
JsonRender |
forIE() |
String[] |
getAttrs() |
Boolean |
getForIE() |
String |
getJsonText() |
static void |
removeExcludedAttrs(String... attrs) |
void |
render()
Render to client
|
getDevMode, getEncoding, getView, setContext, setContext, setViewprotected static final Set<String> excludedAttrs
protected static final String contentType
protected static final String contentTypeForIE
protected boolean forIE
protected String jsonText
protected String[] attrs
public JsonRender()
public JsonRender(String[] attrs)
public JsonRender(String jsonText)
public JsonRender(Object object)
public static void addExcludedAttrs(String... attrs)
public static void removeExcludedAttrs(String... attrs)
public static void clearExcludedAttrs()
public JsonRender forIE()
protected void buildJsonText()
public String[] getAttrs()
public String getJsonText()
public Boolean getForIE()
Copyright © 2022. All rights reserved.