浏览代码

Example CPP should only use an "all" handler, if NO_FILES is set

bel2125 8 年之前
父节点
当前提交
035cd63c02
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      examples/embedded_cpp/embedded_cpp.cpp

+ 7 - 0
examples/embedded_cpp/embedded_cpp.cpp

@@ -296,13 +296,20 @@ main(int argc, char *argv[])
 	ABHandler h_ab;
 	ABHandler h_ab;
 	server.addHandler("/a/b", h_ab);
 	server.addHandler("/a/b", h_ab);
 
 
+#ifdef NO_FILES
 	/* This handler will handle "everything else", including
 	/* This handler will handle "everything else", including
 	 * requests to files. If this handler is installed,
 	 * requests to files. If this handler is installed,
 	 * NO_FILES should be set. */
 	 * NO_FILES should be set. */
 	FooHandler h_foo;
 	FooHandler h_foo;
 	server.addHandler("", h_foo);
 	server.addHandler("", h_foo);
 
 
+	printf("See a page from the \"all\" handler at http://localhost:%s/\n", PORT);
+#else
+	FooHandler h_foo;
+	server.addHandler("**.foo", h_foo);
 	printf("Browse files at http://localhost:%s/\n", PORT);
 	printf("Browse files at http://localhost:%s/\n", PORT);
+#endif
+
 	printf("Run example at http://localhost:%s%s\n", PORT, EXAMPLE_URI);
 	printf("Run example at http://localhost:%s%s\n", PORT, EXAMPLE_URI);
 	printf("Exit at http://localhost:%s%s\n", PORT, EXIT_URI);
 	printf("Exit at http://localhost:%s%s\n", PORT, EXIT_URI);