在一个响应中Contactenat两个字符串

时间:2015-12-08 10:34:48

标签: java servlets response runtimeexception

我想在two String中连接one response。我是这样做的:

String ch1 = Response.status(Response.Status.OK)
                .entity(val1).type(MediaType.APPLICATION_XML_TYPE)
                .build().getEntity().toString();

        String ch2 = Response.status(Response.Status.OK)
                .entity(val2).type(MediaType.APPLICATION_XML_TYPE)
                .build().getEntity().toString();


        Response res = Response.status(Response.Status.OK)
                .entity(ch1+"\n"+ch2).type(MediaType.APPLICATION_XML_TYPE).build();

        return res;

但是我在执行时遇到了这个异常

Etat HTTP 500 - java.lang.RuntimeException: input: application.ApplicationType@5172c28d
java.lang.RuntimeException: java.lang.RuntimeException: input: application.ApplicationType@5172c28d
application.ApplicationType@4542e0c1, indent: 2
    client.APIClient.prettyFormat(APIClient.java:295)
    client.APIClient.doPost(APIClient.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

谁能告诉我问题在哪里?

0 个答案:

没有答案