Mercurial > stress-tester
changeset 1294:8396548d1a78
HttpFilterRequestWrapper.getNormUri
author | Devel 2 |
---|---|
date | Wed, 15 Jul 2020 12:39:20 +0200 |
parents | 4304b8e547bf |
children | cd90b24c9f64 |
files | stress-tester/src/main/java/com/passus/st/client/http/HttpConsts.java stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFilterRequestWrapper.java stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperDynamicExtractor.java |
diffstat | 3 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpConsts.java Wed Jul 15 12:28:21 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpConsts.java Wed Jul 15 12:39:20 2020 +0200 @@ -19,6 +19,7 @@ public static final String TAG_TIME_END = "timeEnd"; public static final String TAG_USERNAME = "userName"; public static final String TAG_SESSION_REQUESTS_COUNT = "sessionRequestsCount"; + public static final String TAG_NORM_URI = "normUri"; private HttpConsts() { }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFilterRequestWrapper.java Wed Jul 15 12:28:21 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFilterRequestWrapper.java Wed Jul 15 12:39:20 2020 +0200 @@ -4,10 +4,12 @@ import com.passus.net.http.HttpMessageHelper; import com.passus.net.http.HttpRequest; import com.passus.net.http.URL; + +import static com.passus.st.client.http.HttpConsts.TAG_NORM_URI; import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID; +import static com.passus.st.client.http.HttpUrlUtils.normalizePathSegments; /** - * * @author Mirosław Hawrot */ public class HttpFilterRequestWrapper extends HttpFilterMessageWrapper<HttpRequest> { @@ -34,6 +36,16 @@ return message.getUri(); } + public ByteString getNormUri() { + ByteString normUri = (ByteString) message.getTag(TAG_NORM_URI); + if (normUri == null) { + normUri = ByteString.create(normalizePathSegments(message.getUri().toString())); + message.setTag(TAG_NORM_URI, normUri); + } + + return normUri; + } + public String getSessionId() { return (String) message.getTag(TAG_SESSION_ID); }
--- a/stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperDynamicExtractor.java Wed Jul 15 12:28:21 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperDynamicExtractor.java Wed Jul 15 12:39:20 2020 +0200 @@ -4,10 +4,10 @@ import com.passus.filter.ValueExtractor; import com.passus.net.http.URL; import com.passus.st.client.http.filter.HttpMessageWrapper; + import java.util.Objects; /** - * * @author mikolaj.podbielski */ public class HttpMessageWrapperDynamicExtractor implements ValueExtractor { @@ -51,6 +51,9 @@ case "req.uri": case "req.getUri()": return wrapper.getReq().getUri(); + case "req.normUri": + case "req.getNormUri()": + return wrapper.getReq().getNormUri(); case "resp.version": case "resp.getVersion()": return wrapper.getResp().getVersion();