Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
d432240e
Commit
d432240e
authored
Aug 25, 2017
by
stylefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工具类加上渲染工具类
parent
ab2aed47
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
guns-core/src/main/java/com/stylefeng/guns/core/exception/GunsExceptionEnum.java
+5
-0
guns-core/src/main/java/com/stylefeng/guns/core/util/RenderUtil.java
+31
-0
No files found.
guns-core/src/main/java/com/stylefeng/guns/core/exception/GunsExceptionEnum.java
View file @
d432240e
...
...
@@ -8,6 +8,11 @@ package com.stylefeng.guns.core.exception;
public
enum
GunsExceptionEnum
{
/**
* 其他
*/
WRITE_ERROR
(
500
,
"渲染界面错误"
),
/**
* 文件上传
*/
FILE_READING_ERROR
(
400
,
"FILE_READING_ERROR!"
),
...
...
guns-core/src/main/java/com/stylefeng/guns/core/util/RenderUtil.java
0 → 100644
View file @
d432240e
package
com
.
stylefeng
.
guns
.
core
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.stylefeng.guns.core.exception.GunsException
;
import
com.stylefeng.guns.core.exception.GunsExceptionEnum
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
/**
* 渲染工具类
*
* @author fengshuonan
* @date 2017-08-25 14:13
*/
public
class
RenderUtil
{
/**
* 渲染json对象
*/
public
static
void
renderJson
(
HttpServletResponse
response
,
Object
jsonObject
)
{
try
{
response
.
setCharacterEncoding
(
"UTF-8"
);
PrintWriter
writer
=
response
.
getWriter
();
writer
.
write
(
JSON
.
toJSONString
(
jsonObject
));
}
catch
(
IOException
e
)
{
throw
new
GunsException
(
GunsExceptionEnum
.
WRITE_ERROR
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment