似乎
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; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)