Skip to content

Commit

Permalink
FISH-10055 Extract to method
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinchan committed Mar 4, 2025
1 parent 62568f3 commit 5348897
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2018-2021] [Payara Foundation and/or its affiliates]
// Portions Copyright [2018-2025] [Payara Foundation and/or its affiliates]

package com.sun.enterprise.web;

Expand Down Expand Up @@ -140,8 +140,8 @@ public <V> V loadMetaData(Class<V> type, DeploymentContext dc) {
if (this.env.getRuntimeType().isMicro()) {
String globalContextRoot = getProperty("payaramicro.globalContextRoot");
if (globalContextRoot != null && !globalContextRoot.isBlank()) {
globalContextRoot = globalContextRoot.replaceAll("^/|/$", "");
contextRoot = contextRoot.replaceAll("^/|/$", "");
globalContextRoot = removeSlashes(globalContextRoot);
contextRoot = removeSlashes(contextRoot);

contextRoot = "/" + globalContextRoot + "/" + contextRoot;
}
Expand Down Expand Up @@ -259,4 +259,8 @@ private String getProperty(String value) {
return result;
}

private String removeSlashes(String value) {
return value.replaceAll("^/|/$", "");
}

}

0 comments on commit 5348897

Please sign in to comment.