我想将多个参数传入我的方法。我该怎么做呢?我想要的网址看起来像这样http://host/one/two/three/fourJava中的多个参数Rest API JAX-RS - GET方法
我有下面的代码到目前为止
@GET
@Produces({MediaType.APPLICATION_JSON})
@Path("/{one,two,three}")
public List<Person> getPeople(@PathParam ("one") String one, @PathParam ("two") String two, @PathParam ("three") String three){
String one = one;
String two = two;
String three = three;
}
这是为抓住PARAMS并将它传递给我的方法正确的语法?我在@Path中看到了一些正则表达式,但我不明白。我老实说,只是希望能够抓住参数,并尽可能将它们放入一个变量中。
你要求的参数不确定数量还是有一个固定的号码吗?你在你的例子中通过3来展示,但是在你的例子url中通过4来展示。 – gregwhitaker