Obtaining raw request body in JAX-RS resource method

前端 未结 3 766
-上瘾入骨i
-上瘾入骨i 2020-12-15 22:21

How can I access the raw request body from a JAX-RS resource method, as java.io.InputStream or byte[]? I want the container to bypass any Mes

3条回答
  •  感情败类
    2020-12-15 23:03

    I found the reason that injecting HttpServletRequest did not work, it's because I did run my code in Jersey Test Framework, not within a proper Servlet container. It works if I run it in a proper Servlet container.

    It is a pity that there is no pure JAX-RS way of getting the raw request body.

提交回复
热议问题