JsonForward.java :  » MVC » simpleframework » net » simpleframework » web » page » Java Open Source

Java Open Source » MVC » simpleframework 
simpleframework » net » simpleframework » web » page » JsonForward.java
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);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.