0

我想记录由此产生的 xml。我怎样才能做到这一点 ?

    @GET
    @Path("add")
    @Producse("application/xml")
    public List<String>getCustomerList(....) {


      }
    }

更新

为什么我需要这个是因为,我想要使用请求和响应标头、正文等进行数据库日志记录

4

1 回答 1

0

不知道你所说的日志是什么意思——你的意思是在网页上显示吗?所以假设 CustomerList 被注释并且 Customer 类也被注释并且每个都有 getter 和 setter。

 @GET
 @Path("add")
 @Produces(MediaType.APPLICATION_XML)
 public Response returnListOfCustomers() {
     CustomerList returnMe = this.getMyCustomerList(); // <-- Made this method up
     return Response.ok(returnMe).build()

  }

这是假设您正在尝试创建一个 Restful 服务:JAX-RS。

于 2013-10-22T12:19:01.980 回答