You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2021/03/14 12:36:41 UTC
[openmeetings] branch master updated: [OPENMEETINGS-2594] web
session warm-up should be improved
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push:
new e3e6533 [OPENMEETINGS-2594] web session warm-up should be improved
e3e6533 is described below
commit e3e6533c6e0e9f6ee50169498031c9ca74f2a32b
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Sun Mar 14 19:36:26 2021 +0700
[OPENMEETINGS-2594] web session warm-up should be improved
---
.../src/main/front/main/src/omutils.js | 5 ++-
.../apache/openmeetings/web/app/Application.java | 2 ++
.../web/common/PingResourceReference.java | 41 ++++++++++++++++++++++
3 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/openmeetings-web/src/main/front/main/src/omutils.js b/openmeetings-web/src/main/front/main/src/omutils.js
index 6e19753..3ce0679 100644
--- a/openmeetings-web/src/main/front/main/src/omutils.js
+++ b/openmeetings-web/src/main/front/main/src/omutils.js
@@ -123,7 +123,10 @@ module.exports = {
($('body')[0]).style.setProperty(key, val);
}
, ping: function() {
- setTimeout(() => _sendMessage({type: 'ping'}), 30000);
+ setTimeout(() => {
+ _sendMessage({type: 'ping'});
+ fetch('./ping');
+ }, 30000);
}
, notify: _notify
, requestNotifyPermission: _requestNotifyPermission
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
index ed6a421..440db0f 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
@@ -68,6 +68,7 @@ import org.apache.openmeetings.db.util.ws.TextRoomMessage;
import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.util.Version;
import org.apache.openmeetings.util.ws.IClusterWsMessage;
+import org.apache.openmeetings.web.common.PingResourceReference;
import org.apache.openmeetings.web.pages.AccessDeniedPage;
import org.apache.openmeetings.web.pages.ActivatePage;
import org.apache.openmeetings.web.pages.HashPage;
@@ -329,6 +330,7 @@ public class Application extends AuthenticatedWebApplication implements IApplica
mountResource("/profile/${id}", new ProfileImageResourceReference());
mountResource("/group/${id}", new GroupLogoResourceReference());
mountResource("/group/customcss/${id}", new GroupCustomCssResourceReference());
+ mountResource("/ping", new PingResourceReference());
log.debug("Application::init");
try {
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/PingResourceReference.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/PingResourceReference.java
new file mode 100644
index 0000000..4a59fc5
--- /dev/null
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/PingResourceReference.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.common;
+
+import org.apache.wicket.request.resource.CharSequenceResource;
+import org.apache.wicket.request.resource.IResource;
+import org.apache.wicket.request.resource.ResourceReference;
+
+public class PingResourceReference extends ResourceReference {
+ private static final long serialVersionUID = 1L;
+ private static final String DEFAULT_NAME = "ping-res";
+
+ public PingResourceReference() {
+ super(DEFAULT_NAME);
+ }
+
+ public PingResourceReference(String name) {
+ super(name);
+ }
+
+ @Override
+ public IResource getResource() {
+ return new CharSequenceResource("text/plain", "ping");
+ }
+}