Reeng in progress
This commit is contained in:
@@ -86,6 +86,26 @@
|
||||
</sources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>echo-property</id>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<echo>///////////////////////////// webapp.port=${webapp.port}</echo>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencyManagement>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package org.jeudego.pairgoth.api
|
||||
|
||||
import com.republicate.kson.Json
|
||||
import org.jeudego.pairgoth.web.ApiException
|
||||
import org.jeudego.pairgoth.server.ApiException
|
||||
import org.slf4j.LoggerFactory
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.HttpServletResponse
|
||||
|
@@ -3,7 +3,7 @@ package org.jeudego.pairgoth.api
|
||||
import com.republicate.kson.Json
|
||||
import org.jeudego.pairgoth.model.Tournament
|
||||
import org.jeudego.pairgoth.store.Store
|
||||
import org.jeudego.pairgoth.web.Event
|
||||
import org.jeudego.pairgoth.server.Event
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
|
||||
interface PairgothApiHandler: ApiHandler {
|
||||
|
@@ -8,8 +8,8 @@ import org.jeudego.pairgoth.model.PairingType
|
||||
import org.jeudego.pairgoth.model.getID
|
||||
import org.jeudego.pairgoth.model.toID
|
||||
import org.jeudego.pairgoth.model.toJson
|
||||
import org.jeudego.pairgoth.web.Event
|
||||
import org.jeudego.pairgoth.web.Event.*
|
||||
import org.jeudego.pairgoth.server.Event
|
||||
import org.jeudego.pairgoth.server.Event.*
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.HttpServletResponse
|
||||
|
||||
|
@@ -5,8 +5,8 @@ import com.republicate.kson.toJsonArray
|
||||
import org.jeudego.pairgoth.api.ApiHandler.Companion.badRequest
|
||||
import org.jeudego.pairgoth.model.Player
|
||||
import org.jeudego.pairgoth.model.fromJson
|
||||
import org.jeudego.pairgoth.web.Event
|
||||
import org.jeudego.pairgoth.web.Event.*
|
||||
import org.jeudego.pairgoth.server.Event
|
||||
import org.jeudego.pairgoth.server.Event.*
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.HttpServletResponse
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import com.republicate.kson.toJsonArray
|
||||
import org.jeudego.pairgoth.api.ApiHandler.Companion.badRequest
|
||||
import org.jeudego.pairgoth.model.Game
|
||||
import org.jeudego.pairgoth.model.toJson
|
||||
import org.jeudego.pairgoth.web.Event
|
||||
import org.jeudego.pairgoth.server.Event
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.HttpServletResponse
|
||||
|
||||
|
@@ -4,8 +4,8 @@ import com.republicate.kson.Json
|
||||
import com.republicate.kson.toJsonArray
|
||||
import org.jeudego.pairgoth.api.ApiHandler.Companion.badRequest
|
||||
import org.jeudego.pairgoth.model.TeamTournament
|
||||
import org.jeudego.pairgoth.web.Event
|
||||
import org.jeudego.pairgoth.web.Event.*
|
||||
import org.jeudego.pairgoth.server.Event
|
||||
import org.jeudego.pairgoth.server.Event.*
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.HttpServletResponse
|
||||
|
||||
|
@@ -10,9 +10,9 @@ import org.jeudego.pairgoth.model.Tournament
|
||||
import org.jeudego.pairgoth.model.fromJson
|
||||
import org.jeudego.pairgoth.model.toJson
|
||||
import org.jeudego.pairgoth.store.Store
|
||||
import org.jeudego.pairgoth.web.ApiServlet
|
||||
import org.jeudego.pairgoth.web.Event
|
||||
import org.jeudego.pairgoth.web.Event.*
|
||||
import org.jeudego.pairgoth.server.ApiServlet
|
||||
import org.jeudego.pairgoth.server.Event
|
||||
import org.jeudego.pairgoth.server.Event.*
|
||||
import org.w3c.dom.Element
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.HttpServletResponse
|
||||
|
@@ -3,7 +3,7 @@ package org.jeudego.pairgoth.oauth
|
||||
// In progress
|
||||
|
||||
import com.republicate.kson.Json
|
||||
import org.jeudego.pairgoth.web.WebappManager
|
||||
import org.jeudego.pairgoth.server.WebappManager
|
||||
//import com.republicate.modality.util.AESCryptograph
|
||||
//import com.republicate.modality.util.Cryptograph
|
||||
import org.apache.commons.codec.binary.Base64
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package org.jeudego.pairgoth.web
|
||||
package org.jeudego.pairgoth.server
|
||||
|
||||
import com.republicate.kson.Json
|
||||
import java.io.IOException
|
@@ -1,4 +1,4 @@
|
||||
package org.jeudego.pairgoth.web
|
||||
package org.jeudego.pairgoth.server
|
||||
|
||||
import com.republicate.kson.Json
|
||||
import org.jeudego.pairgoth.api.ApiHandler
|
@@ -1,4 +1,4 @@
|
||||
package org.jeudego.pairgoth.web
|
||||
package org.jeudego.pairgoth.server
|
||||
|
||||
import info.macias.sse.events.MessageEvent
|
||||
import java.util.concurrent.atomic.AtomicLong
|
@@ -1,4 +1,4 @@
|
||||
package org.jeudego.pairgoth.web
|
||||
package org.jeudego.pairgoth.server
|
||||
|
||||
import com.republicate.kson.Json
|
||||
import org.jeudego.pairgoth.util.Colorizer.blue
|
@@ -1,4 +1,4 @@
|
||||
package org.jeudego.pairgoth.web
|
||||
package org.jeudego.pairgoth.server
|
||||
|
||||
import info.macias.sse.EventBroadcast
|
||||
import info.macias.sse.events.MessageEvent
|
@@ -1,4 +1,4 @@
|
||||
package org.jeudego.pairgoth.web
|
||||
package org.jeudego.pairgoth.server
|
||||
|
||||
import com.republicate.mailer.SmtpLoop
|
||||
import org.apache.commons.lang3.tuple.Pair
|
||||
@@ -51,8 +51,7 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
/* ServletContextListener interface */
|
||||
override fun contextInitialized(sce: ServletContextEvent) {
|
||||
context = sce.servletContext
|
||||
logger.info("---------- Starting Pairgoth Server ----------")
|
||||
context.setAttribute("manager", this)
|
||||
logger.info("---------- Starting $WEBAPP_NAME ----------")
|
||||
webappRoot = context.getRealPath("/")
|
||||
try {
|
||||
// load default properties
|
||||
@@ -63,7 +62,8 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
properties[(key as String).removePrefix(PAIRGOTH_PROPERTIES_PREFIX)] = value
|
||||
}
|
||||
|
||||
logger.info("Using profile {}", properties.getProperty("webapp.env"))
|
||||
val env = properties.getProperty("webapp.env")
|
||||
logger.info("Using profile $env", )
|
||||
|
||||
// set system user agent string to empty string
|
||||
System.setProperty("http.agent", "")
|
||||
@@ -84,11 +84,15 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
}
|
||||
|
||||
override fun contextDestroyed(sce: ServletContextEvent) {
|
||||
logger.info("---------- Stopping Web Application ----------")
|
||||
logger.info("---------- Stopping $WEBAPP_NAME ----------")
|
||||
|
||||
stopService("smtp");
|
||||
|
||||
val context = sce.servletContext
|
||||
for (service in webServices.keys) stopService(service, true)
|
||||
// ??? DriverManager.deregisterDriver(com.mysql.cj.jdbc.Driver ...);
|
||||
|
||||
logger.info("---------- Stopped $WEBAPP_NAME ----------")
|
||||
}
|
||||
|
||||
/* ServletContextAttributeListener interface */
|
||||
@@ -101,6 +105,7 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
override fun sessionDestroyed(se: HttpSessionEvent) {}
|
||||
|
||||
companion object {
|
||||
const val WEBAPP_NAME = "Pairgoth API Server"
|
||||
const val PAIRGOTH_PROPERTIES_PREFIX = "pairgoth."
|
||||
lateinit var webappRoot: String
|
||||
lateinit var context: ServletContext
|
@@ -2,7 +2,7 @@ package org.jeudego.pairgoth.store
|
||||
|
||||
import org.jeudego.pairgoth.model.ID
|
||||
import org.jeudego.pairgoth.model.Tournament
|
||||
import org.jeudego.pairgoth.web.WebappManager
|
||||
import org.jeudego.pairgoth.server.WebappManager
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
private fun createStoreImplementation(): StoreImplementation {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# webapp
|
||||
webapp.env = dev
|
||||
webapp.url = http://localhost:8080
|
||||
webapp.url = https://localhost:8085
|
||||
|
||||
# store
|
||||
store = file
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<listener-class>com.republicate.slf4j.impl.ServletContextLoggerListener</listener-class>
|
||||
</listener>
|
||||
<listener>
|
||||
<listener-class>org.jeudego.pairgoth.web.WebappManager</listener-class>
|
||||
<listener-class>org.jeudego.pairgoth.server.WebappManager</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- filters -->
|
||||
@@ -29,11 +29,11 @@
|
||||
<!-- servlets -->
|
||||
<servlet>
|
||||
<servlet-name>api</servlet-name>
|
||||
<servlet-class>org.jeudego.pairgoth.web.ApiServlet</servlet-class>
|
||||
<servlet-class>org.jeudego.pairgoth.server.ApiServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>sse</servlet-name>
|
||||
<servlet-class>org.jeudego.pairgoth.web.SSEServlet</servlet-class>
|
||||
<servlet-class>org.jeudego.pairgoth.server.SSEServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<async-supported>true</async-supported>
|
||||
</servlet>
|
||||
|
@@ -2,9 +2,9 @@ package org.jeudego.pairgoth.test
|
||||
|
||||
import com.republicate.kson.Json
|
||||
import org.jeudego.pairgoth.api.ApiHandler
|
||||
import org.jeudego.pairgoth.web.ApiServlet
|
||||
import org.jeudego.pairgoth.web.SSEServlet
|
||||
import org.jeudego.pairgoth.web.WebappManager
|
||||
import org.jeudego.pairgoth.server.ApiServlet
|
||||
import org.jeudego.pairgoth.server.SSEServlet
|
||||
import org.jeudego.pairgoth.server.WebappManager
|
||||
import org.mockito.kotlin.*
|
||||
import java.io.*
|
||||
import java.util.*
|
||||
|
@@ -6,5 +6,5 @@ CSSWATCH=$!
|
||||
|
||||
export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5006"
|
||||
#mvn --projects view-webapp -Dpairgoth.api.url=http://localhost:8085/api/ package jetty:run
|
||||
mvn --projects view-webapp package jetty:run
|
||||
mvn -o --projects view-webapp package jetty:run
|
||||
kill $CSSWATCH
|
||||
|
90
pom.xml
90
pom.xml
@@ -8,6 +8,52 @@
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>default-properties</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<api.env>dev</api.env>
|
||||
<api.url>http://localhost:8085</api.url>
|
||||
<webapp.env>dev</webapp.env>
|
||||
<webapp.url>http://localhost:8080</webapp.url>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>custom-properties</id>
|
||||
<activation>
|
||||
<file>
|
||||
<exists>../pairgoth.properties</exists>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>properties-maven-plugin</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>read-project-properties</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!--<quiet>true</quiet>-->
|
||||
<files>
|
||||
<file>../pairgoth.properties</file>
|
||||
</files>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<!-- CB: Temporary add my repository, while waiting for SSE Java server module author to incorporate my PR or for me to fork it -->
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -19,7 +65,8 @@
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository> <repository>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>republicate.com</id>
|
||||
<url>https://republicate.com/maven2</url>
|
||||
<releases>
|
||||
@@ -144,6 +191,47 @@
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>${maven.war.plugin.version}</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>regex-property</id>
|
||||
<goals>
|
||||
<goal>regex-property</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<name>webapp.port</name>
|
||||
<value>${webapp.url}</value>
|
||||
<regex>^.*:(\d+).*$</regex>
|
||||
<replacement>$1</replacement>
|
||||
<failIfNoMatch>true</failIfNoMatch>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>echo-property</id>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<echo>----------------- webapp.port=${webapp.port}</echo>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.mycila</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
|
@@ -101,15 +101,18 @@
|
||||
<httpConnector>
|
||||
<port>8080</port>
|
||||
</httpConnector>
|
||||
<!--
|
||||
<systemProperties>
|
||||
<pairgoth.api.url>http://localhost:8085/api/</pairgoth.api.url>
|
||||
<pairgoth.env>dev</pairgoth.env>
|
||||
<pairgoth.api.url>${webapp.url}</pairgoth.api.url>
|
||||
<pairgoth.env>${webapp.env}</pairgoth.env>
|
||||
</systemProperties>
|
||||
-->
|
||||
<webApp>
|
||||
<resourceBases>${project.basedir}/src/main/webapp,${project.build.directory}/generated-resources/</resourceBases>
|
||||
</webApp>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
@@ -125,6 +128,10 @@
|
||||
</webResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>properties-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencyManagement>
|
||||
|
@@ -132,7 +132,7 @@ class Translator private constructor(private val iso: String) {
|
||||
get() = textAccessor[this] as String
|
||||
set(value: String) { textAccessor[this] = value }
|
||||
|
||||
private val saveMissingTranslations = System.getProperty("pairgoth.env") == "dev"
|
||||
private val saveMissingTranslations = System.getProperty("pairgoth.webapp.env") == "dev"
|
||||
private val missingTranslations: MutableSet<String> = ConcurrentSkipListSet()
|
||||
|
||||
private fun reportMissingTranslation(enText: String) {
|
||||
|
@@ -53,7 +53,6 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
override fun contextInitialized(sce: ServletContextEvent) {
|
||||
context = sce.servletContext
|
||||
logger.info("---------- Starting $WEBAPP_NAME ----------")
|
||||
context.setAttribute("manager", this)
|
||||
webappRoot = context.getRealPath("/")
|
||||
try {
|
||||
// load default properties
|
||||
@@ -64,7 +63,11 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
properties[(key as String).removePrefix(PAIRGOTH_PROPERTIES_PREFIX)] = value
|
||||
}
|
||||
|
||||
logger.info("Using profile {}", properties.getProperty("webapp.env"))
|
||||
val env = properties.getProperty("webapp.env")
|
||||
logger.info("Using profile {}", )
|
||||
|
||||
// let the view be aware of the environment
|
||||
context.setAttribute("webapp.env", env)
|
||||
|
||||
// set system user agent string to empty string
|
||||
System.setProperty("http.agent", "")
|
||||
|
@@ -11,6 +11,7 @@
|
||||
<script type="text/javascript" src="/js/domhelper.js"></script>
|
||||
</head>
|
||||
<body class="vert flex">
|
||||
#foreach($attr in $application.getAttributeNames())$attr #end
|
||||
<div id="header" class="horz flex">
|
||||
<div id="logo">
|
||||
<img src="/img/logov2.svg"/>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# webapp
|
||||
env = dev
|
||||
webapp.env = dev
|
||||
webapp.url = https://localhost:8080
|
||||
api.url = https://localhost:8085/api
|
||||
|
||||
|
Reference in New Issue
Block a user