作者:cr罗详青 | 来源:互联网 | 2023-01-24 16:38
Myrequirementisasfollows:我的要求如下:Iwanttogiveactorname,startdate,enddateandgetallt
My requirement is as follows:
我的要求如下:
I want to give actor name, start date, end date and get all the films he acted in that period.
我想给演员姓名,开始日期,结束日期,并获得他在那个时期演出的所有电影。
For that reason, my service request is like this.
出于这个原因,我的服务请求是这样的。
http://localhost:8080/MovieDB/GetJson?name=Actor&startDate=20120101&endDate=20120505
Now, i want to improve it. I want to give a start date, end date and more than one actor name and want to see all those actors movies in that period.
现在,我想改进它。我想给出开始日期,结束日期和多个演员姓名,并希望在那段时间内看到所有演员电影。
I am not sure how should my url look to support such thing.
我不确定我的网址应该如何支持这样的事情。
I am writing a java based web service using spring.
我正在使用spring编写基于Java的Web服务。
Below code is to support one actor
下面的代码是支持一个actor
@RequestMapping(value = "/GetJson", method = RequestMethod.GET)
public void getJson(@RequestParam("name") String ticker, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
//code to get results from db for those params.
}
One solution i am thinking is using a % symbol to seperate actor names. For example:
我想的一个解决方案是使用%符号来分隔演员姓名。例如:
http://localhost:8080/MovieDB/GetJson?name=Actor1%Actor2%Actor3&startDate=20120101&endDate=20120505
Now, in the controller i will parse the name string with % and get back all actors names.
现在,在控制器中,我将使用%解析名称字符串并获取所有actor名称。
Is this a good way to do this or is there a standard approach?
这是一个很好的方法吗?还是有标准方法?
Thanks
谢谢
1 个解决方案