首页>代码>Java版FastDFS文件服务器,springmvc做的集成>/fastdfs-fileserver/src/main/java/hello/world/fileserver/tools/ServletUtil.java
package hello.world.fileserver.tools;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.MediaType;
import com.alibaba.fastjson.JSON;
/**
*
* @author 宋健
*
* qq 1738042258
*/
public class ServletUtil {
public static void responseOutWithJson(HttpServletResponse response,Object responseObject) {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type",MediaType.APPLICATION_JSON_UTF8_VALUE);
OutputStream out = null;
try {
out = response.getOutputStream();
out.write(JSON.toJSONString(responseObject).getBytes("UTF-8"));
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
最近下载更多
1529860026 LV24
2023年6月1日
lris_luanling LV11
2021年1月22日
simple丶余心 LV21
2020年9月26日
lwp011 LV27
2020年7月7日
王可以 LV10
2020年4月22日
442529474 LV6
2020年3月11日
whtfj LV2
2019年9月6日
huangxing11111 LV1
2019年8月6日
yanghanqiang LV3
2019年7月5日
liujiaweijv LV7
2019年7月5日
最近浏览更多
微信网友_7280795462504448
2024年12月3日
暂无贡献等级
interface LV22
2024年8月10日
1529860026 LV24
2023年6月1日
240598911 LV10
2021年10月25日
axj52520 LV1
2021年9月5日
503382513 LV12
2021年4月16日
liqinwyyx LV6
2021年3月24日
yiposhop LV4
2021年1月22日
lris_luanling LV11
2021年1月21日
0592lyj LV9
2021年1月19日

