本文整理了Java中javax.ws.rs.core.Response.getAllowedMethods
方法的一些代码示例,展示了Response.getAllowedMethods
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getAllowedMethods
方法的具体详情如下:
包路径:javax.ws.rs.core.Response
类名称:Response
方法名:getAllowedMethods
[英]Get the allowed HTTP methods from the Allow HTTP header.
[中]从Allow HTTP头获取允许的HTTP方法。
代码示例来源:origin: SAP/cloud-s4-sdk-examples
@Override
public Set<String> getAllowedMethods()
{
return delegate.getAllowedMethods();
}
代码示例来源:origin: com.cerner.beadledom/beadledom-resteasy-genericresponse
@Override
public Set<String> getAllowedMethods() {
return rawResponse.getAllowedMethods();
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public Set<String> getAllowedMethods() {
return r.getAllowedMethods();
}
代码示例来源:origin: org.trellisldp/trellis-test
/**
* Check a response for expected Allow header values.
* @param res the Response object
* @return a Stream of executable assertions
*/
default Stream<Executable> checkMementoAllowedMethods(final Response res) {
return of(
() -> assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful response"),
() -> assertTrue(res.getAllowedMethods().contains("GET"), "GET should be allowed!"),
() -> assertTrue(res.getAllowedMethods().contains("HEAD"), "HEAD should be allowed!"),
() -> assertTrue(res.getAllowedMethods().contains("OPTIONS"), "OPTIONS should be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("POST"), "POST shouldn't be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("PUT"), "PUT shouldn't be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("PATCH"), "PATCH shouldn't be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("DELETE"), "DELETE shouldn't be allowed!"));
}
代码示例来源:origin: trellis-ldp/trellis
/**
* Check a response for expected Allow header values.
* @param res the Response object
* @return a Stream of executable assertions
*/
default Stream<Executable> checkMementoAllowedMethods(final Response res) {
return of(
() -> assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful response"),
() -> assertTrue(res.getAllowedMethods().contains("GET"), "GET should be allowed!"),
() -> assertTrue(res.getAllowedMethods().contains("HEAD"), "HEAD should be allowed!"),
() -> assertTrue(res.getAllowedMethods().contains("OPTIONS"), "OPTIONS should be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("POST"), "POST shouldn't be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("PUT"), "PUT shouldn't be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("PATCH"), "PATCH shouldn't be allowed!"),
() -> assertFalse(res.getAllowedMethods().contains("DELETE"), "DELETE shouldn't be allowed!"));
}
代码示例来源:origin: trellis-ldp/trellis
private Stream<Executable> checkAllowedMethods(final Response res, final List<String> expected) {
final Set<String> actual = res.getAllowedMethods();
return Stream.concat(
actual.stream().map(method -> () -> assertTrue(expected.contains(method), "Method " + method
+ " was not present in the list of expected methods!")),
expected.stream().map(method -> () -> assertTrue(actual.contains(method), "Method " + method
+ " was not in the response header!")));
}
}
内容来源于网络,如有侵权,请联系作者删除!