-
-
Notifications
You must be signed in to change notification settings - Fork 46
Make REST context path configurable via openidm.context.path system property
#142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vharseko
merged 15 commits into
master
from
copilot/make-rest-context-path-configurable
Apr 14, 2026
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0a882f0
Initial plan
Copilot f935409
Make /openidm REST context path configurable via openidm.context.path…
Copilot 81b026f
Add openidm.context.path documentation to integrators guide
Copilot 5e4f102
Update copyright year to 2024-2026 in modified docs files
Copilot 9d963ed
Add/update Portions copyright 2026 3A Systems LLC in all PR-changed f…
Copilot fdd7eeb
Address PR review feedback: centralize constants, fix --url precedenc…
Copilot c383648
Merge remote-tracking branch 'origin/master' into copilot/make-rest-c…
Copilot c545b24
Merge remote-tracking branch 'origin/master' into copilot/make-rest-c…
Copilot 341483c
Merge remote-tracking branch 'origin/master' into copilot/make-rest-c…
Copilot c06ea06
Add CI test for configurable REST context path (/myidm) (#152)
Copilot ee9dc32
Make UI REST context path dynamic via server-injected window.__openid…
Copilot 8ff1486
Add missing 3A Systems LLC copyright to ServerConstants.java, index.h…
Copilot dd454b8
Address review feedback: centralize normalizeContextPath, fix Resourc…
Copilot e2e87ac
Remove unnecessary / escaping in ResourceServlet, clarify doc sentence
Copilot 5f5835a
Add apt retry config to Dockerfile to handle transient mirror sync fa…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...pi-servlet/src/test/java/org/forgerock/openidm/servlet/internal/ServletComponentTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * The contents of this file are subject to the terms of the Common Development and | ||
| * Distribution License (the License). You may not use this file except in compliance with the | ||
| * License. | ||
| * | ||
| * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
| * specific language governing permission and limitations under the License. | ||
| * | ||
| * When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
| * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
| * Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
| * information: "Portions copyright [year] [name of copyright owner]". | ||
| * | ||
| * Copyright 2025-2026 3A Systems LLC. | ||
| */ | ||
|
|
||
| package org.forgerock.openidm.servlet.internal; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import org.testng.annotations.AfterMethod; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| /** | ||
| * Unit tests for {@link ServletComponent} context path configuration. | ||
| */ | ||
| public class ServletComponentTest { | ||
|
|
||
| @AfterMethod | ||
| public void clearSystemProperty() { | ||
| System.clearProperty(ServletComponent.OPENIDM_CONTEXT_PATH_PROPERTY); | ||
| } | ||
|
|
||
| @Test | ||
| public void testDefaultServletAlias() { | ||
| // When no system property is set, should return the default /openidm | ||
| System.clearProperty(ServletComponent.OPENIDM_CONTEXT_PATH_PROPERTY); | ||
| assertThat(ServletComponent.getServletAlias()).isEqualTo("/openidm"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testCustomServletAlias() { | ||
| // When system property is set to /myidm, should return /myidm | ||
| System.setProperty(ServletComponent.OPENIDM_CONTEXT_PATH_PROPERTY, "/myidm"); | ||
| assertThat(ServletComponent.getServletAlias()).isEqualTo("/myidm"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testServletAliasWithoutLeadingSlash() { | ||
| // Should add leading slash if missing | ||
| System.setProperty(ServletComponent.OPENIDM_CONTEXT_PATH_PROPERTY, "myidm"); | ||
| assertThat(ServletComponent.getServletAlias()).isEqualTo("/myidm"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testServletAliasWithTrailingSlash() { | ||
| // Should remove trailing slash | ||
| System.setProperty(ServletComponent.OPENIDM_CONTEXT_PATH_PROPERTY, "/myidm/"); | ||
| assertThat(ServletComponent.getServletAlias()).isEqualTo("/myidm"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testServletAliasConstants() { | ||
| assertThat(ServletComponent.OPENIDM_CONTEXT_PATH_PROPERTY).isEqualTo("openidm.context.path"); | ||
| assertThat(ServletComponent.OPENIDM_CONTEXT_PATH_DEFAULT).isEqualTo("/openidm"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context-path normalization logic (leading
/+ trimming trailing/) is duplicated across multiple components in this PR (e.g., servlet component, servlet registrator, CLI default URL, UI index injection). To reduce drift and edge-case inconsistencies (like the trailing-slash UI issue), consider centralizing normalization in a single helper (e.g., aServerConstants#getNormalizedContextPath()utility) and reusing it everywhere.