如何从JAXRS MessageContext发布xml?

时间:2013-12-05 19:28:09

标签: java http cxf jax-rs

我试图从JAXRS传入的MessageContext中获取XML。有没有办法直接从MessageContext对象中包含的方法获取XML的内容?

我认为这样可行:

@PUT
@Path ("/")
@Consumes ({ "application/json", "application/xml" })
@Produces ({ "text/html", "application/json", "application/xml" })
public Response update(@Context MessageContext mc) {
    mc.getHttpServletRequest().get....
    // unsure of how to grab the actual xml from the request...

但是这些信息并不是我想要的。我只想要在请求中推送的XML。

可以选择记录拦截器,但我不想只记录请求,我希望实际上让XML进行一些操作。

1 个答案:

答案 0 :(得分:0)

您可以使用api中的getRequest。然后,您只想将请求转换为字符串,如hereherehere

中所述
相关问题