简体   繁体   English

基于REST的应用程序中的HTTP GET,以转换服务器上的数据并返回结果

[英]HTTP GET in a REST based application to transform data on server and return the result

I have a REST based application which is being upgraded from v1 to v2 and migration has to be done lazily. 我有一个基于REST的应用程序,该应用程序已从v1升级到v2,迁移工作很懒惰。

In v1 I have some data say investigator saved in one bean and bean is persisted in DB. 在v1中,我有一些数据说调查者保存在一个bean中,并且bean保留在DB中。 In v2, I have a GET call 在v2中,我有一个GET呼叫

HTTP GET @ /investigators

which lists investigators but from a separate table dedicated to investigators. 其中列出了调查人员,但来自专门用于调查人员的单独表格。

During migration I need to make sure the data saved in v1's bean is available as an investigator in v2's GET call. 在迁移期间,我需要确保保存在v1的bean中的数据可以作为v2的GET调用中的调查者使用。

So the question is, is it advisable to save all the investigatros from v1's bean to DB table and then respond to GET call with the list reading from INVESTIGATORS table? 因此,问题是,是否建议将所有调查对象从v1的bean保存到DB表,然后使用从INVESTIGATORS表中读取的列表来响应GET调用?

I know that we'll not be compliant with REST principles here. 我知道我们在这里不符合REST原则。 But can this be considered based on the practical use cases? 但是,可以根据实际用例来考虑吗? If not what is the other way of getting around this problem? 如果不是,解决该问题的另一种方法是什么?

From a REST point of view, it does not matter when the backend behind the REST interface will have data available. 从REST的角度来看,REST接口后面的后端何时有可用数据并不重要。 If your lazy migration forces you to provision the data for a specific investigator and the moment it is requested for the first time, this fine. 如果您的懒惰迁移迫使您为特定的调查人员和首次请求该数据的时间提供数据,则可以。 I can see no violation of REST principles. 我看不到任何违反REST原则的情况。

Of course the code that implements the GET request should not directly copy data from DB1 to DB2. 当然,实现GET请求的代码不应直接将数据从DB1复制到DB2。 It should call a service that does this behind the scenes. 它应该调用在后台执行此操作的服务。

暂无
暂无

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

相关问题 在基于Rest的Java Web应用程序中,从服务类返回http状态代码的正确方法是什么? - What is the proper way to return http status code from service class in a Rest based java web application? 我应该何时从REST应用程序向客户端返回HTTP状态码500(内部服务器错误)? - When should I return HTTP Status Code 500 (Internal Server Error) from REST application to client? 对服务器的 HTTP REST 请求是否应该以客户端期望的特定格式返回数据? - Should HTTP REST request to the Server return data in specific format expected by the Client? 基于简单 REST 的程序中的 HTTP 500 内部服务器错误。 从服务器接收/发送响应时对 GET 和 POST 感到困惑 - HTTP 500 Internal Server Error in simple REST based program. Confused in GET and POST while receiving/sending response from server REST在Java应用程序中返回空但HTTP_OK - REST return empty but HTTP_OK in java application Rest 服务器 Codeigniter 返回图像数据 - Rest Server Codeigniter return image data 基于Rebol的Cheyenne服务器是否可以处理HTTP REST请求? - Is Rebol-based Cheyenne server able to process HTTP REST requests? 找不到带有Eclipse和Payara服务器的Jersey REST应用程序的HTTP状态404 - HTTP Status 404 Not Found For Jersey REST application with Eclipse and Payara server REST API - 当查询 GET 未找到结果时返回什么 - REST API - what to return when query for a GET does not find a result ReST(HTTP)是否与向许多客户端应用程序广播数据相关 - Is ReST (HTTP) relevant for broadcasting data to many client application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM