Commits

Boris Nagaev committed f31de0b

examples/swfstore: use EtagStore

Comments (0)

Files changed (1)

examples/swfstore.cpp.in

 #include <Wt/WLogger>
 #include <Wt/Wc/SWFStore.hpp>
 #include <Wt/Wc/LocalStore.hpp>
+#include <Wt/Wc/EtagStore.hpp>
 #include <Wt/Wc/Gather.hpp>
+#include <Wt/Wc/util.hpp>
 
 using namespace Wt;
 using namespace Wt::Wc;
     wApp->log("info") << "Gathered: type=" << type << ", value=" << value;
 } // gather
 
+EtagStoreResource etag_resource;
+
 class SWFStoreApp : public WApplication {
 public:
     SWFStoreApp(const WEnvironment& env):
         WApplication(env) {
         SWFStore* swf = new SWFStore(root());
         LocalStore* localstore = new LocalStore(root());
+        EtagStore* etagstore = new EtagStore(&etag_resource, root());
         WPushButton* clear_storage = new WPushButton("Clear", root());
         WPushButton* one = new WPushButton("Set k=1", root());
         WPushButton* two = new WPushButton("Set k=2", root());
         Gather* gather = new Gather(explore, this);
         gather->set_swfstore(swf);
         gather->set_localstore(localstore);
+        gather->add_store(etagstore, Gather::ETAG);
     }
 };
 
         setServerConfiguration(argc, argv);
         addResource(&swfstore_, "/swfstore.swf");
         addResource(&storage_whitelist_, "/storage-whitelist.xml");
+        addResource(&etag_resource, "/etag-test.gif");
         addEntryPoint(Wt::Application, createSWFStoreApp);
     }
 
     SWFStoreServer server(argc, argv);
     if (server.start()) {
         Wt::WServer::waitForShutdown();
+        stop_ioservice(server);
         server.stop();
     }
 }