Wicket http发布,从servletrequest获取原始数据?

Wicket http发布,从servletrequest获取原始数据?,第1张

Wicket http发布,从servletrequest获取原始数据?

似乎

Page
对后参数有所帮助。

我的问题的解决方案是使用资源。

    public class MyResource extends AbstractResource    @Override    protected ResourceResponse newResourceResponse( Attributes attributes )    {        ResourceResponse resourceResponse = new ResourceResponse();        resourceResponse.setContentType( "text/json" );        resourceResponse.setTextEncoding( "utf-8" );        HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();        try        { this.json = IOUtils.toString( request.getInputStream() );        }        catch ( IOException e )        { e.printStackTrace();        }        resourceResponse.setWriteCallback( new WriteCallback()        { @Override public void writeData( Attributes attributes ) throws IOException {     OutputStream outputStream = attributes.getResponse().getOutputStream();     Writer writer = new OutputStreamWriter( outputStream );     writer.write( MyResource.this.json );     writer.close(); }        } );        return resourceResponse;    }


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5013426.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-14
下一篇 2022-11-14

发表评论

登录后才能评论

评论列表(0条)

保存