You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2017/11/14 17:40:31 UTC

[GitHub] gonzalad closed pull request #24: Add relativePath to Spring RP Plugin

gonzalad closed pull request #24: Add relativePath to Spring RP Plugin
URL: https://github.com/apache/cxf-fediz/pull/24
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
index 736d8475..45ded7b7 100644
--- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
+++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
@@ -38,6 +38,7 @@
 
     private Resource configFile;
     private String contextName;
+    private String relativePath;
 
     private ServletContext servletContext;
     private FedizConfigurator configurator = new FedizConfigurator();
@@ -81,9 +82,28 @@ public FedizContext getFedizContext(String context) {
             LOG.error("Federation context '" + context + "' not found.");
             throw new IllegalStateException("Federation context '" + context + "' not found.");
         }
+        initializeRelativePath(ctx);
         return ctx;
     }
 
+    private void initializeRelativePath(FedizContext ctx) {
+        if (relativePath != null && relativePath.length() > 0) {
+            ctx.setRelativePath(relativePath);
+        }
+        if (ctx.getRelativePath() == null) {
+            String catalinaBase = System.getProperty("catalina.base");
+            if (catalinaBase != null && catalinaBase.length() > 0) {
+                ctx.setRelativePath(catalinaBase);
+            }
+        }
+        if (ctx.getRelativePath() == null) {
+            String jettyHome = System.getProperty("jetty.home");
+            if (jettyHome != null && jettyHome.length() > 0) {
+                ctx.setRelativePath(jettyHome);
+            }
+        }
+    }
+
     @Override
     public FedizContext getFedizContext() {
         if (servletContext != null) {
@@ -101,4 +121,7 @@ public void setServletContext(ServletContext servletContext) {
         this.servletContext = servletContext;
     }
 
+    public void setRelativePath(String relativePath) {
+        this.relativePath = relativePath;
+    }
 }
diff --git a/plugins/spring3/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java b/plugins/spring3/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
index 736d8475..45ded7b7 100644
--- a/plugins/spring3/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
+++ b/plugins/spring3/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
@@ -38,6 +38,7 @@
 
     private Resource configFile;
     private String contextName;
+    private String relativePath;
 
     private ServletContext servletContext;
     private FedizConfigurator configurator = new FedizConfigurator();
@@ -81,9 +82,28 @@ public FedizContext getFedizContext(String context) {
             LOG.error("Federation context '" + context + "' not found.");
             throw new IllegalStateException("Federation context '" + context + "' not found.");
         }
+        initializeRelativePath(ctx);
         return ctx;
     }
 
+    private void initializeRelativePath(FedizContext ctx) {
+        if (relativePath != null && relativePath.length() > 0) {
+            ctx.setRelativePath(relativePath);
+        }
+        if (ctx.getRelativePath() == null) {
+            String catalinaBase = System.getProperty("catalina.base");
+            if (catalinaBase != null && catalinaBase.length() > 0) {
+                ctx.setRelativePath(catalinaBase);
+            }
+        }
+        if (ctx.getRelativePath() == null) {
+            String jettyHome = System.getProperty("jetty.home");
+            if (jettyHome != null && jettyHome.length() > 0) {
+                ctx.setRelativePath(jettyHome);
+            }
+        }
+    }
+
     @Override
     public FedizContext getFedizContext() {
         if (servletContext != null) {
@@ -101,4 +121,7 @@ public void setServletContext(ServletContext servletContext) {
         this.servletContext = servletContext;
     }
 
+    public void setRelativePath(String relativePath) {
+        this.relativePath = relativePath;
+    }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services