sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1728082 - in /sling/trunk/contrib/extensions/tracer/src: main/java/org/apache/sling/tracer/internal/TracerLogServlet.java test/java/org/apache/sling/tracer/internal/TracerLogServletTest.java
Date Tue, 02 Feb 2016 11:00:56 GMT
Author: chetanm
Date: Tue Feb  2 11:00:56 2016
New Revision: 1728082

URL: http://svn.apache.org/viewvc?rev=1728082&view=rev
Log:
SLING-5459 - Recording of tracer logs

Tracer servlet would now send a protocol version version against header 'Sling-Tracer-Protocol-Version'.
For now its value is 1. This would allow client to determine if they can work against this
server or not

Modified:
    sling/trunk/contrib/extensions/tracer/src/main/java/org/apache/sling/tracer/internal/TracerLogServlet.java
    sling/trunk/contrib/extensions/tracer/src/test/java/org/apache/sling/tracer/internal/TracerLogServletTest.java

Modified: sling/trunk/contrib/extensions/tracer/src/main/java/org/apache/sling/tracer/internal/TracerLogServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/tracer/src/main/java/org/apache/sling/tracer/internal/TracerLogServlet.java?rev=1728082&r1=1728081&r2=1728082&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/tracer/src/main/java/org/apache/sling/tracer/internal/TracerLogServlet.java
(original)
+++ sling/trunk/contrib/extensions/tracer/src/main/java/org/apache/sling/tracer/internal/TracerLogServlet.java
Tue Feb  2 11:00:56 2016
@@ -46,6 +46,10 @@ class TracerLogServlet extends SimpleWeb
 
     public static final String HEADER_TRACER_REQUEST_ID = "Sling-Tracer-Request-Id";
 
+    public static final String HEADER_TRACER_PROTOCOL_VERSION = "Sling-Tracer-Protocol-Version";
+
+    public static final int TRACER_PROTOCOL_VERSION = 1;
+
     private final Cache<String, JSONRecording> cache;
 
     public TracerLogServlet(BundleContext context) {
@@ -161,8 +165,8 @@ class TracerLogServlet extends SimpleWeb
         request.setAttribute(ATTR_REQUEST_ID, requestId);
 
         response.setHeader(HEADER_TRACER_REQUEST_ID, requestId);
-        //TODO Show we also sent tracer version to enable client determine
-        //is server is capable of given version
+        response.setHeader(HEADER_TRACER_PROTOCOL_VERSION, String.valueOf(TRACER_PROTOCOL_VERSION));
+
         return recording;
     }
 

Modified: sling/trunk/contrib/extensions/tracer/src/test/java/org/apache/sling/tracer/internal/TracerLogServletTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/tracer/src/test/java/org/apache/sling/tracer/internal/TracerLogServletTest.java?rev=1728082&r1=1728081&r2=1728082&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/tracer/src/test/java/org/apache/sling/tracer/internal/TracerLogServletTest.java
(original)
+++ sling/trunk/contrib/extensions/tracer/src/test/java/org/apache/sling/tracer/internal/TracerLogServletTest.java
Tue Feb  2 11:00:56 2016
@@ -98,6 +98,8 @@ public class TracerLogServletTest {
 
         ArgumentCaptor<String> requestIdCaptor = ArgumentCaptor.forClass(String.class);
         verify(response).setHeader(eq(TracerLogServlet.HEADER_TRACER_REQUEST_ID), requestIdCaptor.capture());
+        verify(response).setHeader(TracerLogServlet.HEADER_TRACER_PROTOCOL_VERSION,
+                String.valueOf(TracerLogServlet.TRACER_PROTOCOL_VERSION));
 
         StringWriter sw = new StringWriter();
         when(response.getWriter()).thenReturn(new PrintWriter(sw));



Mime
View raw message