0

I am attempting to grab the XML from the MessageContext that JAXRS is passing in. Is there a way to get the contents of the XML directly from the methods contained in a MessageContext object?

I thought this would work:

@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...

But the information inside these is not what I am looking for. I just want the XML that is being pushed in the request.

There are options for logging interceptors, but I don't want to just log the request, I want to actually have the XML to do some manipulation on.

1 Answer 1

0

You can use getRequest from the api. Then you just want to translate request to a string, as mentioned in here, here and here

2
  • I have tried the bufferedreader, the inputstream, and the getParameter all seperately and they seem to be coming back null.
    – worm
    Dec 5, 2013 at 21:11
  • 1
    Or the message is empty, but it definitly shouldn't be at this point. Why else would I pass around the MessageContext?
    – worm
    Dec 5, 2013 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.