changeset 707:490739826756

HttpSessionPayloadEventDataWriter encoding options
author Devel 2
date Wed, 29 Nov 2017 10:05:12 +0100
parents b6da092613be
children 3abcfc512e5f
files stress-tester/src/main/java/com/passus/st/reader/nc/HttpSessionPayloadEventDataWriter.java
diffstat 1 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/HttpSessionPayloadEventDataWriter.java	Wed Nov 29 09:47:53 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/HttpSessionPayloadEventDataWriter.java	Wed Nov 29 10:05:12 2017 +0100
@@ -28,6 +28,26 @@
 
     private final DataHelper dataHelper = DataHelper.get(ByteOrder.BIG_ENDIAN);
 
+    private boolean encodeRequest = true;
+
+    private boolean encodeResponse = true;
+
+    public boolean isEncodeRequest() {
+        return encodeRequest;
+    }
+
+    public void setEncodeRequest(boolean encodeRequest) {
+        this.encodeRequest = encodeRequest;
+    }
+
+    public boolean isEncodeResponse() {
+        return encodeResponse;
+    }
+
+    public void setEncodeResponse(boolean encodeResponse) {
+        this.encodeResponse = encodeResponse;
+    }
+
     public int encodeHeaders(HttpHeaders headers, ByteBuff buff) {
         ByteBuff headersBuff = new HeapByteBuff();
         for (HttpHeaderEntry entry : headers.getEntries()) {
@@ -133,7 +153,7 @@
         long size = 1;
         HttpRequest req = messages.getRequest();
         DataSource reqContent = null;
-        if (req != null) {
+        if (encodeRequest && req != null) {
             flags |= FLAG_REQUEST;
             size += encodeRequest(req, reqBuffer);
             reqContent = req.getContent();
@@ -145,7 +165,7 @@
 
         HttpResponse resp = messages.getResponse();
         DataSource respContent = null;
-        if (resp != null) {
+        if (encodeResponse && resp != null) {
             flags |= FLAG_RESPONSE;
             size += encodeResponse(resp, respBuffer);
             respContent = resp.getContent();
@@ -167,7 +187,7 @@
             writer.writeSessionPayloadData(respContent);
         }
         writer.closeSessionPayloadBlock();
-        
+
         size++;
     }