2014-09-10 77 views
3

搜索了很多,但没有看到任何似乎符合我的特定情况/问题的帖子。如何从Jetty AbstractHandler handle()方法检索POST数据?

使用Jetty,我有一个扩展org.eclipse.jetty.server.handler.AbstractHandler的Handler类。

手柄方法如下:

@Override 
    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) 
         throws IOException, ServletException { 

我需要抓住在请求中发送的POST数据,仿佛像这样:

curl -H "Content-Type: application/json" -d '{"url":"http://www.example.com"}' http://localhost:8080/

基本上,我送通过键入'url'的JSON字典向本地主机发送POST请求。我如何检索POST数据?

回答