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 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.citrusframework.http.controller;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Enumeration;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.citrusframework.endpoint.EndpointAdapter;
import org.citrusframework.endpoint.adapter.EmptyResponseEndpointAdapter;
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.http.client.HttpEndpointConfiguration;
import org.citrusframework.http.message.HttpMessage;
import org.citrusframework.http.server.HttpServerSettings;
import org.citrusframework.message.Message;
import org.springframework.http.*;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.util.UrlPathHelper;
/**
* Message controller implementation handling all incoming requests by forwarding to a message
* handler for further processing.
*
* @author Christoph Deppisch
*/
@Controller
@RequestMapping("/*")
public class HttpMessageController {
/** Endpoint adapter for incoming requests, providing proper responses */
private EndpointAdapter endpointAdapter = new EmptyResponseEndpointAdapter();
/** Endpoint configuration */
private HttpEndpointConfiguration endpointConfiguration = new HttpEndpointConfiguration();
/** Cache response messages for message tracing reasons */
private final ConcurrentHashMap> responseCache = new ConcurrentHashMap<>();
/** List of requests used to clear caches when too many requests are in memory */
private final ConcurrentLinkedQueue activeRequests = new ConcurrentLinkedQueue<>();
/** Maximum number of responses cached on this server for message tracing reasons */
private int responseCacheSize = HttpServerSettings.responseCacheSize();
@RequestMapping(value = "**", method = { RequestMethod.GET })
@ResponseBody
public ResponseEntity> handleGetRequest(HttpEntity