Extract uri into message headers
This commit is contained in:
@@ -23,6 +23,7 @@ import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry
|
|||||||
import org.springframework.cloud.function.web.constants.WebRequestConstants;
|
import org.springframework.cloud.function.web.constants.WebRequestConstants;
|
||||||
import org.springframework.cloud.function.web.util.FunctionWebRequestProcessingHelper;
|
import org.springframework.cloud.function.web.util.FunctionWebRequestProcessingHelper;
|
||||||
import org.springframework.cloud.function.web.util.FunctionWrapper;
|
import org.springframework.cloud.function.web.util.FunctionWrapper;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.codec.multipart.FormFieldPart;
|
import org.springframework.http.codec.multipart.FormFieldPart;
|
||||||
@@ -99,8 +100,10 @@ public class FunctionController {
|
|||||||
private FunctionWrapper wrapper(ServerWebExchange request) {
|
private FunctionWrapper wrapper(ServerWebExchange request) {
|
||||||
FunctionInvocationWrapper function = (FunctionInvocationWrapper) request
|
FunctionInvocationWrapper function = (FunctionInvocationWrapper) request
|
||||||
.getAttribute(WebRequestConstants.HANDLER);
|
.getAttribute(WebRequestConstants.HANDLER);
|
||||||
|
HttpHeaders headers = HttpHeaders.writableHttpHeaders(request.getRequest().getHeaders());
|
||||||
|
headers.set("uri", request.getRequest().getURI().toString());
|
||||||
FunctionWrapper wrapper = new FunctionWrapper(function);
|
FunctionWrapper wrapper = new FunctionWrapper(function);
|
||||||
wrapper.setHeaders(request.getRequest().getHeaders());
|
wrapper.setHeaders(headers);
|
||||||
wrapper.getParams().addAll(request.getRequest().getQueryParams());
|
wrapper.getParams().addAll(request.getRequest().getQueryParams());
|
||||||
String argument = (String) request.getAttribute(WebRequestConstants.ARGUMENT);
|
String argument = (String) request.getAttribute(WebRequestConstants.ARGUMENT);
|
||||||
if (argument != null) {
|
if (argument != null) {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry
|
|||||||
import org.springframework.cloud.function.web.constants.WebRequestConstants;
|
import org.springframework.cloud.function.web.constants.WebRequestConstants;
|
||||||
import org.springframework.cloud.function.web.util.FunctionWebRequestProcessingHelper;
|
import org.springframework.cloud.function.web.util.FunctionWebRequestProcessingHelper;
|
||||||
import org.springframework.cloud.function.web.util.FunctionWrapper;
|
import org.springframework.cloud.function.web.util.FunctionWrapper;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.ResponseEntity.BodyBuilder;
|
import org.springframework.http.ResponseEntity.BodyBuilder;
|
||||||
@@ -128,6 +129,10 @@ public class FunctionController {
|
|||||||
String key = keys.next();
|
String key = keys.next();
|
||||||
wrapper.getHeaders().addAll(key, Arrays.asList(request.getHeaderValues(key)));
|
wrapper.getHeaders().addAll(key, Arrays.asList(request.getHeaderValues(key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpHeaders headers = HttpHeaders.writableHttpHeaders(wrapper.getHeaders());
|
||||||
|
headers.set("uri", ((ServletWebRequest) request).getRequest().getRequestURI());
|
||||||
|
|
||||||
String argument = (String) request.getAttribute(WebRequestConstants.ARGUMENT,
|
String argument = (String) request.getAttribute(WebRequestConstants.ARGUMENT,
|
||||||
WebRequest.SCOPE_REQUEST);
|
WebRequest.SCOPE_REQUEST);
|
||||||
if (argument != null) {
|
if (argument != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user