客戶可要求兩個網址具有相同的路徑,但不同的查詢字符串:如何用不同的方法編寫球衣來匹配「/ hello」和「/ hello?name = Mike」?
1. /hello
2. /hello?name=Mike
如何使用的球衣來定義他們每個人的兩種不同的方法?
下面是一個例子:
@Path("/hello")
public class HelloResource {
@Produces("text/plain")
public String justHello() {}
// how to call this method only the query string has "name"
@Produces("text/plain")
public String helloWithName() {}
}
這是一個小資,我的程序依賴於這個功能嚴重。 – Freewind
你知道其他類似的庫支持這個功能嗎? – Freewind
不是,你確定你不想嘗試使用REST來做這件事嗎?這是時髦的,所以支持更好。 – stevedbrown