All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dmfs.httpessentials.methods.IdempotentMethod Maven / Gradle / Ivy

/*
 * Copyright (C) 2016 Marten Gajda 
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.dmfs.httpessentials.methods;

import org.dmfs.httpessentials.HttpMethod;


/**
 * An idempotent {@link HttpMethod} that's not safe. For idempotent Methods that are also safe use {@link SafeMethod}.
 *
 * @author Marten Gajda 
 * @see RFC 7231, section 4.2.1
 * @see RFC 7231, section 4.2.2
 */
public final class IdempotentMethod extends AbstractMethod
{
    public IdempotentMethod(final String verb, final boolean supportsRequestPayload)
    {
        super(verb, supportsRequestPayload);
    }


    @Override
    public boolean isSafe()
    {
        // idempotent methods are not safe, otherwise they would be safe methods
        return false;
    }


    @Override
    public boolean isIdempotent()
    {
        // idempotent methods are idempotent
        return true;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy