This commit is contained in:
thinkgem
2021-09-13 14:36:32 +08:00
parent abe4e4be27
commit 135e48008d
3 changed files with 8 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.fasterxml.jackson.databind.util.JSONPObject;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.io.PropertiesUtils;
import com.jeesite.common.lang.ExceptionUtils;
@@ -253,7 +254,8 @@ public class ServletUtils {
}
}
if (response != null){
response.setContentType(MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8");
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding(EncodeUtils.UTF_8);
}
if (object == null) {
object = resultMap;
@@ -362,10 +364,10 @@ public class ServletUtils {
if (type == null && StringUtils.isBlank(response.getContentType())){
if ((StringUtils.startsWith(string, "{") && StringUtils.endsWith(string, "}"))
|| (StringUtils.startsWith(string, "[") && StringUtils.endsWith(string, "]"))){
type = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8";
type = MediaType.APPLICATION_JSON_VALUE;
}else if (StringUtils.startsWith(string, "<") && StringUtils.endsWith(string, ">")){
if (StringUtils.startsWith(string, "<!DOCTYPE")){
type = MediaType.TEXT_HTML_VALUE+";charset=UTF-8";
type = MediaType.TEXT_HTML_VALUE;
}else{
type = MediaType.APPLICATION_XML_VALUE;
}
@@ -375,6 +377,7 @@ public class ServletUtils {
}
if (type != null) {
response.setContentType(type);
response.setCharacterEncoding(EncodeUtils.UTF_8);
}
response.getWriter().print(string);
} catch (IOException e) {

View File

@@ -68,7 +68,7 @@
<!-- docker setting -->
<docker.dockerHost>http://192.168.56.102:2375</docker.dockerHost>
<docker.imageName>${project.groupId}/${project.artifactId}:4.2</docker.imageName>
<docker.imageName>${project.groupId}/${project.artifactId}:4.3</docker.imageName>
</properties>

View File

@@ -22,4 +22,4 @@ ENTRYPOINT java $JAVA_OPTS -cp /app $JAVA_OPTS org.springframework.boot.loader.W
EXPOSE 8980
#docker run -p 8980:8980 com.jeesite/jeesite-web:4.2
#docker run -p 8980:8980 com.jeesite/jeesite-web:4.3