org.zalando.riptide.idempotency.DefaultIdempotencyDetector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riptide-idempotency Show documentation
Show all versions of riptide-idempotency Show documentation
Client side response routing
package org.zalando.riptide.idempotency;
import org.apiguardian.api.API;
import org.springframework.http.HttpMethod;
import org.zalando.riptide.RequestArguments;
import java.util.Set;
import static org.apiguardian.api.API.Status.EXPERIMENTAL;
import static org.springframework.http.HttpMethod.DELETE;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.HEAD;
import static org.springframework.http.HttpMethod.OPTIONS;
import static org.springframework.http.HttpMethod.PUT;
import static org.springframework.http.HttpMethod.TRACE;
/**
* @see Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content, Section 4.2.1
* @see Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content, Section 4.2.2
*/
@API(status = EXPERIMENTAL)
public final class DefaultIdempotencyDetector implements IdempotencyDetector {
private final Set ACCEPTED_METHODS = Set.of(DELETE, GET, HEAD, OPTIONS, PUT, TRACE);
@Override
public Decision test(final RequestArguments arguments, final Test root) {
if (ACCEPTED_METHODS.contains(arguments.getMethod())) {
return Decision.ACCEPT;
}
return Decision.NEUTRAL;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy