public class ConfigurableRequestItemParser<T> extends Object implements RequestItemParser<T>
example:
if you want to get client real ip in multi nginx proxy, you can register SentinelGatewayFilter bean as follows
ConfigurableRequestItemParser
| Constructor and Description |
|---|
ConfigurableRequestItemParser(RequestItemParser<T> delegate) |
| Modifier and Type | Method and Description |
|---|---|
ConfigurableRequestItemParser<T> |
addCookieValueExtractor(BiFunction<T,String,String> extractor) |
ConfigurableRequestItemParser<T> |
addHeaderExtractor(BiFunction<T,String,String> extractor) |
ConfigurableRequestItemParser<T> |
addPathExtractor(Function<T,String> extractor) |
ConfigurableRequestItemParser<T> |
addRemoteAddressExtractor(Function<T,String> extractor) |
ConfigurableRequestItemParser<T> |
addUrlParamExtractor(BiFunction<T,String,String> extractor) |
String |
getCookieValue(T request,
String cookieName)
Get the cookie value associated with the cookie name.
|
String |
getHeader(T request,
String key)
Get the header associated with the header key.
|
String |
getPath(T request)
Get API path from the request.
|
String |
getRemoteAddress(T request)
Get remote address from the request.
|
String |
getUrlParam(T request,
String paramName)
Get the parameter value associated with the parameter name.
|
public ConfigurableRequestItemParser(RequestItemParser<T> delegate)
public String getPath(T request)
RequestItemParsergetPath in interface RequestItemParser<T>request - valid requestpublic String getRemoteAddress(T request)
RequestItemParsergetRemoteAddress in interface RequestItemParser<T>request - valid requestpublic String getHeader(T request, String key)
RequestItemParsergetHeader in interface RequestItemParser<T>request - valid requestkey - valid header keypublic String getUrlParam(T request, String paramName)
RequestItemParsergetUrlParam in interface RequestItemParser<T>request - valid requestparamName - valid parameter namepublic String getCookieValue(T request, String cookieName)
RequestItemParsergetCookieValue in interface RequestItemParser<T>request - valid requestcookieName - valid cookie namepublic ConfigurableRequestItemParser<T> addPathExtractor(Function<T,String> extractor)
public ConfigurableRequestItemParser<T> addRemoteAddressExtractor(Function<T,String> extractor)
public ConfigurableRequestItemParser<T> addHeaderExtractor(BiFunction<T,String,String> extractor)
public ConfigurableRequestItemParser<T> addUrlParamExtractor(BiFunction<T,String,String> extractor)
public ConfigurableRequestItemParser<T> addCookieValueExtractor(BiFunction<T,String,String> extractor)
Copyright © 2022 Alibaba Group. All rights reserved.