From c26f2354473de52329d0c1b5b40c97fc7d70122e Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 8 Jun 2023 08:45:21 +0200 Subject: [PATCH 1/5] adapt keep alive timeout --- src/main/resources/config/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/config/application.properties b/src/main/resources/config/application.properties index 57b27078..bb56358d 100644 --- a/src/main/resources/config/application.properties +++ b/src/main/resources/config/application.properties @@ -19,7 +19,7 @@ server.tomcat.socket.soKeepAlive=true server.tomcat.socket.performanceConnectionTime=1 server.tomcat.socket.performanceLatency=2 server.tomcat.socket.performanceBandwidth=0 -server.tomcat.keepAliveTimeout(20000); +server.tomcat.keepAliveTimeout(3000); server.tomcat.maxKeepAliveRequests(3000); server.tomcat.uri-encoding=UTF-8 From 87e24b3840c75b5787ddbf0233dc292ee29227d2 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 8 Jun 2023 15:17:54 +0200 Subject: [PATCH 2/5] SEBSERV-444 fixed hopefully last time --- .../gui/content/monitoring/MonitoringRunningExam.java | 2 +- .../service/i18n/impl/PolyglotPageServiceImpl.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java index ea3664ac..c33c5e50 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java @@ -154,7 +154,7 @@ public class MonitoringRunningExam implements TemplateComposer { pageContext.getParent(), new LocTextKey( "sebserver.monitoring.exam", - StringEscapeUtils.escapeHtml4(exam.name))); + StringEscapeUtils.escapeXml11(exam.name))); final Composite tablePane = new Composite(content, SWT.NONE); tablePane.setLayout(new GridLayout()); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java index 1ddf4989..bc1beaf2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java @@ -270,7 +270,16 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService { return label -> { if (locTextKey != null) { - label.setText(i18nSupport.getText(locTextKey)); + try { + label.setText(i18nSupport.getText(locTextKey)); + } catch (final Exception e) { + label.setData(RWT.MARKUP_ENABLED, false); + try { + label.setText(i18nSupport.getText(locTextKey)); + } catch (final Exception ee) { + label.setText(locTextKey.name); + } + } } if (i18nSupport.hasText(locToolTipKey)) { label.setToolTipText(Utils.formatLineBreaks(i18nSupport.getText(locToolTipKey))); From aa0e3b3a4795234acbfa5262f7f9a2647b9e23fd Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 14 Jun 2023 15:28:22 +0200 Subject: [PATCH 3/5] SEBSERV-451 fixed --- .../session/impl/ExamSessionServiceImpl.java | 15 +++++++++------ src/main/resources/messages.properties | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index 754ce2e7..8329674b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -643,12 +643,15 @@ public class ExamSessionServiceImpl implements ExamSessionService { final ClientConnectionDataInternal cc = this.examSessionCacheService.getClientConnection(token); if (cc.clientConnection.status.duplicateCheckStatus) { - final Long id = this.duplicateCheck.put( - cc.clientConnection.userSessionId, - cc.getConnectionId()); - if (id != null) { - duplicates.add(id); - duplicates.add(cc.getConnectionId()); + System.out.println("****** id: " + cc.clientConnection.userSessionId); + if (cc.clientConnection.userSessionId != null) { + final Long id = this.duplicateCheck.put( + cc.clientConnection.userSessionId, + cc.getConnectionId()); + if (id != null) { + duplicates.add(id); + duplicates.add(cc.getConnectionId()); + } } } return cc; diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index fd17a0ea..9b44dd57 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -674,14 +674,14 @@ sebserver.exam.configuration.form.title.new=Add exam configuration mapping sebserver.exam.configuration.form.title=Exam Configuration Mapping sebserver.exam.configuration.form.name=Exam Configuration sebserver.exam.configuration.form.name.tooltip=Please select an exam configuration to attach to the exam -sebserver.exam.configuration.form.encryptSecret=Encryption Password -sebserver.exam.configuration.form.encryptSecret.tooltip=Define an encryption password if the exam configuration should be encrypted by password +sebserver.exam.configuration.form.encryptSecret=Settings Password +sebserver.exam.configuration.form.encryptSecret.tooltip=Define an encryption password if the exam configuration settings should be encrypted by password sebserver.exam.configuration.form.description=Description sebserver.exam.configuration.form.description.tooltip=The description of the selected exam configuration sebserver.exam.configuration.form.status=Status sebserver.exam.configuration.form.status.tooltip=The current status of the selected exam configuration sebserver.exam.configuration.form.encryptSecret.confirm=Confirm Password -sebserver.exam.configuration.form.encryptSecret.confirm.tooltip=Please confirm the encryption password if there is one +sebserver.exam.configuration.form.encryptSecret.confirm.tooltip=Please confirm the settings password if there is one sebserver.exam.indicator.list.actions=  sebserver.exam.indicator.list.title=Indicators From 7dd72f27c92f144711d2834512ff836ae9eba300 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 14 Jun 2023 15:30:42 +0200 Subject: [PATCH 4/5] SEBSERV-451 code cleanup --- .../servicelayer/session/impl/ExamSessionServiceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index 8329674b..77baf353 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -643,7 +643,6 @@ public class ExamSessionServiceImpl implements ExamSessionService { final ClientConnectionDataInternal cc = this.examSessionCacheService.getClientConnection(token); if (cc.clientConnection.status.duplicateCheckStatus) { - System.out.println("****** id: " + cc.clientConnection.userSessionId); if (cc.clientConnection.userSessionId != null) { final Long id = this.duplicateCheck.put( cc.clientConnection.userSessionId, From 6281634a46cd85ee55d6076b52cfdc99da62a61f Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 15 Jun 2023 11:09:33 +0200 Subject: [PATCH 5/5] some fixed in GUI from 1.5.1 --- .../gui/content/exam/ExamDeletePopup.java | 3 +- .../sebserver/gui/content/exam/ExamForm.java | 3 +- .../gui/content/exam/ExamTemplateForm.java | 4 +- .../gui/content/exam/QuizLookupList.java | 48 ++++++++++--------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java index 5ec0af5d..c039a91d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java @@ -16,6 +16,7 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; +import org.apache.commons.text.StringEscapeUtils; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; @@ -161,7 +162,7 @@ public class ExamDeletePopup { new ActionEvent(action), action.pageContext()); - final String examName = examToDelete.toName().name; + final String examName = StringEscapeUtils.escapeXml11(examToDelete.toName().name); final List dependencies = report.results.stream() .filter(key -> !key.equals(entityKey)) .collect(Collectors.toList()); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java index cda5b7c5..81fc88cf 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java @@ -242,7 +242,8 @@ public class ExamForm implements TemplateComposer { .getOr(false); final boolean sebRestrictionMismatch = readonly && sebRestrictionAvailable && - isRestricted != exam.sebRestriction; + isRestricted != exam.sebRestriction && + exam.status == ExamStatus.RUNNING; // check exam consistency and inform the user if needed Collection warnings = null; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java index 23972795..67579f65 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java @@ -386,7 +386,7 @@ public class ExamTemplateForm implements TemplateComposer { .newAction(ActionDefinition.CLIENT_GROUP_TEMPLATE_MODIFY_FROM_LIST) .withParentEntityKey(entityKey) .withSelect( - indicatorTable::getMultiSelection, + clientGroupTable::getMultiSelection, PageAction::applySingleSelectionAsEntityKey, CLIENT_GROUP_EMPTY_SELECTION_TEXT_KEY) .publishIf(() -> userGrantCheck.m() && clientGroupTable.hasAnyContent(), false) @@ -394,7 +394,7 @@ public class ExamTemplateForm implements TemplateComposer { .newAction(ActionDefinition.CLIENT_GROUP_TEMPLATE_DELETE_FROM_LIST) .withEntityKey(entityKey) .withSelect( - indicatorTable::getMultiSelection, + clientGroupTable::getMultiSelection, this::deleteSelectedClientGroup, CLIENT_GROUP_EMPTY_SELECTION_TEXT_KEY) .publishIf(() -> userGrantCheck.m() && clientGroupTable.hasAnyContent(), false) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java index c95b2c99..4ba77093 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java @@ -59,6 +59,7 @@ import ch.ethz.seb.sebserver.gui.table.ColumnDefinition.TableFilterAttribute; import ch.ethz.seb.sebserver.gui.table.EntityTable; import ch.ethz.seb.sebserver.gui.table.TableFilter.CriteriaType; import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; +import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.ImageIcon; @Lazy @Component @@ -109,6 +110,8 @@ public class QuizLookupList implements TemplateComposer { new LocTextKey("sebserver.quizdiscovery.quiz.import.existing"); private final static LocTextKey TEXT_FETCH_NOTE = new LocTextKey("sebserver.quizdiscovery.list.fetchnote"); + private final static LocTextKey TEXT_FETCH_NOTE_TOOLTIP = + new LocTextKey("sebserver.quizdiscovery.list.fetchnote.tooltip"); private final static String TEXT_KEY_ADDITIONAL_ATTR_PREFIX = "sebserver.quizdiscovery.quiz.details.additional."; @@ -448,7 +451,7 @@ public class QuizLookupList implements TemplateComposer { } } - private boolean showingFetchNote = false; + private Composite warningPanel = null; private void handelPageReload( final Composite notePanel, @@ -456,29 +459,28 @@ public class QuizLookupList implements TemplateComposer { if (table.isComplete()) { PageService.clearComposite(notePanel); - this.showingFetchNote = false; - } else { - if (!this.showingFetchNote) { - final Composite warningPanel = this.widgetFactory.createWarningPanel(notePanel, 15, true); - GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, true); - gridData.heightHint = 28; - gridData.widthHint = 25; - gridData.verticalIndent = 5; - final Label action = new Label(warningPanel, SWT.NONE); - action.setImage(WidgetFactory.ImageIcon.SWITCH.getImage(notePanel.getDisplay())); - action.setLayoutData(gridData); - action.addListener(SWT.MouseDown, event -> { - table.applyFilter(); - }); - - final Label text = new Label(warningPanel, SWT.NONE); - text.setData(RWT.MARKUP_ENABLED, Boolean.TRUE); - text.setText(this.pageService.getI18nSupport().getText(TEXT_FETCH_NOTE)); - gridData = new GridData(SWT.LEFT, SWT.FILL, true, true); - gridData.heightHint = 16; - text.setLayoutData(gridData); - this.showingFetchNote = true; + if (this.warningPanel != null) { + this.warningPanel.dispose(); } + this.warningPanel = null; + } else { + if (this.warningPanel != null && !this.warningPanel.isDisposed()) { + this.warningPanel.dispose(); + } + + this.warningPanel = this.widgetFactory.createWarningPanel(notePanel, 15, true); + this.widgetFactory.imageButton( + ImageIcon.SWITCH, + this.warningPanel, + TEXT_FETCH_NOTE_TOOLTIP, + event -> table.applyFilter()); + + final Label text = new Label(this.warningPanel, SWT.NONE); + text.setData(RWT.MARKUP_ENABLED, Boolean.TRUE); + text.setText(this.pageService.getI18nSupport().getText(TEXT_FETCH_NOTE)); + final GridData gridData = new GridData(SWT.LEFT, SWT.FILL, true, true); + gridData.heightHint = 28; + text.setLayoutData(gridData); } notePanel.getParent().layout(true, true); }