我能夠得到第一部分的工作,但無法弄清楚如何服務靜態資源。這裏的工作代碼,爲我做了詭計 -
pathPrefix("api",() -> path(segment("addresses").slash("id").slash(segment()).slash("limit").slash(segment()), (String id, String limit) -> {
return getEitherListResponse(
() -> doSomethingWith(id, limit));
})),
pathPrefix("api",() -> path(segment("addresses").slash(segments()), (List<String> list) -> {
if (list.size() == 2) {
String id = list.get(0);
String shortId = list.get(1);
return getEitherListResponse(
() -> doSomethingWith(id, shortId));
} else {
String id = list.get(0);
String shortId = list.get(1);
String type = list.get(2);
return getEitherListResponse(
() -> doSomethingWith(id, shortId, type));
}
}))
介意幫我我有類似的問題? – uniXVanXcel