package com.huatek.frame.base.util;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

/**
 * @author key_dong
 *
 */
public class ResponseEntity {

	/**
	 * 向客户端浏览器输出字符串.
	 * 
	 * @param response
	 * @param bean
	 */
	public static void toJson(HttpServletResponse response, Object bean) {
		try {
			response.setContentType("application/json;charset=utf-8");
			response.getWriter().write(JSON.toJSONString(bean, SerializerFeature.WriteDateUseDateFormat,
					SerializerFeature.DisableCircularReferenceDetect));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
