本文整理了Java中org.restlet.Response.getAllowedMethods
方法的一些代码示例,展示了Response.getAllowedMethods
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getAllowedMethods
方法的具体详情如下:
包路径:org.restlet.Response
类名称:Response
方法名:getAllowedMethods
[英]Returns the modifiable set of methods allowed on the requested resource. This property only has to be updated when a status CLIENT_ERROR_METHOD_NOT_ALLOWED is set. Creates a new instance if no one has been set.
Note that when used with HTTP connectors, this property maps to the "Allow" header.
[中]返回请求的资源上允许的可修改方法集。仅当设置了状态客户端错误方法不允许时,才需要更新此属性。如果未设置任何实例,则创建新实例。
请注意,当与HTTP连接器一起使用时,此属性映射到“Allow”头。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the set of methods allowed on the requested resource. The set
* instance set must be thread-safe (use {@link CopyOnWriteArraySet} for
* example.<br>
* <br>
* Note that when used with HTTP connectors, this property maps to the
* "Allow" header.
*
* @param allowedMethods
* The set of methods allowed on the requested resource.
*/
public void setAllowedMethods(Set<Method> allowedMethods) {
synchronized (getAllowedMethods()) {
if (allowedMethods != this.allowedMethods) {
this.allowedMethods.clear();
if (allowedMethods != null) {
this.allowedMethods.addAll(allowedMethods);
}
}
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the set of methods allowed on the requested resource. This
* property only has to be updated when a status
* CLIENT_ERROR_METHOD_NOT_ALLOWED is set.
*
* @return The list of allowed methods.
*/
@Override
public Set<Method> getAllowedMethods() {
return getWrappedResponse().getAllowedMethods();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the set of methods allowed for the current client by the
* resource. The result can vary based on the client's user agent,
* authentication and authorization data provided by the client.
*
* @return The set of allowed methods.
*/
public Set<Method> getAllowedMethods() {
return getResponse() == null ? null : getResponse().getAllowedMethods();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
protected void handleFile(Request request, Response response, String decodedPath) {
if (GET.equals(request.getMethod())
|| HEAD.equals(request.getMethod())) {
handleEntityGet(request, response, getEntity(decodedPath));
} else if (PUT.equals(request.getMethod())) {
handleFilePut(request, response, decodedPath, new File(decodedPath));
} else if (DELETE.equals(request.getMethod())) {
handleFileDelete(response, new File(decodedPath));
} else {
response.setStatus(CLIENT_ERROR_METHOD_NOT_ALLOWED);
response.getAllowedMethods().add(GET);
response.getAllowedMethods().add(HEAD);
response.getAllowedMethods().add(PUT);
response.getAllowedMethods().add(DELETE);
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
protected void handleLocal(Request request, Response response,
String decodedPath) {
if (Method.GET.equals(request.getMethod())
|| Method.HEAD.equals(request.getMethod())) {
handleEntityGet(request, response, getEntity(decodedPath));
} else {
response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
response.getAllowedMethods().add(Method.GET);
response.getAllowedMethods().add(Method.HEAD);
}
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
} else {
response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
response.getAllowedMethods().add(Method.GET);
response.getAllowedMethods().add(Method.HEAD);
response.getAllowedMethods().add(Method.PUT);
代码示例来源:origin: apache/attic-polygene-java
response.getAllowedMethods().add( Method.GET );
if( resourceValue.commands().get().stream().anyMatch( LinksUtil.withRel( "delete" ) ) )
response.getAllowedMethods().add( Method.DELETE );
response.getAllowedMethods().add( Method.PUT );
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.osgi
response.getAllowedMethods().add(Method.GET);
response.getAllowedMethods().add(Method.HEAD);
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server
response.getAllowedMethods().add( Method.GET );
if( resourceValue.commands().get().stream().anyMatch( LinksUtil.withRel( "delete" ) ) )
response.getAllowedMethods().add( Method.DELETE );
response.getAllowedMethods().add( Method.PUT );
代码示例来源:origin: org.restlet.osgi/org.restlet
&& !request.getMethod().equals(Method.HEAD)) {
response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
response.getAllowedMethods().add(Method.GET);
response.getAllowedMethods().add(Method.HEAD);
代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server
response.getAllowedMethods().add( Method.GET );
if( Iterables.matchesAny( LinksUtil.withRel( "delete" ), resourceValue.commands().get() ) )
response.getAllowedMethods().add( Method.DELETE );
response.getAllowedMethods().add( Method.PUT );
代码示例来源:origin: org.restlet.osgi/org.restlet
Set<Method> allowedMethods = new HashSet<>(response.getAllowedMethods());
response.getAllowedMethods().clear();
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server
response.getAllowedMethods().add( org.restlet.data.Method.DELETE );
response.getAllowedMethods().add( org.restlet.data.Method.PUT );
代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server
response.getAllowedMethods().add( org.restlet.data.Method.DELETE );
response.getAllowedMethods().add( org.restlet.data.Method.PUT );
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
Set<Method> allowedMethods = resourceClass.getAllowedMethods(u);
if (httpMethod.equals(Method.OPTIONS)) {
callContext.getResponse().getAllowedMethods()
.addAll(allowedMethods);
throw new RequestHandledException();
代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server
response.getAllowedMethods().add( org.restlet.data.Method.POST );
代码示例来源:origin: apache/attic-polygene-java
response.getAllowedMethods().add( org.restlet.data.Method.GET );
response.getAllowedMethods().add( org.restlet.data.Method.POST );
result( formForMethod( queryMethod ) );
代码示例来源:origin: apache/attic-polygene-java
response.getAllowedMethods().add( org.restlet.data.Method.POST );
代码示例来源:origin: org.restlet.osgi/org.restlet
response.getServerInfo().setAgent(header.getValue());
} else if (HEADER_ALLOW.equalsIgnoreCase(header.getName())) {
MethodReader.addValues(header, response.getAllowedMethods());
} else if (HEADER_VARY.equalsIgnoreCase(header.getName())) {
DimensionReader.addValues(header, response.getDimensions());
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server
response.getAllowedMethods().add( org.restlet.data.Method.POST );
内容来源于网络,如有侵权,请联系作者删除!