本文整理匯總了Java中javax.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED屬性的典型用法代碼示例。如果您正苦於以下問題:Java Status.METHOD_NOT_ALLOWED屬性的具體用法?Java Status.METHOD_NOT_ALLOWED怎麽用?Java Status.METHOD_NOT_ALLOWED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.ws.rs.core.Response.Status
的用法示例。
在下文中一共展示了Status.METHOD_NOT_ALLOWED屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: locate
public void locate(String microserviceName, String path, String httpMethod, MicroservicePaths microservicePaths) {
// 在靜態路徑中查找
operation = locateStaticPathOperation(path, httpMethod, microservicePaths.getStaticPathOperationMap());
if (operation != null) {
// 全部定位完成
return;
}
// 在動態路徑中查找
operation = locateDynamicPathOperation(path, microservicePaths.getDynamicPathOperationList(), httpMethod);
if (operation != null) {
return;
}
Status status = Status.NOT_FOUND;
if (resourceFound) {
status = Status.METHOD_NOT_ALLOWED;
}
LOGGER.error("locate path failed, status:{}, http method:{}, path:{}, microserviceName:{}",
status,
httpMethod,
path,
microserviceName);
throw new InvocationException(status, status.getReasonPhrase());
}