【发布时间】:2017-11-15 07:52:46
【问题描述】:
我使用的是 Jersey 1.9,在这种情况下,为了允许跨域问题,我使用 JsonWithPadding (com.sun.jersey.api.json.JSONWithPadding) 包装了我的对象。如果没有 JsonWithPadding,它会返回正确的 JSON 响应。
完美使用 JsonWithPadding,如果我切换到 Jersey 2,它会给我以下错误。我使用的是 eclipse neon,tomcat 8。
它甚至不会在控制台上抛出任何错误,而是我在访问日志中发现错误 500 以及我认为是安全(木马)问题的 1082。
访问日志
172.22.14.88 - - [13/Jun/2017:09:17:49 -0400] "GET /csmgt/rest/client/HTTP/1.1" 500 1082
回应:
<!DOCTYPE html>
<html>
<head>
<title>Apache Tomcat/8.0.28 - Error report</title>
<style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style>
</head>
<body>
<h1>HTTP Status 500 - Internal Server Error</h1>
<div class="line"></div>
<p>
<b>type</b> Status report
</p>
<p>
<b>message</b>
<u>Internal Server Error</u>
</p>
<p>
<b>description</b>
<u>The server encountered an internal error that prevented it from fulfilling this request.</u>
</p>
<hr class="line">
<h3>Apache Tomcat/8.0.28</h3>
</body>
</html>
感谢您对 JsonWithPadding 的任何帮助。
【问题讨论】:
标签: eclipse jersey jersey-2.0 tomcat8