package net.simpleframework.web.page;
import java.util.HashMap;
import java.util.Map;
import net.simpleframework.web.JSONUtils;
/**
* LGPLv3
*
* @author (cknet@126.com, 13910090885)
* http://code.google.com/p/simpleframework/
* http://www.simpleframework.net
*/
public class JsonForward extends TextForward {
private Map<String, Object> map;
public JsonForward(final Map<String, Object> map) {
super(null);
this.map = map;
}
public JsonForward() {
this(null);
}
public Map<String, Object> getMap() {
if (map == null) {
map = new HashMap<String, Object>();
}
return map;
}
@Override
public String getResponseText(final PageRequestResponse requestResponse) throws Exception {
return JSONUtils.toJSON(map);
}
}
|