Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2015-2019 the original author or authors.
*
* 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.lastaflute.remoteapi;
import java.lang.reflect.Type;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Locale;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.validation.groups.Default;
import org.dbflute.helper.function.IndependentProcessor;
import org.dbflute.helper.message.ExceptionMessageBuilder;
import org.dbflute.optional.OptionalThing;
import org.dbflute.remoteapi.FlutyRemoteApi;
import org.dbflute.remoteapi.FlutyRemoteApiRule;
import org.dbflute.remoteapi.exception.RemoteApiHttpClientErrorException;
import org.dbflute.remoteapi.exception.RemoteApiRequestValidationErrorException;
import org.dbflute.remoteapi.exception.RemoteApiResponseValidationErrorException;
import org.dbflute.remoteapi.exception.RemoteApiValidationErrorHookNotFoundException;
import org.dbflute.remoteapi.logging.SendReceiveLogOption;
import org.dbflute.remoteapi.logging.SendReceiveLogger;
import org.dbflute.util.DfTypeUtil;
import org.dbflute.util.Srl;
import org.lastaflute.core.magic.ThreadCacheContext;
import org.lastaflute.core.magic.async.AsyncManager;
import org.lastaflute.core.magic.async.ConcurrentAsyncCall;
import org.lastaflute.core.message.UserMessages;
import org.lastaflute.core.message.supplier.UserMessagesCreator;
import org.lastaflute.core.time.TimeManager;
import org.lastaflute.core.util.Lato;
import org.lastaflute.web.response.ApiResponse;
import org.lastaflute.web.response.JsonResponse;
import org.lastaflute.web.ruts.process.exception.ResponseBeanValidationErrorException;
import org.lastaflute.web.ruts.process.validatebean.ResponseSimpleBeanValidator;
import org.lastaflute.web.servlet.request.RequestManager;
import org.lastaflute.web.validation.ActionValidator;
import org.lastaflute.web.validation.VaErrorHook;
import org.lastaflute.web.validation.exception.ValidationErrorException;
import org.lastaflute.web.validation.exception.ValidationStoppedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author jflute
* @author awaawa
* @author inoue
*/
public class LastaRemoteApi extends FlutyRemoteApi {
// ===================================================================================
// Definition
// ==========
private static final Logger logger = LoggerFactory.getLogger(LastaRemoteApi.class);
// ===================================================================================
// Attribute
// =========
/** Only for validation and various functions not related to HTTP request. (basically NotNull: should be set by e.g. behavior) */
protected RequestManager requestManager;
// ===================================================================================
// Constructor
// ===========
public LastaRemoteApi(Consumer defaultOpLambda, Object callerExp) {
super(defaultOpLambda, callerExp);
}
public void acceptRequestManager(RequestManager requestManager) {
this.requestManager = requestManager;
}
// ===================================================================================
// Validation
// ==========
@Override
protected void validateParam(Type returnType, String urlBase, String actionPath, Object[] pathVariables, Object param,
FlutyRemoteApiRule rule) {
if (rule.getValidatorOption().isSuppressParam()) {
return;
}
try {
createTransferredBeanValidator().validate(param);
} catch (ResponseBeanValidationErrorException e) {
handleRemoteApiRequestValidationError(returnType, urlBase, actionPath, pathVariables, param, rule, e);
}
}
@Override
protected void validateReturn(Type returnType, String url, OptionalThing