Author: olamy
Date: Tue Feb 28 22:32:27 2012
New Revision: 1294871

URL: http://svn.apache.org/viewvc?rev=1294871&view=rev
Log:
sample how to pass serializer as http header

Modified:
    
incubator/directmemory/trunk/examples/server-example/src/main/webapp/index.html
    
incubator/directmemory/trunk/examples/server-example/src/main/webapp/js/sample.js

Modified: 
incubator/directmemory/trunk/examples/server-example/src/main/webapp/index.html
URL: 
http://svn.apache.org/viewvc/incubator/directmemory/trunk/examples/server-example/src/main/webapp/index.html?rev=1294871&r1=1294870&r2=1294871&view=diff
==============================================================================
--- 
incubator/directmemory/trunk/examples/server-example/src/main/webapp/index.html 
(original)
+++ 
incubator/directmemory/trunk/examples/server-example/src/main/webapp/index.html 
Tue Feb 28 22:32:27 2012
@@ -57,6 +57,11 @@
                   Wine Name:&nbsp<input type="text" id="wine_name" 
name="wine_name">
                   Wine Description:&nbsp<input type="text" 
id="wine_description" name="wine_description">
                   ExpiresIn:&nbsp<input type="text" id="expires-in" 
name="expires-in">
+                  Serializer:&nbsp;
+                  <select name="serialize" id="serializer" class="span8">
+                    <option 
value="org.apache.directmemory.serialization.StandardSerializer">org.apache.directmemory.serialization.StandardSerializer</option>
+                    <option 
value="org.apache.directmemory.serialization.protostuff.ProtoStuffWithLinkedBufferSerializer">org.apache.directmemory.serialization.protostuff.ProtoStuffWithLinkedBufferSerializer</option>
+                  </select>
                   <br/>
                   <button class="btn" id="put-cache-btn">Put</button>
                 </div>

Modified: 
incubator/directmemory/trunk/examples/server-example/src/main/webapp/js/sample.js
URL: 
http://svn.apache.org/viewvc/incubator/directmemory/trunk/examples/server-example/src/main/webapp/js/sample.js?rev=1294871&r1=1294870&r2=1294871&view=diff
==============================================================================
--- 
incubator/directmemory/trunk/examples/server-example/src/main/webapp/js/sample.js
 (original)
+++ 
incubator/directmemory/trunk/examples/server-example/src/main/webapp/js/sample.js
 Tue Feb 28 22:32:27 2012
@@ -43,13 +43,13 @@ $(function() {
   }
 
   // X-DirectMemory-ExpiresIn
-  putWineInCache=function(wine,expiresIn){
+  putWineInCache=function(wine,expiresIn,serializer){
     $.ajax({
       url: 'cache/'+encodeURIComponent(wine.name),
       data:$.toJSON( wine ),
       cache: false,
       type: 'PUT',
-      headers:{'X-DirectMemory-ExpiresIn':expiresIn},
+      
headers:{'X-DirectMemory-ExpiresIn':expiresIn,'X-DirectMemory-Serializer':serializer},
       contentType: "text/plain",
       statusCode: {
         204: function() {
@@ -100,7 +100,7 @@ $(function() {
         displayError("expiresIn must be a number");
         return;
       }
-      putWineInCache(wine,expiresIn);
+      putWineInCache(wine,expiresIn,$("#serializer" ).val());
 
     });
 
@@ -115,6 +115,7 @@ $(function() {
         url: 'cache/'+encodeURIComponent(key),
         cache: false,
         type: 'GET',
+        headers:{'X-DirectMemory-Serializer':$("#serializer" ).val()},
         dataType: 'text',
         statusCode: {
           204: function() {


Reply via email to