简体   繁体   English

Restlet对POST请求的响应

[英]Restlet response to POST request

First off, I'm using an older version of Restlet (1.1). 首先,我使用的是Restlet(1.1)的旧版本。

Secondly, I'm not sure I'm doing the correct thing. 其次,我不确定我在做正确的事情。 Here's what I'm trying to do... 这就是我想要做的...

I'm creating a reporting service (resource). 我正在创建报告服务(资源)。 I'd like my service to listen for POST requests. 我希望我的服务监听POST请求。 The body of the request will contain the report definition. 请求的正文将包含报告定义。 I'd like the response to be the CSV file generated by the service (the report). 我希望响应是服务(报告)生成的CSV文件。 Is responding to a POST request in this manner OK from a REST standpoint (if not, then how to refine this resource)? 从REST的角度来看,以这种方式响应POST请求是否可以(如果没有,那么如何优化此资源)?

I can't seem to figure out how the acceptRepresentation() generates the response. 我似乎无法弄清楚acceptRepresentation()如何生成响应。 I've tried setting the Representation parameter passed into the method to a new FileRepresentation . 我尝试将传递给方法的Representation参数设置为新的FileRepresentation I've also tried to utilize the represent() method, but it doesn't seem like that method is called as part of the POST processing. 我也尝试过使用represent()方法,但是似乎该方法没有作为POST处理的一部分被调用。

How can I accomplish this seeming easy task? 我该如何完成这项看似简单的任务?

acceptRepresentation()调用getResponse().setEntity()方法将接受新的FileRepresentation并完成我想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM