/** * 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); } } } }
/** * 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(); }
/** * 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(); }
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); } }
@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); } } }
} else { response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); response.getAllowedMethods().add(Method.GET); response.getAllowedMethods().add(Method.HEAD); response.getAllowedMethods().add(Method.PUT);
response.getAllowedMethods().add( Method.GET ); if( resourceValue.commands().get().stream().anyMatch( LinksUtil.withRel( "delete" ) ) ) response.getAllowedMethods().add( Method.DELETE ); response.getAllowedMethods().add( Method.PUT );
response.getAllowedMethods().add(Method.GET); response.getAllowedMethods().add(Method.HEAD);
response.getAllowedMethods().add( Method.GET ); if( resourceValue.commands().get().stream().anyMatch( LinksUtil.withRel( "delete" ) ) ) response.getAllowedMethods().add( Method.DELETE ); response.getAllowedMethods().add( Method.PUT );
&& !request.getMethod().equals(Method.HEAD)) { response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); response.getAllowedMethods().add(Method.GET); response.getAllowedMethods().add(Method.HEAD);
response.getAllowedMethods().add( Method.GET ); if( Iterables.matchesAny( LinksUtil.withRel( "delete" ), resourceValue.commands().get() ) ) response.getAllowedMethods().add( Method.DELETE ); response.getAllowedMethods().add( Method.PUT );
Set<Method> allowedMethods = new HashSet<>(response.getAllowedMethods()); response.getAllowedMethods().clear();
response.getAllowedMethods().add( org.restlet.data.Method.DELETE ); response.getAllowedMethods().add( org.restlet.data.Method.PUT );
response.getAllowedMethods().add( org.restlet.data.Method.DELETE ); response.getAllowedMethods().add( org.restlet.data.Method.PUT );
Set<Method> allowedMethods = resourceClass.getAllowedMethods(u); if (httpMethod.equals(Method.OPTIONS)) { callContext.getResponse().getAllowedMethods() .addAll(allowedMethods); throw new RequestHandledException();
response.getAllowedMethods().add( org.restlet.data.Method.POST );
response.getAllowedMethods().add( org.restlet.data.Method.GET ); response.getAllowedMethods().add( org.restlet.data.Method.POST ); result( formForMethod( queryMethod ) );
response.getAllowedMethods().add( org.restlet.data.Method.POST );
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());
response.getAllowedMethods().add( org.restlet.data.Method.POST );