├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src └── main ├── java └── com │ └── example │ ├── DashboardProperties.java │ ├── MongoConfiguration.java │ ├── SpringReactiveDashboardApplication.java │ ├── WebConfig.java │ ├── dashboard │ ├── DashboardService.java │ ├── DefaultDashboardService.java │ ├── ReactorIssue.java │ ├── ReactorPerson.java │ ├── ReactorPersonNotFoundException.java │ └── ReactorPersonRepository.java │ ├── integration │ ├── github │ │ ├── GithubClient.java │ │ ├── GithubIssue.java │ │ ├── GithubIssueDeserializer.java │ │ ├── GithubUser.java │ │ └── GithubUserDeserializer.java │ └── gitter │ │ ├── GitterClient.java │ │ ├── GitterMessage.java │ │ ├── GitterMessageDeserializer.java │ │ ├── GitterUser.java │ │ └── GitterUserDeserializer.java │ └── web │ ├── DashboardController.java │ └── DemoController.java └── resources ├── application.properties ├── static ├── css │ └── bootstrap.min.css ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 └── js │ └── bootstrap.min.js └── templates ├── chat.ftl ├── home.ftl └── issues.ftl /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### IntelliJ IDEA ### 5 | .idea 6 | *.iws 7 | *.iml 8 | *.ipr 9 | 10 | ## Application specific 11 | application-secret.properties 12 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bclozel/spring-reactive-university/d742e6f9efe93dbf6465a9d99b9c22a79a4942eb/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spring Reactive University 2 | 3 | ## MongoDB should be installed and started 4 | 5 | Can be downloaded from here: https://www.mongodb.com/download-center 6 | 7 | Start it with [`mongod`](https://docs.mongodb.com/manual/reference/program/mongod/) 8 | 9 | ## Prepare the authentication tokens 10 | 11 | * Get your gitter token from https://developer.gitter.im/apps 12 | * Create a new Github personal access token here: https://github.com/settings/tokens 13 | 14 | Add both values as properties in `application-secret.properties` with the configuration 15 | keys `dashboard.github.username`, `dashboard.github.token` and `dashboard.gitter.token`. 16 | 17 | ## Launching 18 | 19 | Application will be be available at http://localhost:8080/ -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # 58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look 59 | # for the new JDKs provided by Oracle. 60 | # 61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then 62 | # 63 | # Apple JDKs 64 | # 65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 66 | fi 67 | 68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then 69 | # 70 | # Apple JDKs 71 | # 72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 73 | fi 74 | 75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then 76 | # 77 | # Oracle JDKs 78 | # 79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 80 | fi 81 | 82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then 83 | # 84 | # Apple JDKs 85 | # 86 | export JAVA_HOME=`/usr/libexec/java_home` 87 | fi 88 | ;; 89 | esac 90 | 91 | if [ -z "$JAVA_HOME" ] ; then 92 | if [ -r /etc/gentoo-release ] ; then 93 | JAVA_HOME=`java-config --jre-home` 94 | fi 95 | fi 96 | 97 | if [ -z "$M2_HOME" ] ; then 98 | ## resolve links - $0 may be a link to maven's home 99 | PRG="$0" 100 | 101 | # need this for relative symlinks 102 | while [ -h "$PRG" ] ; do 103 | ls=`ls -ld "$PRG"` 104 | link=`expr "$ls" : '.*-> \(.*\)$'` 105 | if expr "$link" : '/.*' > /dev/null; then 106 | PRG="$link" 107 | else 108 | PRG="`dirname "$PRG"`/$link" 109 | fi 110 | done 111 | 112 | saveddir=`pwd` 113 | 114 | M2_HOME=`dirname "$PRG"`/.. 115 | 116 | # make it fully qualified 117 | M2_HOME=`cd "$M2_HOME" && pwd` 118 | 119 | cd "$saveddir" 120 | # echo Using m2 at $M2_HOME 121 | fi 122 | 123 | # For Cygwin, ensure paths are in UNIX format before anything is touched 124 | if $cygwin ; then 125 | [ -n "$M2_HOME" ] && 126 | M2_HOME=`cygpath --unix "$M2_HOME"` 127 | [ -n "$JAVA_HOME" ] && 128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 129 | [ -n "$CLASSPATH" ] && 130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 131 | fi 132 | 133 | # For Migwn, ensure paths are in UNIX format before anything is touched 134 | if $mingw ; then 135 | [ -n "$M2_HOME" ] && 136 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 137 | [ -n "$JAVA_HOME" ] && 138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 139 | # TODO classpath? 140 | fi 141 | 142 | if [ -z "$JAVA_HOME" ]; then 143 | javaExecutable="`which javac`" 144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 145 | # readlink(1) is not available as standard on Solaris 10. 146 | readLink=`which readlink` 147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 148 | if $darwin ; then 149 | javaHome="`dirname \"$javaExecutable\"`" 150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 151 | else 152 | javaExecutable="`readlink -f \"$javaExecutable\"`" 153 | fi 154 | javaHome="`dirname \"$javaExecutable\"`" 155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 156 | JAVA_HOME="$javaHome" 157 | export JAVA_HOME 158 | fi 159 | fi 160 | fi 161 | 162 | if [ -z "$JAVACMD" ] ; then 163 | if [ -n "$JAVA_HOME" ] ; then 164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 165 | # IBM's JDK on AIX uses strange locations for the executables 166 | JAVACMD="$JAVA_HOME/jre/sh/java" 167 | else 168 | JAVACMD="$JAVA_HOME/bin/java" 169 | fi 170 | else 171 | JAVACMD="`which java`" 172 | fi 173 | fi 174 | 175 | if [ ! -x "$JAVACMD" ] ; then 176 | echo "Error: JAVA_HOME is not defined correctly." >&2 177 | echo " We cannot execute $JAVACMD" >&2 178 | exit 1 179 | fi 180 | 181 | if [ -z "$JAVA_HOME" ] ; then 182 | echo "Warning: JAVA_HOME environment variable is not set." 183 | fi 184 | 185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 186 | 187 | # For Cygwin, switch paths to Windows format before running java 188 | if $cygwin; then 189 | [ -n "$M2_HOME" ] && 190 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 191 | [ -n "$JAVA_HOME" ] && 192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 193 | [ -n "$CLASSPATH" ] && 194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 195 | fi 196 | 197 | # traverses directory structure from process work directory to filesystem root 198 | # first directory with .mvn subdirectory is considered project base directory 199 | find_maven_basedir() { 200 | local basedir=$(pwd) 201 | local wdir=$(pwd) 202 | while [ "$wdir" != '/' ] ; do 203 | if [ -d "$wdir"/.mvn ] ; then 204 | basedir=$wdir 205 | break 206 | fi 207 | wdir=$(cd "$wdir/.."; pwd) 208 | done 209 | echo "${basedir}" 210 | } 211 | 212 | # concatenates all lines of a file 213 | concat_lines() { 214 | if [ -f "$1" ]; then 215 | echo "$(tr -s '\n' ' ' < "$1")" 216 | fi 217 | } 218 | 219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} 220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 221 | 222 | # Provide a "standardized" way to retrieve the CLI args that will 223 | # work with both Windows and non-Windows executions. 224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 225 | export MAVEN_CMD_LINE_ARGS 226 | 227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 228 | 229 | exec "$JAVACMD" \ 230 | $MAVEN_OPTS \ 231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 233 | ${WRAPPER_LAUNCHER} "$@" 234 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | set MAVEN_CMD_LINE_ARGS=%* 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | 121 | set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" 122 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 123 | 124 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% 125 | if ERRORLEVEL 1 goto error 126 | goto end 127 | 128 | :error 129 | set ERROR_CODE=1 130 | 131 | :end 132 | @endlocal & set ERROR_CODE=%ERROR_CODE% 133 | 134 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 135 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 136 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 137 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 138 | :skipRcPost 139 | 140 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 141 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 142 | 143 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 144 | 145 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.example 7 | spring-reactive-dashboard 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | spring-reactive-dashboard 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.0.0.BUILD-SNAPSHOT 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-webflux 31 | 32 | 33 | org.springframework 34 | spring-context-support 35 | 36 | 37 | org.freemarker 38 | freemarker 39 | 40 | 41 | org.webjars.bower 42 | jquery 43 | 44 | 45 | 46 | org.springframework.data 47 | spring-data-commons 48 | 2.0.0.BUILD-SNAPSHOT 49 | 50 | 51 | org.springframework.boot 52 | spring-boot-starter-data-mongodb-reactive 53 | 54 | 55 | 56 | org.springframework.boot 57 | spring-boot-configuration-processor 58 | true 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-devtools 63 | 64 | 65 | org.springframework.boot 66 | spring-boot-starter-test 67 | test 68 | 69 | 70 | 71 | 72 | 73 | 74 | org.springframework.boot.experimental 75 | spring-boot-dependencies-web-reactive 76 | 0.1.0.BUILD-SNAPSHOT 77 | pom 78 | import 79 | 80 | 81 | org.webjars.bower 82 | jquery 83 | 2.1.1 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | org.springframework.boot 92 | spring-boot-maven-plugin 93 | 94 | 95 | 96 | 97 | 98 | 99 | spring-snapshots 100 | Spring Snapshots 101 | https://repo.spring.io/snapshot 102 | 103 | true 104 | 105 | 106 | 107 | spring-milestones 108 | Spring Milestones 109 | https://repo.spring.io/milestone 110 | 111 | false 112 | 113 | 114 | 115 | 116 | 117 | spring-snapshots 118 | Spring Snapshots 119 | https://repo.spring.io/snapshot 120 | 121 | true 122 | 123 | 124 | 125 | spring-milestones 126 | Spring Milestones 127 | https://repo.spring.io/milestone 128 | 129 | false 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /src/main/java/com/example/DashboardProperties.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * @author Brian Clozel 7 | */ 8 | @ConfigurationProperties("dashboard") 9 | public class DashboardProperties { 10 | 11 | private final Reactor reactor = new Reactor(); 12 | 13 | private final Github github = new Github(); 14 | 15 | private final Gitter gitter = new Gitter(); 16 | 17 | public Reactor getReactor() { 18 | return reactor; 19 | } 20 | 21 | public Github getGithub() { 22 | return github; 23 | } 24 | 25 | public Gitter getGitter() { 26 | return gitter; 27 | } 28 | 29 | public static class Reactor { 30 | 31 | private String gitterRoomId = "5534f75e15522ed4b3df41a7"; 32 | 33 | public String getGitterRoomId() { 34 | return gitterRoomId; 35 | } 36 | 37 | public void setGitterRoomId(String gitterRoomId) { 38 | this.gitterRoomId = gitterRoomId; 39 | } 40 | } 41 | 42 | public static class Github { 43 | 44 | private String username; 45 | 46 | private String token; 47 | 48 | public String getUsername() { 49 | return username; 50 | } 51 | 52 | public void setUsername(String username) { 53 | this.username = username; 54 | } 55 | 56 | public String getToken() { 57 | return token; 58 | } 59 | 60 | public void setToken(String token) { 61 | this.token = token; 62 | } 63 | } 64 | 65 | public static class Gitter { 66 | 67 | private String token; 68 | 69 | public String getToken() { 70 | return token; 71 | } 72 | 73 | public void setToken(String token) { 74 | this.token = token; 75 | } 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/example/MongoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import com.mongodb.reactivestreams.client.MongoClient; 5 | import com.mongodb.reactivestreams.client.MongoClients; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.autoconfigure.mongo.MongoProperties; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.data.mongodb.config.AbstractReactiveMongoConfiguration; 12 | import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories; 13 | import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; 14 | 15 | /** 16 | * @author Sebastien Deleuze 17 | * @author Mark Paluch 18 | */ 19 | @Configuration 20 | @EnableReactiveMongoRepositories 21 | public class MongoConfiguration extends AbstractReactiveMongoConfiguration { 22 | 23 | private MongoProperties mongoProperties; 24 | 25 | @Autowired 26 | public MongoConfiguration(MongoProperties mongoProperties) { 27 | this.mongoProperties = mongoProperties; 28 | } 29 | 30 | @Bean 31 | ObjectMapper objectMapper() { 32 | return Jackson2ObjectMapperBuilder.json().build(); 33 | } 34 | 35 | @Override 36 | public MongoClient mongoClient() { 37 | return MongoClients.create(); 38 | } 39 | 40 | @Override 41 | protected String getDatabaseName() { 42 | return mongoProperties.getDatabase(); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/com/example/SpringReactiveDashboardApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.dashboard.ReactorPerson; 4 | import com.example.dashboard.ReactorPersonRepository; 5 | import reactor.core.publisher.Flux; 6 | 7 | import org.springframework.boot.CommandLineRunner; 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; 11 | import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; 12 | import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; 13 | import org.springframework.boot.autoconfigure.mongo.MongoProperties; 14 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 15 | import org.springframework.context.annotation.Bean; 16 | 17 | @SpringBootApplication 18 | @EnableConfigurationProperties({DashboardProperties.class, MongoProperties.class}) 19 | @EnableAutoConfiguration(exclude={MongoAutoConfiguration.class, MongoDataAutoConfiguration.class}) 20 | public class SpringReactiveDashboardApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringReactiveDashboardApplication.class, args); 24 | } 25 | 26 | @Bean 27 | public CommandLineRunner initDatabase(ReactorPersonRepository repository) { 28 | 29 | Flux people = Flux.just( 30 | new ReactorPerson("smaldini", "Stephane Maldini"), 31 | new ReactorPerson("simonbasle", "Simon Basle"), 32 | new ReactorPerson("akarnokd", "David Karnok"), 33 | new ReactorPerson("rstoya05", "Rossen Stoyanchev"), 34 | new ReactorPerson("sdeleuze", "Sebastien Deleuze"), 35 | new ReactorPerson("poutsma", "Arjen Poutsma"), 36 | new ReactorPerson("bclozel", "Brian Clozel") 37 | ); 38 | 39 | return args -> { 40 | repository.deleteAll().thenMany(repository.save(people)).blockLast(); 41 | }; 42 | } 43 | 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/com/example/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.web.reactive.context.ReactiveWebApplicationContext; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.reactive.config.ViewResolverRegistry; 7 | import org.springframework.web.reactive.config.WebFluxConfigurer; 8 | import org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer; 9 | 10 | /** 11 | * @author Brian Clozel 12 | */ 13 | @Configuration 14 | public class WebConfig implements WebFluxConfigurer { 15 | 16 | @Bean 17 | public FreeMarkerConfigurer freeMarkerConfigurer(ReactiveWebApplicationContext applicationContext) { 18 | FreeMarkerConfigurer configurer = new FreeMarkerConfigurer(); 19 | configurer.setTemplateLoaderPath("classpath:/templates/"); 20 | configurer.setResourceLoader(applicationContext); 21 | return configurer; 22 | } 23 | 24 | @Override 25 | public void configureViewResolvers(ViewResolverRegistry registry) { 26 | registry.freeMarker(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/example/dashboard/DashboardService.java: -------------------------------------------------------------------------------- 1 | package com.example.dashboard; 2 | 3 | import com.example.integration.gitter.GitterMessage; 4 | import reactor.core.publisher.Flux; 5 | 6 | /** 7 | * @author Brian Clozel 8 | */ 9 | public interface DashboardService { 10 | 11 | Flux findReactorIssues(); 12 | 13 | Flux getLatestChatMessages(int limit); 14 | 15 | Flux streamChatMessages(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/example/dashboard/DefaultDashboardService.java: -------------------------------------------------------------------------------- 1 | package com.example.dashboard; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import com.example.DashboardProperties; 7 | import com.example.integration.github.GithubClient; 8 | import com.example.integration.github.GithubIssue; 9 | import com.example.integration.gitter.GitterClient; 10 | import com.example.integration.gitter.GitterMessage; 11 | import com.example.integration.gitter.GitterUser; 12 | import reactor.core.publisher.Flux; 13 | import reactor.core.publisher.Mono; 14 | 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.stereotype.Service; 17 | 18 | /** 19 | * @author Brian Clozel 20 | */ 21 | @Service 22 | public class DefaultDashboardService implements DashboardService { 23 | 24 | private final DashboardProperties properties; 25 | 26 | private final GitterClient gitterClient; 27 | 28 | private final GithubClient githubClient; 29 | 30 | @Autowired 31 | public DefaultDashboardService(DashboardProperties properties, GitterClient gitterClient, GithubClient githubClient) { 32 | this.properties = properties; 33 | this.gitterClient = gitterClient; 34 | this.githubClient = githubClient; 35 | } 36 | 37 | @Override 38 | public Flux findReactorIssues() { 39 | Flux issues = this.githubClient.findOpenIssues("reactor", "reactor-core"); 40 | Mono> users = this.gitterClient 41 | .getUsersInRoom(this.properties.getReactor().getGitterRoomId(), 300) 42 | .collectList(); 43 | 44 | return users.flatMap(gitterUserList -> { 45 | return issues.map(issue -> { 46 | String userLogin = issue.getUser().getLogin(); 47 | Optional gitterUser = gitterUserList.stream() 48 | .filter(gu -> gu.getUsername().equals(userLogin)).findFirst(); 49 | 50 | return new ReactorIssue(issue, gitterUser.isPresent()); 51 | }); 52 | }); 53 | } 54 | 55 | @Override 56 | public Flux getLatestChatMessages(int limit) { 57 | return this.gitterClient 58 | .latestChatMessages(this.properties.getReactor().getGitterRoomId(), limit); 59 | } 60 | 61 | @Override 62 | public Flux streamChatMessages() { 63 | String roomId = this.properties.getReactor().getGitterRoomId(); 64 | return this.gitterClient.streamChatMessages(roomId); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/example/dashboard/ReactorIssue.java: -------------------------------------------------------------------------------- 1 | package com.example.dashboard; 2 | 3 | import com.example.integration.github.GithubIssue; 4 | 5 | /** 6 | * @author Brian Clozel 7 | */ 8 | public class ReactorIssue { 9 | 10 | private long number; 11 | 12 | private String url; 13 | 14 | private String title; 15 | 16 | private String userLogin; 17 | 18 | private String userAvatarUrl; 19 | 20 | private boolean userOnline; 21 | 22 | public ReactorIssue(GithubIssue issue, boolean userOnline) { 23 | this.number = issue.getNumber(); 24 | this.url = issue.getUrl(); 25 | this.title = issue.getTitle(); 26 | this.userLogin = issue.getUser().getLogin(); 27 | this.userAvatarUrl = issue.getUser().getAvatarUrl(); 28 | this.userOnline = userOnline; 29 | } 30 | 31 | public long getNumber() { 32 | return number; 33 | } 34 | 35 | public void setNumber(long number) { 36 | this.number = number; 37 | } 38 | 39 | public String getUrl() { 40 | return url; 41 | } 42 | 43 | public void setUrl(String url) { 44 | this.url = url; 45 | } 46 | 47 | public String getTitle() { 48 | return title; 49 | } 50 | 51 | public void setTitle(String title) { 52 | this.title = title; 53 | } 54 | 55 | public String getUserLogin() { 56 | return userLogin; 57 | } 58 | 59 | public void setUserLogin(String userLogin) { 60 | this.userLogin = userLogin; 61 | } 62 | 63 | public String getUserAvatarUrl() { 64 | return userAvatarUrl; 65 | } 66 | 67 | public void setUserAvatarUrl(String userAvatarUrl) { 68 | this.userAvatarUrl = userAvatarUrl; 69 | } 70 | 71 | public boolean isUserOnline() { 72 | return userOnline; 73 | } 74 | 75 | public void setUserOnline(boolean userOnline) { 76 | this.userOnline = userOnline; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/example/dashboard/ReactorPerson.java: -------------------------------------------------------------------------------- 1 | package com.example.dashboard; 2 | 3 | import org.springframework.data.mongodb.core.mapping.Document; 4 | 5 | /** 6 | * @author Brian Clozel 7 | */ 8 | @Document 9 | public class ReactorPerson { 10 | 11 | private String id; 12 | 13 | private String name; 14 | 15 | public ReactorPerson() { 16 | } 17 | 18 | public ReactorPerson(String id, String name) { 19 | this.id = id; 20 | this.name = name; 21 | } 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/example/dashboard/ReactorPersonNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.example.dashboard; 2 | 3 | /** 4 | * @author Brian Clozel 5 | */ 6 | public class ReactorPersonNotFoundException extends RuntimeException { 7 | 8 | public ReactorPersonNotFoundException(String id) { 9 | super("ReactorPerson not found with id=" + id); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/example/dashboard/ReactorPersonRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.dashboard; 2 | 3 | import org.springframework.data.repository.reactive.ReactiveCrudRepository; 4 | 5 | /** 6 | * @author Brian Clozel 7 | */ 8 | public interface ReactorPersonRepository extends ReactiveCrudRepository { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/github/GithubClient.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.github; 2 | 3 | import com.example.DashboardProperties; 4 | import reactor.core.publisher.Flux; 5 | 6 | import org.springframework.http.MediaType; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.web.reactive.function.client.ClientRequest; 9 | import org.springframework.web.reactive.function.client.ExchangeFilterFunction; 10 | import org.springframework.web.reactive.function.client.ExchangeFilterFunctions; 11 | import org.springframework.web.reactive.function.client.WebClient; 12 | 13 | /** 14 | * @author Brian Clozel 15 | * @author Sebastien Deleuze 16 | */ 17 | @Component 18 | public class GithubClient { 19 | 20 | private static final MediaType VND_GITHUB_V3 = MediaType.valueOf("application/vnd.github.v3+json"); 21 | 22 | private final WebClient webClient; 23 | 24 | public GithubClient(DashboardProperties properties) { 25 | this.webClient = WebClient 26 | .create("https://api.github.com") 27 | .filter(ExchangeFilterFunctions 28 | .basicAuthentication(properties.getGithub().getUsername(), 29 | properties.getGithub().getToken())) 30 | .filter(userAgent()); 31 | } 32 | 33 | public Flux findOpenIssues(String owner, String repo) { 34 | return this.webClient 35 | .get() 36 | .uri("/repos/{owner}/{repo}/issues?state=open", owner, repo) 37 | .accept(VND_GITHUB_V3) 38 | .exchange().flatMap(response -> response.bodyToFlux(GithubIssue.class)); 39 | } 40 | 41 | 42 | private ExchangeFilterFunction userAgent() { 43 | return (clientRequest, exchangeFunction) -> { 44 | ClientRequest newRequest = ClientRequest 45 | .from(clientRequest) 46 | .header("User-Agent", "Spring Framework WebClient") 47 | .build(); 48 | return exchangeFunction.exchange(newRequest); 49 | }; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/github/GithubIssue.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.github; 2 | 3 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 4 | 5 | /** 6 | * @author Brian Clozel 7 | */ 8 | @JsonDeserialize(using = GithubIssueDeserializer.class) 9 | public class GithubIssue { 10 | 11 | private long id; 12 | 13 | private String url; 14 | 15 | private int number; 16 | 17 | private String title; 18 | 19 | private GithubUser user; 20 | 21 | public GithubIssue(long id, String url, int number, String title, GithubUser user) { 22 | this.id = id; 23 | this.url = url; 24 | this.number = number; 25 | this.title = title; 26 | this.user = user; 27 | } 28 | 29 | public long getId() { 30 | return id; 31 | } 32 | 33 | public void setId(long id) { 34 | this.id = id; 35 | } 36 | 37 | public String getUrl() { 38 | return url; 39 | } 40 | 41 | public void setUrl(String url) { 42 | this.url = url; 43 | } 44 | 45 | public int getNumber() { 46 | return number; 47 | } 48 | 49 | public void setNumber(int number) { 50 | this.number = number; 51 | } 52 | 53 | public String getTitle() { 54 | return title; 55 | } 56 | 57 | public void setTitle(String title) { 58 | this.title = title; 59 | } 60 | 61 | public GithubUser getUser() { 62 | return user; 63 | } 64 | 65 | public void setUser(GithubUser user) { 66 | this.user = user; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/github/GithubIssueDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.github; 2 | 3 | import java.io.IOException; 4 | 5 | import com.fasterxml.jackson.core.JsonParser; 6 | import com.fasterxml.jackson.core.ObjectCodec; 7 | import com.fasterxml.jackson.databind.DeserializationContext; 8 | import com.fasterxml.jackson.databind.JsonNode; 9 | 10 | import org.springframework.boot.jackson.JsonObjectDeserializer; 11 | 12 | /** 13 | * @author Brian Clozel 14 | */ 15 | public class GithubIssueDeserializer extends JsonObjectDeserializer { 16 | 17 | @Override 18 | protected GithubIssue deserializeObject(JsonParser jsonParser, DeserializationContext deserializationContext, 19 | ObjectCodec objectCodec, JsonNode jsonNode) throws IOException { 20 | Long id = nullSafeValue(jsonNode.get("id"), Long.class); 21 | String url = nullSafeValue(jsonNode.get("url"), String.class); 22 | Integer number = nullSafeValue(jsonNode.get("number"), Integer.class); 23 | String title = nullSafeValue(jsonNode.get("title"), String.class); 24 | JsonNode userNode = jsonNode.get("user"); 25 | GithubUser user = objectCodec.readValue(userNode.traverse(objectCodec), GithubUser.class); 26 | return new GithubIssue(id, url, number, title, user); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/github/GithubUser.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.github; 2 | 3 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 4 | 5 | /** 6 | * @author Brian Clozel 7 | */ 8 | @JsonDeserialize(using = GithubUserDeserializer.class) 9 | public class GithubUser { 10 | 11 | private long id; 12 | 13 | private String login; 14 | 15 | private String avatarUrl; 16 | 17 | private String url; 18 | 19 | public GithubUser(long id, String login, String avatarUrl, String url) { 20 | this.id = id; 21 | this.login = login; 22 | this.avatarUrl = avatarUrl; 23 | this.url = url; 24 | } 25 | 26 | public long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getLogin() { 35 | return login; 36 | } 37 | 38 | public void setLogin(String login) { 39 | this.login = login; 40 | } 41 | 42 | public String getAvatarUrl() { 43 | return avatarUrl; 44 | } 45 | 46 | public void setAvatarUrl(String avatarUrl) { 47 | this.avatarUrl = avatarUrl; 48 | } 49 | 50 | public String getUrl() { 51 | return url; 52 | } 53 | 54 | public void setUrl(String url) { 55 | this.url = url; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/github/GithubUserDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.github; 2 | 3 | import java.io.IOException; 4 | 5 | import com.fasterxml.jackson.core.JsonParser; 6 | import com.fasterxml.jackson.core.ObjectCodec; 7 | import com.fasterxml.jackson.databind.DeserializationContext; 8 | import com.fasterxml.jackson.databind.JsonNode; 9 | 10 | import org.springframework.boot.jackson.JsonObjectDeserializer; 11 | 12 | /** 13 | * @author Brian Clozel 14 | */ 15 | public class GithubUserDeserializer extends JsonObjectDeserializer { 16 | 17 | @Override 18 | protected GithubUser deserializeObject(JsonParser jsonParser, DeserializationContext deserializationContext, 19 | ObjectCodec objectCodec, JsonNode jsonNode) throws IOException { 20 | 21 | Long id = nullSafeValue(jsonNode.get("id"), Long.class); 22 | String login = nullSafeValue(jsonNode.get("login"), String.class); 23 | String avatarUrl = nullSafeValue(jsonNode.get("avatar_url"), String.class); 24 | String url = nullSafeValue(jsonNode.get("url"), String.class); 25 | return new GithubUser(id, login, avatarUrl, url); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/gitter/GitterClient.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.gitter; 2 | 3 | import com.example.DashboardProperties; 4 | import reactor.core.publisher.Flux; 5 | import reactor.core.publisher.Mono; 6 | 7 | import org.springframework.http.MediaType; 8 | import org.springframework.stereotype.Component; 9 | import org.springframework.web.reactive.function.client.ClientRequest; 10 | import org.springframework.web.reactive.function.client.ExchangeFilterFunction; 11 | import org.springframework.web.reactive.function.client.WebClient; 12 | 13 | /** 14 | * @author Brian Clozel 15 | * @author Sebastien Deleuze 16 | */ 17 | @Component 18 | public class GitterClient { 19 | 20 | private final WebClient webClient; 21 | 22 | public GitterClient(DashboardProperties properties) { 23 | this.webClient = WebClient.create() 24 | .filter(oAuthToken(properties.getGitter().getToken())); 25 | } 26 | 27 | public Flux getUsersInRoom(String roomId, int limit) { 28 | return this.webClient 29 | .get().uri("https://api.gitter.im/v1/rooms/{roomId}/users?limit={limit}", roomId, limit) 30 | .accept(MediaType.APPLICATION_JSON) 31 | .exchange() 32 | .flatMap(response -> response.bodyToFlux(GitterUser.class)); 33 | } 34 | 35 | public Mono findUserInRoom(String userName, String roomId) { 36 | return this.webClient 37 | .get() 38 | .uri("https://api.gitter.im/v1/rooms/{roomId}/users?q={userName}", roomId, userName) 39 | .accept(MediaType.APPLICATION_JSON) 40 | .exchange() 41 | .then(response -> response.bodyToMono(GitterUser.class)); 42 | } 43 | 44 | public Flux latestChatMessages(String roomId, int limit) { 45 | return this.webClient 46 | .get() 47 | .uri("https://api.gitter.im/v1/rooms/{roomId}/chatMessages?limit={limit}", roomId, limit) 48 | .accept(MediaType.APPLICATION_JSON) 49 | .exchange() 50 | .flatMap(response -> response.bodyToFlux(GitterMessage.class)); 51 | } 52 | 53 | public Flux streamChatMessages(String roomId) { 54 | return this.webClient 55 | .get() 56 | .uri("https://stream.gitter.im/v1/rooms/{roomId}/chatMessages", roomId) 57 | .accept(MediaType.TEXT_EVENT_STREAM) 58 | .exchange() 59 | .flatMap(response -> response.bodyToFlux(GitterMessage.class)); 60 | } 61 | 62 | private ExchangeFilterFunction oAuthToken(String token) { 63 | return (clientRequest, exchangeFunction) -> 64 | exchangeFunction 65 | .exchange(ClientRequest 66 | .from(clientRequest) 67 | .header("Authorization", "Bearer " + token) 68 | .build() 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/gitter/GitterMessage.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.gitter; 2 | 3 | import java.time.Instant; 4 | 5 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 6 | 7 | /** 8 | * @author Brian Clozel 9 | */ 10 | @JsonDeserialize(using = GitterMessageDeserializer.class) 11 | public class GitterMessage { 12 | 13 | private String id; 14 | 15 | private String text; 16 | 17 | private String html; 18 | 19 | private GitterUser fromUser; 20 | 21 | private Instant sent; 22 | 23 | public GitterMessage(String id, String text, String html, GitterUser fromUser, Instant sent) { 24 | this.id = id; 25 | this.text = text; 26 | this.html = html; 27 | this.fromUser = fromUser; 28 | this.sent = sent; 29 | } 30 | 31 | public String getId() { 32 | return id; 33 | } 34 | 35 | public void setId(String id) { 36 | this.id = id; 37 | } 38 | 39 | public String getText() { 40 | return text; 41 | } 42 | 43 | public void setText(String text) { 44 | this.text = text; 45 | } 46 | 47 | public String getHtml() { 48 | return html; 49 | } 50 | 51 | public void setHtml(String html) { 52 | this.html = html; 53 | } 54 | 55 | public Instant getSent() { 56 | return sent; 57 | } 58 | 59 | public void setSent(Instant sent) { 60 | this.sent = sent; 61 | } 62 | 63 | public GitterUser getFromUser() { 64 | return fromUser; 65 | } 66 | 67 | public void setFromUser(GitterUser fromUser) { 68 | this.fromUser = fromUser; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/gitter/GitterMessageDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.gitter; 2 | 3 | import java.io.IOException; 4 | import java.time.Instant; 5 | 6 | import com.fasterxml.jackson.core.JsonParser; 7 | import com.fasterxml.jackson.core.ObjectCodec; 8 | import com.fasterxml.jackson.databind.DeserializationContext; 9 | import com.fasterxml.jackson.databind.JsonNode; 10 | 11 | import org.springframework.boot.jackson.JsonObjectDeserializer; 12 | 13 | /** 14 | * @author Brian Clozel 15 | */ 16 | public class GitterMessageDeserializer extends JsonObjectDeserializer { 17 | 18 | @Override 19 | protected GitterMessage deserializeObject(JsonParser jsonParser, DeserializationContext deserializationContext, 20 | ObjectCodec objectCodec, JsonNode jsonNode) throws IOException { 21 | 22 | String id = nullSafeValue(jsonNode.get("id"), String.class); 23 | String text = nullSafeValue(jsonNode.get("text"), String.class); 24 | String html = nullSafeValue(jsonNode.get("html"), String.class); 25 | JsonNode userNode = jsonNode.get("fromUser"); 26 | GitterUser user = objectCodec.readValue(userNode.traverse(objectCodec), GitterUser.class); 27 | String sent = nullSafeValue(jsonNode.get("sent"), String.class); 28 | return new GitterMessage(id, text, html, user, Instant.parse(sent)); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/gitter/GitterUser.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.gitter; 2 | 3 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 4 | 5 | /** 6 | * @author Brian Clozel 7 | */ 8 | @JsonDeserialize(using = GitterUserDeserializer.class) 9 | public class GitterUser { 10 | 11 | private String id; 12 | 13 | private String url; 14 | 15 | private String username; 16 | 17 | private String displayName; 18 | 19 | private String avatarUrl; 20 | 21 | private String avatarUrlMedium; 22 | 23 | private String avatarUrlSmall; 24 | 25 | public GitterUser(String id, String url, String username, String displayName, String avatarUrl, 26 | String avatarUrlMedium, String avatarUrlSmall) { 27 | this.id = id; 28 | this.url = url; 29 | this.username = username; 30 | this.displayName = displayName; 31 | this.avatarUrl = avatarUrl; 32 | this.avatarUrlMedium = avatarUrlMedium; 33 | this.avatarUrlSmall = avatarUrlSmall; 34 | } 35 | 36 | public String getId() { 37 | return id; 38 | } 39 | 40 | public void setId(String id) { 41 | this.id = id; 42 | } 43 | 44 | public String getUrl() { 45 | return url; 46 | } 47 | 48 | public void setUrl(String url) { 49 | this.url = url; 50 | } 51 | 52 | public String getUsername() { 53 | return username; 54 | } 55 | 56 | public void setUsername(String username) { 57 | this.username = username; 58 | } 59 | 60 | public String getDisplayName() { 61 | return displayName; 62 | } 63 | 64 | public void setDisplayName(String displayName) { 65 | this.displayName = displayName; 66 | } 67 | 68 | public String getAvatarUrl() { 69 | return avatarUrl; 70 | } 71 | 72 | public void setAvatarUrl(String avatarUrl) { 73 | this.avatarUrl = avatarUrl; 74 | } 75 | 76 | public String getAvatarUrlMedium() { 77 | return avatarUrlMedium; 78 | } 79 | 80 | public void setAvatarUrlMedium(String avatarUrlMedium) { 81 | this.avatarUrlMedium = avatarUrlMedium; 82 | } 83 | 84 | public String getAvatarUrlSmall() { 85 | return avatarUrlSmall; 86 | } 87 | 88 | public void setAvatarUrlSmall(String avatarUrlSmall) { 89 | this.avatarUrlSmall = avatarUrlSmall; 90 | } 91 | 92 | 93 | /* 94 | 95 | "avatarUrl": "https://avatars-04.gitter.im/gh/uv/3/bclozel", 96 | "avatarUrlMedium": "https://avatars2.githubusercontent.com/u/103264?v=3&s=128", 97 | "avatarUrlSmall": "https://avatars2.githubusercontent.com/u/103264?v=3&s=60", 98 | "displayName": "Brian Clozel", 99 | "gv": "3", 100 | "id": "568e464916b6c7089cc186de", 101 | "url": "/bclozel", 102 | "username": "bclozel", 103 | "v": 2 104 | */ 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/example/integration/gitter/GitterUserDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.example.integration.gitter; 2 | 3 | import java.io.IOException; 4 | 5 | import com.fasterxml.jackson.core.JsonParser; 6 | import com.fasterxml.jackson.core.ObjectCodec; 7 | import com.fasterxml.jackson.databind.DeserializationContext; 8 | import com.fasterxml.jackson.databind.JsonNode; 9 | 10 | import org.springframework.boot.jackson.JsonObjectDeserializer; 11 | 12 | /** 13 | * @author Brian Clozel 14 | */ 15 | public class GitterUserDeserializer extends JsonObjectDeserializer { 16 | 17 | @Override 18 | protected GitterUser deserializeObject(JsonParser jsonParser, DeserializationContext deserializationContext, 19 | ObjectCodec objectCodec, JsonNode jsonNode) throws IOException { 20 | String userId = nullSafeValue(jsonNode.get("id"), String.class); 21 | String userUrl = nullSafeValue(jsonNode.get("url"), String.class); 22 | String userName = nullSafeValue(jsonNode.get("username"), String.class); 23 | String userDisplayName = nullSafeValue(jsonNode.get("displayName"), String.class); 24 | String userAvatar = nullSafeValue(jsonNode.get("avatarUrl"), String.class); 25 | String userAvatarMed = nullSafeValue(jsonNode.get("avatarUrlMedium"), String.class); 26 | String userAvatarSm = nullSafeValue(jsonNode.get("avatarUrlSmall"), String.class); 27 | return new GitterUser(userId, userUrl, userName, userDisplayName, 28 | userAvatar, userAvatarMed, userAvatarSm); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/example/web/DashboardController.java: -------------------------------------------------------------------------------- 1 | package com.example.web; 2 | 3 | import com.example.dashboard.DashboardService; 4 | import com.example.dashboard.ReactorPerson; 5 | import com.example.dashboard.ReactorPersonNotFoundException; 6 | import com.example.dashboard.ReactorPersonRepository; 7 | import com.example.integration.gitter.GitterMessage; 8 | import reactor.core.publisher.Flux; 9 | import reactor.core.publisher.Mono; 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.stereotype.Controller; 15 | import org.springframework.ui.Model; 16 | import org.springframework.web.bind.annotation.ExceptionHandler; 17 | import org.springframework.web.bind.annotation.GetMapping; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestParam; 20 | import org.springframework.web.bind.annotation.ResponseBody; 21 | 22 | /** 23 | * @author Brian Clozel 24 | */ 25 | @Controller 26 | public class DashboardController { 27 | 28 | private final DashboardService dashboardService; 29 | 30 | private final ReactorPersonRepository repository; 31 | 32 | @Autowired 33 | public DashboardController(DashboardService dashboardService, ReactorPersonRepository repository) { 34 | this.dashboardService = dashboardService; 35 | this.repository = repository; 36 | } 37 | 38 | @GetMapping("/") 39 | public String home() { 40 | return "home"; 41 | } 42 | 43 | @GetMapping("/reactor/people") 44 | @ResponseBody 45 | public Flux findReactorPeople() { 46 | return this.repository.findAll(); 47 | } 48 | 49 | @GetMapping("/reactor/people/{id}") 50 | @ResponseBody 51 | public Mono findReactorPerson(@PathVariable String id) { 52 | return this.repository.findOne(id) 53 | .otherwiseIfEmpty(Mono.error(new ReactorPersonNotFoundException(id))); 54 | } 55 | 56 | @ExceptionHandler 57 | public ResponseEntity handleNotFoundException(ReactorPersonNotFoundException exc) { 58 | return ResponseEntity.notFound().build(); 59 | } 60 | 61 | @GetMapping("/issues") 62 | public String issues(Model model) { 63 | model.addAttribute("issues", this.dashboardService.findReactorIssues()); 64 | return "issues"; 65 | } 66 | 67 | @GetMapping("/chat") 68 | public String chat() { 69 | return "chat"; 70 | } 71 | 72 | @GetMapping(path = "/chatMessages", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 73 | @ResponseBody 74 | public Flux chatMessages(@RequestParam(required = false, defaultValue = "10") String limit) { 75 | return this.dashboardService.getLatestChatMessages(Integer.parseInt(limit)); 76 | } 77 | 78 | @GetMapping(value = "/chatStream", produces = MediaType.TEXT_EVENT_STREAM_VALUE) 79 | @ResponseBody 80 | public Flux streamChatMessages() { 81 | return this.dashboardService.streamChatMessages(); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/example/web/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.example.web; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | 5 | import reactor.core.publisher.Flux; 6 | import reactor.core.publisher.Mono; 7 | 8 | import org.springframework.core.io.buffer.DataBuffer; 9 | import org.springframework.core.io.buffer.DataBufferFactory; 10 | import org.springframework.core.io.buffer.DefaultDataBufferFactory; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.http.server.reactive.ServerHttpResponse; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | import org.springframework.web.bind.annotation.RestController; 17 | import org.springframework.web.server.ServerWebExchange; 18 | 19 | /** 20 | * @author Brian Clozel 21 | */ 22 | @RestController 23 | @RequestMapping("/demo") 24 | public class DemoController { 25 | 26 | // You should create and share a single instance, or even preferrably 27 | // get the the factory from the underlying container 28 | private DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory(); 29 | 30 | @RequestMapping("/test") 31 | public String test() { 32 | return "This is a test"; 33 | } 34 | 35 | @RequestMapping("/hello") 36 | public Mono hello(@RequestParam String name) { 37 | return Mono.just("Hello, " + name + "!"); 38 | } 39 | 40 | @RequestMapping("/waitforit") 41 | public Mono waiting() { 42 | return Mono.never(); 43 | } 44 | 45 | @RequestMapping("/exchange") 46 | public Mono exchange(ServerWebExchange exchange) { 47 | ServerHttpResponse response = exchange.getResponse(); 48 | response.setStatusCode(HttpStatus.OK); 49 | response.getHeaders().setContentType(MediaType.TEXT_PLAIN); 50 | DataBuffer buf = dataBufferFactory.wrap("Hello from exchange".getBytes(StandardCharsets.UTF_8)); 51 | return response.writeWith(Flux.just(buf)); 52 | } 53 | 54 | @RequestMapping("/error") 55 | public Mono error() { 56 | return Mono.error(new IllegalArgumentException("My custom error message")); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=secret 2 | spring.data.mongodb.database=dashboard -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bclozel/spring-reactive-university/d742e6f9efe93dbf6465a9d99b9c22a79a4942eb/src/main/resources/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bclozel/spring-reactive-university/d742e6f9efe93dbf6465a9d99b9c22a79a4942eb/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bclozel/spring-reactive-university/d742e6f9efe93dbf6465a9d99b9c22a79a4942eb/src/main/resources/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bclozel/spring-reactive-university/d742e6f9efe93dbf6465a9d99b9c22a79a4942eb/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.7 (http://getbootstrap.com) 3 | * Copyright 2011-2016 Twitter, Inc. 4 | * Licensed under the MIT license 5 | */ 6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); -------------------------------------------------------------------------------- /src/main/resources/templates/chat.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Reactor Community Dashboard 10 | 11 | 12 | 13 | 27 |
28 |
29 |
30 |

#reactor on gitter

31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 39 | 40 | 61 | 62 | -------------------------------------------------------------------------------- /src/main/resources/templates/home.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Reactor Community Dashboard 10 | 11 | 12 | 13 | 34 |
35 |
36 |

Reactor Project

37 |

Developing Reactive applications with Reactive Streams and Java8

38 |

Publisher.subscribe(me)

39 |
40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/templates/issues.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Reactor Community Dashboard 10 | 11 | 12 | 13 | 27 |
28 |

Reactor Core project issues

29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | <#list issues as issue> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
#Issue titleReported ByOnline?
${issue.number}${issue.title}${issue.userLogin}
49 |
50 | 51 | 52 | 53 | --------------------------------------------------------------------------------