
org.brutusin.jsonsrv.SafeAction Maven / Gradle / Ivy
/*
* Copyright 2015 Ignacio del Valle Alles [email protected].
*
* 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.brutusin.jsonsrv;
import org.brutusin.jsonsrv.caching.CachingInfo;
/**
* Used to define business operations considered safe according to the
* HTTP definition, meaning that the action "... defined semantics are
* essentially read-only; i.e., the client does not request, and does not
* expect, any state change on the origin server as a result of applying a safe
* method to a target resource. Likewise, reasonable use of a safe method is not
* expected to cause any harm, loss of property, or unusual burden on the origin
* server."
*
Threading issues: Instances of this class will be accessed
* by several threads concurrently, so implementing subclasses must be
* thread-safe.
*
Instance life-cycle: For each request received the following
* methods are (can be) executed:
*
* - {@link #getCachingInfo(java.lang.Object)}: That returns caching
* information for this request.
* - {@link #execute(java.lang.Object)}: Depending on the client request
* being conditional, and on the value returned by the previous method, this
* method is or is not executed.
*
*
* See section 4.2.1 of rfc7231 for more
* details.
*
* @see UnsafeAction
* @author Ignacio del Valle Alles [email protected]
* @param Input POJO class.
* @param Output POJO class
*/
public abstract class SafeAction extends JsonAction> {
protected Long getLastModified(I input){
return null;
}
@Override
public final boolean isIdempotent() {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy