[
  {
    "path": ".gitignore",
    "content": "*.class\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Package Files #\n*.war\n*.ear\n\n# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml\nhs_err_pid*\n\n.idea/\n*.iml\n\n/classes/\n/build/\n/bin/\n\n.gradle/\n\n.settings\n.classpath\n.project\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n"
  },
  {
    "path": "README.md",
    "content": "Spring Reactive Playground is a showcase for experimenting on applications based on\n[Spring Framework 5.0 Reactive support][], [Spring Data Reactive][] and [Reactive NoSQL drivers][].\n\n## Getting started\n\nPrerequisite:\n - [Install Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)\n - [Install MongoDB](https://www.mongodb.com/download-center) (optional)\n\nFor testing MongoDB support, run `mongod` and enable `mongo` profile in `application.properties`.\n\nRun `Application#main()` in your IDE or `./gradlew bootRun` on command line, then open\n`http://localhost:8080/` in your browser and use the various test pages.\n \n## License\nSpring Reactive Playground is released under version 2.0 of the [Apache License][].\n\n[Apache License]: http://www.apache.org/licenses/LICENSE-2.0\n[Spring Framework 5.0 Reactive support]: https://spring.io/blog/2016/07/28/reactive-programming-with-spring-5-0-m1\n[Spring Data Reactive]: https://spring.io/blog/2016/11/28/going-reactive-with-spring-data\n[Reactive NoSQL drivers]: https://mongodb.github.io/mongo-java-driver-reactivestreams/"
  },
  {
    "path": "build.gradle",
    "content": "buildscript {\n\text {\n\t\tspringBootVersion = '2.0.0.BUILD-SNAPSHOT'\n\t}\n\trepositories {\n\t\tmavenCentral()\n\t\tmaven { url \"https://repo.spring.io/snapshot\" }\n\t\tmaven { url \"https://repo.spring.io/milestone\" }\n\t}\n\tdependencies {\n\t\tclasspath(\"org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}\")\n\t}\n}\n\napply plugin: 'java'\napply plugin: 'spring-boot'\n\njar {\n\tbaseName = 'spring-reactive-playground'\n\tversion = '0.1.0-SNAPSHOT'\n}\n\nrepositories {\n\tmavenCentral()\n\tmaven { url 'https://oss.jfrog.org/libs-snapshot' }  // RxNetty 0.5.x snapshots\n\tmaven { url \"https://repo.spring.io/snapshot\" }\n\tmaven { url \"https://repo.spring.io/milestone\" }\n}\n\ndependencyManagement {\n\timports {\n\t\tmavenBom \"org.springframework.boot.experimental:spring-boot-dependencies-web-reactive:0.1.0.BUILD-SNAPSHOT\"\n\t}\n}\n\ndependencies {\n\n\tcompile \"io.reactivex:rxjava:1.2.1\"\n\tcompile \"io.reactivex:rxjava-reactive-streams:1.2.1\"\n\n\tcompile \"org.springframework.data:spring-data-commons:2.0.0.BUILD-SNAPSHOT\"\n\tcompile \"org.springframework.data:spring-data-mongodb:2.0.0.BUILD-SNAPSHOT\"\n\tcompile \"org.mongodb:mongodb-driver-reactivestreams:1.2.0\"\n\n\t// With Tomcat\n\t//compile \"org.springframework.boot.experimental:spring-boot-starter-web-reactive\"\n\n\t// With Reactor Netty\n\tcompile('org.springframework.boot.experimental:spring-boot-starter-web-reactive') {\n\t\texclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'\n\t}\n\tcompile \"io.projectreactor.ipc:reactor-netty\"\n\n\n\t// With RxNetty\n\t/*\n\tcompile('org.springframework.boot.experimental:spring-boot-starter-web-reactive') {\n\t\texclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'\n\t}\n\tcompile \"io.reactivex:rxnetty-common\"\n\tcompile \"io.reactivex:rxnetty-http\"\n\t*/\n\n\t// With Undertow\n\t/*\n\tcompile('org.springframework.boot.experimental:spring-boot-starter-web-reactive') {\n\t\texclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'\n\t}\n\tcompile \"io.undertow:undertow-core\"\n\t*/\n\n\t// With Jetty\n\t/*\n\tcompile('org.springframework.boot.experimental:spring-boot-starter-web-reactive') {\n\t\texclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'\n\t}\n\tcompile(\"org.eclipse.jetty:jetty-server\")\n\tcompile(\"org.eclipse.jetty:jetty-servlet\")\n\tcompile(\"org.eclipse.jetty:jetty-util\")\n\tcompile(\"org.eclipse.jetty:jetty-security\")\n\tcompile(\"org.eclipse.jetty:jetty-io\")\n\tcompile(\"org.eclipse.jetty:jetty-http\")\n\t*/\n\n\ttestCompile('org.springframework.boot:spring-boot-starter-test')\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed Jul 20 17:57:05 CEST 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.14.1-bin.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "version=1.0.0.BUILD-SNAPSHOT\n\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" -a \"$nonstop\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windows variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "src/main/java/playground/Application.java",
    "content": "/*\n * Copyright 2002-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.EnableAutoConfiguration;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;\nimport org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.web.reactive.HandlerMapping;\nimport org.springframework.web.reactive.config.CorsRegistry;\nimport org.springframework.web.reactive.config.EnableWebReactive;\nimport org.springframework.web.reactive.config.WebReactiveConfigurer;\nimport org.springframework.web.reactive.handler.SimpleUrlHandlerMapping;\nimport org.springframework.web.reactive.socket.WebSocketHandler;\nimport org.springframework.web.reactive.socket.server.WebSocketService;\nimport org.springframework.web.reactive.socket.server.support.HandshakeWebSocketService;\nimport org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter;\nimport org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy;\n\n/**\n * @author Sebastien Deleuze\n */\n@SpringBootApplication\n@EnableWebReactive\n@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})\npublic class Application implements WebReactiveConfigurer {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tSpringApplication.run(Application.class, args);\n\t}\n\n\t@Override\n\tpublic void addCorsMappings(CorsRegistry registry) {\n\t\tregistry.addMapping(\"/cors/config\");\n\t}\n\n\t@Bean\n\tpublic HandlerMapping handlerMapping() {\n\n\t\tMap<String, WebSocketHandler> map = new HashMap<>();\n\t\tmap.put(\"/websocket/echo\", new EchoWebSocketHandler());\n\n\t\tSimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();\n\t\tmapping.setUrlMap(map);\n\t\treturn mapping;\n\t}\n\n\t@Bean\n\tpublic WebSocketHandlerAdapter handlerAdapter() {\n\t\treturn new WebSocketHandlerAdapter(webSocketService());\n\t}\n\n\t@Bean\n\tpublic WebSocketService webSocketService() {\n\t\treturn new HandshakeWebSocketService(new ReactorNettyRequestUpgradeStrategy());\n\t}\n}\n"
  },
  {
    "path": "src/main/java/playground/CorsController.java",
    "content": "/*\n * Copyright 2002-2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground;\n\nimport org.springframework.web.bind.annotation.CrossOrigin;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n/**\n * @author Sebastien Deleuze\n */\n@RestController\npublic class CorsController {\n\n\t@GetMapping(\"/cors/no\")\n\tpublic Person noCors() {\n\t\treturn new Person(\"foo\", \"Bar\", \"Baz\");\n\t}\n\n\t@GetMapping(\"/cors/config\")\n\tpublic Person corsConfig() {\n\t\treturn new Person(\"foo\", \"Bar\", \"Baz\");\n\t}\n\n\t@CrossOrigin\n\t@GetMapping(\"/cors/annotation\")\n\tpublic Person corsaAnotation() {\n\t\treturn new Person(\"foo\", \"Bar\", \"Baz\");\n\t}\n\n}\n"
  },
  {
    "path": "src/main/java/playground/EchoWebSocketHandler.java",
    "content": "/*\n * Copyright 2002-2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground;\n\nimport java.time.Duration;\n\nimport reactor.core.publisher.Mono;\n\nimport org.springframework.web.reactive.socket.WebSocketHandler;\nimport org.springframework.web.reactive.socket.WebSocketMessage;\nimport org.springframework.web.reactive.socket.WebSocketSession;\n\n/**\n * WebSocketHandler that echoes the input with a delay of 2 seconds.\n */\npublic class EchoWebSocketHandler implements WebSocketHandler {\n\n\t@Override\n\tpublic Mono<Void> handle(WebSocketSession session) {\n\t\t// Use retain() for Reactor Netty\n\t\treturn session.send(session.receive().doOnNext(WebSocketMessage::retain).delay(Duration.ofSeconds(2)));\n\t}\n}\n"
  },
  {
    "path": "src/main/java/playground/JacksonController.java",
    "content": "/*\n * Copyright 2002-2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground;\n\nimport com.fasterxml.jackson.annotation.JsonView;\nimport reactor.core.publisher.Flux;\nimport reactor.core.publisher.Mono;\nimport rx.Observable;\n\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n/**\n * @author Sebastien Deleuze\n */\n@RestController\npublic class JacksonController {\n\n\tprivate final JacksonViewBean jacksonViewBean =\n\t\t\tnew JacksonViewBean(\"with\", \"with\", \"without\");\n\n\t@GetMapping(path = \"/jackson/view\")\n\t@JsonView(MyJacksonView1.class)\n\tJacksonViewBean view() {\n\t\treturn jacksonViewBean;\n\t}\n\n\t@GetMapping(path = \"/jackson/view-with-mono\")\n\t@JsonView(MyJacksonView1.class)\n\tMono<JacksonViewBean> viewWithMono() {\n\t\treturn Mono.just(jacksonViewBean);\n\t}\n\n\t@GetMapping(path = \"/jackson/view-with-flux\")\n\t@JsonView(MyJacksonView1.class)\n\tFlux<JacksonViewBean> viewWithFlux() {\n\t\treturn Flux.just(jacksonViewBean, jacksonViewBean);\n\t}\n\n\t@GetMapping(path = \"/jackson/view-with-observable\")\n\t@JsonView(MyJacksonView1.class)\n\tObservable<JacksonViewBean> viewWithObservable() {\n\t\treturn Observable.just(jacksonViewBean, jacksonViewBean);\n\t}\n\n\t@GetMapping(path = \"/jackson/full\")\n\tJacksonViewBean full() {\n\t\treturn jacksonViewBean;\n\t}\n\n\n\tprivate interface MyJacksonView1 {}\n\n\tprivate interface MyJacksonView2 {}\n\n\tprivate static class JacksonViewBean {\n\n\t\tpublic JacksonViewBean(String withView1, String withView2, String withoutView) {\n\t\t\tthis.withView1 = withView1;\n\t\t\tthis.withView2 = withView2;\n\t\t\tthis.withoutView = withoutView;\n\t\t}\n\n\t\t@JsonView(MyJacksonView1.class)\n\t\tprivate String withView1;\n\n\t\t@JsonView(MyJacksonView2.class)\n\t\tprivate String withView2;\n\n\t\tprivate String withoutView;\n\n\t\tpublic String getWithView1() {\n\t\t\treturn withView1;\n\t\t}\n\n\t\tpublic void setWithView1(String withView1) {\n\t\t\tthis.withView1 = withView1;\n\t\t}\n\n\t\tpublic String getWithView2() {\n\t\t\treturn withView2;\n\t\t}\n\n\t\tpublic void setWithView2(String withView2) {\n\t\t\tthis.withView2 = withView2;\n\t\t}\n\n\t\tpublic String getWithoutView() {\n\t\t\treturn withoutView;\n\t\t}\n\n\t\tpublic void setWithoutView(String withoutView) {\n\t\t\tthis.withoutView = withoutView;\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/main/java/playground/Person.java",
    "content": "/*\n * Copyright 2002-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground;\n\nimport org.springframework.data.annotation.Id;\nimport org.springframework.data.mongodb.core.mapping.Document;\n\n/**\n * @author Sebastien Deleuze\n */\n@Document\npublic class Person {\n\n\tprivate String id;\n\n\tprivate String firstname;\n\n\tprivate String lastname;\n\n\n\tpublic Person() {\n\t}\n\n\tpublic Person(String firstname, String lastname) {\n\t\tthis.firstname = firstname;\n\t\tthis.lastname = lastname;\n\t}\n\n\tpublic Person(String id, String firstname, String lastname) {\n\t\tthis.id = id;\n\t\tthis.firstname = firstname;\n\t\tthis.lastname = lastname;\n\t}\n\n\n\t@Id\n\tpublic String getId() {\n\t\treturn id;\n\t}\n\n\tpublic void setId(String id) {\n\t\tthis.id = id;\n\t}\n\n\tpublic String getFirstname() {\n\t\treturn firstname;\n\t}\n\n\tpublic void setFirstname(String firstname) {\n\t\tthis.firstname = firstname;\n\t}\n\n\tpublic String getLastname() {\n\t\treturn lastname;\n\t}\n\n\tpublic void setLastname(String lastname) {\n\t\tthis.lastname = lastname;\n\t}\n\n\t@Override\n\tpublic boolean equals(Object o) {\n\t\tif (this == o) {\n\t\t\treturn true;\n\t\t}\n\t\tif (o == null || getClass() != o.getClass()) {\n\t\t\treturn false;\n\t\t}\n\n\t\tPerson person = (Person) o;\n\n\t\tif (id != null ? !id.equals(person.id) : person.id != null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (firstname != null ? !firstname.equals(person.firstname) :\n\t\t\t\tperson.firstname != null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn lastname != null ? lastname.equals(person.lastname) :\n\t\t\t\tperson.lastname == null;\n\n\t}\n\n\t@Override\n\tpublic int hashCode() {\n\t\tint result = id != null ? id.hashCode() : 0;\n\t\tresult = 31 * result + (firstname != null ? firstname.hashCode() : 0);\n\t\tresult = 31 * result + (lastname != null ? lastname.hashCode() : 0);\n\t\treturn result;\n\t}\n\n\t@Override\n\tpublic String toString() {\n\t\treturn \"Person{\" +\n\t\t\t\t\"id='\" + id + '\\'' +\n\t\t\t\t\", firstname='\" + firstname + '\\'' +\n\t\t\t\t\", lastname='\" + lastname + '\\'' +\n\t\t\t\t'}';\n\t}\n}\n"
  },
  {
    "path": "src/main/java/playground/ResourceController.java",
    "content": "/*\n * Copyright 2002-2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground;\n\nimport org.springframework.core.io.ClassPathResource;\nimport org.springframework.core.io.Resource;\nimport org.springframework.http.MediaType;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RequestParam;\nimport org.springframework.web.bind.annotation.RestController;\n\n@RestController\npublic class ResourceController {\n\n\t@GetMapping(path = \"/\", produces = MediaType.TEXT_HTML_VALUE)\n\tResource index() {\n\t\treturn new ClassPathResource(\"static/index.html\");\n\t}\n\n\t@GetMapping(path = \"/file\")\n\tResource resource(@RequestParam(value = \"name\", required = false) String name) {\n\t\treturn new ClassPathResource(\"static/\" + name);\n\t}\n\n}\n"
  },
  {
    "path": "src/main/java/playground/SseController.java",
    "content": "/*\n * Copyright 2002-2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground;\n\nimport java.time.Duration;\n\nimport reactor.core.publisher.Flux;\nimport reactor.core.publisher.ReplayProcessor;\n\nimport org.springframework.http.codec.ServerSentEvent;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n@RestController\npublic class SseController {\n\n\tprivate ReplayProcessor<ServerSentEvent<String>> replayProcessor = ReplayProcessor.<ServerSentEvent<String>>create();\n\n\t@GetMapping(\"/sse/string\")\n\tFlux<String> string() {\n\t\treturn Flux\n\t\t\t.interval(Duration.ofSeconds(1))\n\t\t\t.map(l -> \"foo \" + l);\n\t}\n\n\t@GetMapping(\"/sse/person\")\n\tFlux<Person> person() {\n\t\treturn Flux\n\t\t\t.interval(Duration.ofSeconds(1))\n\t\t\t.map(l -> new Person(Long.toString(l), \"foo\", \"bar\"));\n\t}\n\n\t@GetMapping(\"/sse/event\")\n\tFlux<ServerSentEvent<String>> event() {\n\t\treturn Flux\n\t\t\t.interval(Duration.ofSeconds(1))\n\t\t\t.map(l -> ServerSentEvent\n\t\t\t\t\t.builder(\"foo\\nbar\")\n\t\t\t\t\t.comment(\"bar\\nbaz\")\n\t\t\t\t\t.id(Long.toString(l))\n\t\t\t\t\t.build());\n\t}\n\n\t@PostMapping(\"/sse/receive/{val}\")\n    public void receive(@PathVariable(\"val\") String s) {\n        replayProcessor.onNext(ServerSentEvent.builder(s).build());\n    }\n\n\t@GetMapping(\"/sse/send\")\n\tpublic Flux<ServerSentEvent<String>> send() {\n\t\treturn replayProcessor.log(\"playground\");\n\t}\n\n}\n"
  },
  {
    "path": "src/main/java/playground/mongo/MongoConfiguration.java",
    "content": "/*\n * Copyright 2002-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground.mongo;\n\nimport org.springframework.beans.factory.annotation.Value;\nimport org.springframework.boot.CommandLineRunner;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.context.annotation.Profile;\nimport org.springframework.data.mongodb.config.AbstractReactiveMongoConfiguration;\nimport org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories;\nimport org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;\n\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.mongodb.reactivestreams.client.MongoClient;\nimport com.mongodb.reactivestreams.client.MongoClients;\nimport playground.Person;\n\n/**\n * @author Sebastien Deleuze\n * @author Mark Paluch\n */\n@Profile(\"mongo\")\n@Configuration\n@EnableReactiveMongoRepositories\npublic class MongoConfiguration extends AbstractReactiveMongoConfiguration {\n\n    @Value(\"${mongo.database}\")\n    private String database;\n\n    @Bean\n    ObjectMapper objectMapper() {\n        return Jackson2ObjectMapperBuilder.json().build();\n    }\n\n    @Override\n    public MongoClient mongoClient() {\n        return MongoClients.create();\n    }\n\n    @Override\n    protected String getDatabaseName() {\n        return database;\n    }\n\n    @Bean\n    CommandLineRunner initData(PersonReactiveCrudRepository personRepository) {\n        return (p) -> {\n            personRepository.deleteAll().block();\n            personRepository.save(new Person(\"1\", \"Eric\", \"Foo\")).block();\n            personRepository.save(new Person(\"2\", \"Raymond\", \"Bar\")).block();\n            personRepository.save(new Person(\"3\", \"Paul\", \"Baz\")).block();\n        };\n    }\n}\n"
  },
  {
    "path": "src/main/java/playground/mongo/PersonReactiveController.java",
    "content": "/*\n * Copyright 2002-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground.mongo;\n\nimport org.reactivestreams.Publisher;\nimport playground.Person;\nimport reactor.core.publisher.Flux;\nimport reactor.core.publisher.Mono;\n\nimport org.springframework.context.annotation.Profile;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RestController;\n\n/**\n * @author Sebastien Deleuze\n * @author Mark Paluch\n */\n@Profile(\"mongo\")\n@RestController\npublic class PersonReactiveController {\n\n\tprivate final PersonReactiveCrudRepository repository;\n\n\tpublic PersonReactiveController(PersonReactiveCrudRepository repository) {\n\t\tthis.repository = repository;\n\t}\n\n\t@PostMapping(\"/mongo\")\n\tMono<Void> create(@RequestBody Publisher<Person> personStream) {\n\t\treturn this.repository.save(personStream).then();\n\t}\n\n\t@GetMapping(\"/mongo\")\n\tFlux<Person> list() {\n\t\treturn this.repository.findAll();\n\t}\n\n\t@GetMapping(\"/mongo/{id}\")\n\tMono<Person> findById(@PathVariable String id) {\n\t\treturn this.repository.findOne(id);\n\t}\n\n}\n"
  },
  {
    "path": "src/main/java/playground/mongo/PersonReactiveCrudRepository.java",
    "content": "/*\n * Copyright 2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage playground.mongo;\n\nimport org.springframework.data.repository.reactive.ReactiveCrudRepository;\nimport playground.Person;\n\n/**\n * @author Mark Paluch\n */\npublic interface PersonReactiveCrudRepository extends ReactiveCrudRepository<Person, String> {\n\n}\n"
  },
  {
    "path": "src/main/java/playground/mongo/PersonRxJava1Controller.java",
    "content": "/*\n * Copyright 2002-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage playground.mongo;\n\nimport playground.Person;\nimport rx.Observable;\nimport rx.Single;\n\nimport org.springframework.context.annotation.Profile;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RestController;\n\n/**\n * @author Sebastien Deleuze\n * @author Mark Paluch\n */\n@Profile(\"mongo\")\n@RestController\npublic class PersonRxJava1Controller {\n\n\tprivate final PersonRxJava1CrudRepository repository;\n\n\tpublic PersonRxJava1Controller(PersonRxJava1CrudRepository repository) {\n\t\tthis.repository = repository;\n\t}\n\n\t@PostMapping(\"/rxjava/mongo\")\n\tObservable<Person> create(@RequestBody Observable<Person> personStream) {\n\t\treturn this.repository.save(personStream);\n\t}\n\n\t@GetMapping(\"/rxjava/mongo\")\n\tObservable<Person> list() {\n\t\treturn this.repository.findAll();\n\t}\n\n\t@GetMapping(\"/rxjava/mongo/{id}\")\n\tSingle<Person> findById(@PathVariable String id) {\n\t\treturn this.repository.findOne(id).toSingle();\n\t}\n\n}\n"
  },
  {
    "path": "src/main/java/playground/mongo/PersonRxJava1CrudRepository.java",
    "content": "/*\n * Copyright 2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage playground.mongo;\n\nimport org.springframework.data.repository.reactive.RxJava1CrudRepository;\n\nimport playground.Person;\n\n/**\n * @author Mark Paluch\n */\npublic interface PersonRxJava1CrudRepository extends RxJava1CrudRepository<Person, String> {\n\n}\n"
  },
  {
    "path": "src/main/resources/application.properties",
    "content": "# spring.profiles.active=mongo\n\nmongo.database=test\n"
  },
  {
    "path": "src/main/resources/static/common.js",
    "content": "function addEvent(evnt, elem, func) {\n    if (elem.addEventListener)  // W3C DOM\n        elem.addEventListener(evnt,func,false);\n    else if (elem.attachEvent) { // IE DOM\n        elem.attachEvent(\"on\"+evnt, func);\n    }\n    else { // No much to do\n        elem[evnt] = func;\n    }\n}\n\nfunction print(message) {\n    var elem = document.createElement('span');\n    elem.innerHTML = message + '<br />';\n    document.getElementById('output').appendChild(elem);\n}"
  },
  {
    "path": "src/main/resources/static/cors.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\">\n    <title>Cross Origin</title>\n    <meta http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate, max-age=0\">\n    <script type=\"text/javascript\" src=\"/file?name=common.js\"></script>\n\n</head>\n<body>\n\n    <p>\n        This page must be run from other domain than http://localhost:8080 to be effective.<br />\n        You can run 2 instances of this app, one on http://localhost:8080 for REST webservices<br />\n        and one on http://localhost:8181 for this page.\n    </p>\n\n    <p>\n        <button id=\"no-cors\">No CORS</button>\n        <button id=\"cors-config\">CORS Config</button>\n        <button id=\"cors-annotation\">@CrossOrigin annotation</button>\n    </p>\n\n    <p id=\"output\"></p>\n\n    <p>\n        Return <a href=\"/\">to the index</a>\n    </p>\n\n    <script type=\"text/javascript\">\n\n        addEvent(\"click\", document.getElementById('no-cors'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/cors/no', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n        addEvent(\"click\", document.getElementById('cors-config'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/cors/config', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n        addEvent(\"click\", document.getElementById('cors-annotation'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/cors/annotation', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n    </script>\n\n</body>\n"
  },
  {
    "path": "src/main/resources/static/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\">\n    <title>Spring Reactive Playground</title>\n    <meta http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate, max-age=0\">\n</head>\n<body>\n\n    <p>\n        Welcome to Spring Reactive Playground!<br />\n        What do you want to test?\n\n        <ul>\n            <li><a href=\"/file?name=cors.html\">Reactive CORS support</a></li>\n            <li><a href=\"/file?name=jackson.html\">Reactive JSON REST Webservices with Jackson</a></li>\n            <li><a href=\"/file?name=sse.html\">Reactive Server Sent Events</a></li>\n            <li><a href=\"/file?name=websocket.html\">Reactive Websocket</a></li>\n            <li><a href=\"/file?name=mongo.html\">Reactive Spring Data + Mongo</a></li>\n        </ul>\n    </p>\n\n</body>\n"
  },
  {
    "path": "src/main/resources/static/jackson.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\">\n    <title>Jackson</title>\n    <meta http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate, max-age=0\">\n    <script type=\"text/javascript\" src=\"/file?name=common.js\"></script>\n\n</head>\n<body>\n\n    <p>\n        <button id=\"jsonview\">JsonView</button>\n        <button id=\"jsonview-with-mono\">JsonView with Mono</button>\n        <button id=\"jsonview-with-flux\">JsonView with Flux</button>\n        <button id=\"jsonview-with-observable\">JsonView with Observable</button>\n        <button id=\"full\">No JsonView</button>\n    </p>\n\n    <p id=\"output\"></p>\n\n    <p>\n        Return <a href=\"/\">to the index</a>\n    </p>\n\n    <script type=\"text/javascript\">\n\n        addEvent(\"click\", document.getElementById('jsonview'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/jackson/view', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n        addEvent(\"click\", document.getElementById('jsonview-with-mono'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/jackson/view-with-mono', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n        addEvent(\"click\", document.getElementById('jsonview-with-flux'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/jackson/view-with-flux', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n        addEvent(\"click\", document.getElementById('jsonview-with-observable'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/jackson/view-with-observable', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n        addEvent(\"click\", document.getElementById('full'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/jackson/full', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n    </script>\n\n</body>\n"
  },
  {
    "path": "src/main/resources/static/mongo.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\">\n    <title>Mongo</title>\n    <meta http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate, max-age=0\">\n    <script type=\"text/javascript\" src=\"/file?name=common.js\"></script>\n\n</head>\n<body>\n\n    <p>\n        <button id=\"list-all\">List all the persons</button>\n        <button id=\"get-one\">Get one person</button>\n    </p>\n\n    <p id=\"output\"></p>\n\n    <p>\n        Return <a href=\"/\">to the index</a>\n    </p>\n\n    <script type=\"text/javascript\">\n\n        addEvent(\"click\", document.getElementById('list-all'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/mongo/', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n        addEvent(\"click\", document.getElementById('get-one'), function() {\n            var req = new XMLHttpRequest();\n            req.open('GET', 'http://' + document.domain + ':8080/mongo/1', false);\n            req.send(null);\n            if(req.status == 200)\n                print('Response received: ' + req.responseText);\n        });\n\n\n    </script>\n\n</body>\n"
  },
  {
    "path": "src/main/resources/static/sse.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>SSE example</title>\n    <script type=\"text/javascript\" src=\"/file?name=common.js\"></script>\n</head>\n    <p>\n        <p>\n            <button id=\"send-data\">Send data</button><br />\n            SSE with processor: <ul id=\"processor-events\"></ul>\n        </p>\n        <p>\n            <button id=\"subscribe-string-events\">Subscribe</button><br />\n            SSE with String: <ul id=\"string-events\"></ul>\n        </p>\n        <p>\n            <button id=\"subscribe-person-events\">Subscribe</button><br />\n            SSE with Person: <ul id=\"person-events\"></ul>\n        </p>\n        <p>\n            <button id=\"subscribe-raw-events\">Subscribe</button><br />\n            SSE with raw events: <ul id=\"raw-events\"></ul>\n        </p>\n    </p>\n\n    <p>\n        Return <a href=\"/\">to the index</a>\n    </p>\n\n    <script type=\"application/javascript\">\n\n        addEvent(\"click\", document.getElementById('subscribe-string-events'), function() {\n            var stringEvents = document.getElementById(\"string-events\");\n            var stringEventSource = new EventSource(\"/sse/string\");\n            stringEventSource.onmessage = function(e) {\n              var newElement = document.createElement(\"li\");\n              newElement.innerHTML = \"Message: \" + e.data;\n              stringEvents.appendChild(newElement);\n            }\n        });\n\n\n        addEvent(\"click\", document.getElementById('subscribe-person-events'), function() {\n            var personEvents = document.getElementById(\"person-events\");\n            var personEventSource = new EventSource(\"/sse/person\");\n            personEventSource.onmessage = function(e) {\n              var newElement = document.createElement(\"li\");\n              var person = JSON.parse(e.data);\n              newElement.innerHTML = \"Person: id=\" + person.id + \", firstname=\" + person.firstname + \", lastname=\" + person.lastname;\n              personEvents.appendChild(newElement);\n            }\n        });\n\n        addEvent(\"click\", document.getElementById('subscribe-raw-events'), function() {\n            var rawEvents = document.getElementById(\"raw-events\");\n            var rawEventSource = new EventSource(\"/sse/event\");\n            rawEventSource.onmessage = function(e) {\n              var newElement = document.createElement(\"li\");\n              newElement.innerHTML = \"Event: id=\" + e.lastEventId + \", data=\" + e.data;\n              rawEvents.appendChild(newElement);\n            }\n        });\n\n        addEvent(\"click\", document.getElementById('send-data'), function() {\n            var req = new XMLHttpRequest();\n            req.open('POST', '/sse/receive/foo', true);\n            req.send(null);\n        });\n\n        var processorEvents = document.getElementById(\"processor-events\");\n        var processorEventSource = new EventSource(\"/sse/send\");\n        processorEventSource.onmessage = function(e) {\n          var newElement = document.createElement(\"li\");\n          newElement.innerHTML = \"Event: id=\" + e.lastEventId + \", data=\" + e.data;\n          processorEvents.appendChild(newElement);\n        }\n\n    </script>\n</body>\n</html>"
  },
  {
    "path": "src/main/resources/static/websocket.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>WebSocket example</title>\n    <script type=\"text/javascript\" src=\"/file?name=common.js\"></script>\n</head>\n    <p>Echo the input with a delay of 2 seconds</p>\n    <p>\n        Input<br />\n        <textarea id=\"input\" name=\"input\" cols=\"40\"></textarea>\n    </p>\n\n    <p>\n        Output<br />\n        <div id=\"output\"></div>\n    </p>\n\n    <p>\n        Return <a href=\"/\">to the index</a>\n    </p>\n\n    <script type=\"application/javascript\">\n        var socket = new WebSocket(\"ws://\" + location.host + \"/websocket/echo\");\n        addEvent(\"keypress\", document.getElementById('input'), function(event) {\n            socket.send(event.key);\n        });\n\n        var output = document.getElementById(\"output\");\n        socket.onmessage = function(e) {\n          output.innerHTML = output.innerHTML + e.data;\n        }\n\n    </script>\n</body>\n</html>"
  }
]