You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by me...@apache.org on 2016/12/28 19:01:39 UTC

[10/14] jspwiki git commit: JSPWIKI-1035 - first updates from Jurgen

JSPWIKI-1035 - first updates from Jurgen


Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/6d853006
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/6d853006
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/6d853006

Branch: refs/heads/develop
Commit: 6d85300638a43fc077d5e25bef73f927f79301cf
Parents: 1ebca68
Author: Harry Metske <ha...@gmail.com>
Authored: Thu Dec 15 19:10:32 2016 +0100
Committer: Harry Metske <ha...@gmail.com>
Committed: Thu Dec 15 19:10:32 2016 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/wiki/WikiEngine.java | 13 ++++---------
 .../apache/wiki/url/DefaultURLConstructor.java    | 18 +-----------------
 .../src/main/resources/ini/jspwiki.properties     | 13 -------------
 3 files changed, 5 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jspwiki/blob/6d853006/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java b/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
index 39b4417..afb34f5 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
@@ -198,9 +198,6 @@ public class WikiEngine
     /** If true, uses UTF8 encoding for all data */
     private boolean          m_useUTF8      = true;
 
-    /** Stores the base URL. */
-    private String           m_baseURL;
-
     /** Store the file path to the basic URL.  When we're not running as
         a servlet, it defaults to the user's current directory. */
     private String           m_rootPath = System.getProperty("user.dir");
@@ -533,11 +530,6 @@ public class WikiEngine
                                                         m_saveUserInfo );
 
         m_useUTF8        = "UTF-8".equals( TextUtil.getStringProperty( props, PROP_ENCODING, "ISO-8859-1" ) );
-        m_baseURL = TextUtil.getStringProperty(props, PROP_BASEURL, "");
-        if (!m_baseURL.endsWith("/"))
-        {
-            m_baseURL = m_baseURL + "/";
-        }
 
         m_beautifyTitle  = TextUtil.getBooleanProperty( props,
                                                         PROP_BEAUTIFYTITLE,
@@ -795,9 +787,12 @@ public class WikiEngine
 
     public String getBaseURL()
     {
-        return m_baseURL;
+    	String contextPath = m_servletContext.getContextPath();
+    	
+        return contextPath;
     }
 
+
     /**
      *  Returns the moment when this engine was started.
      *

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/6d853006/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java b/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
index 458bfca..8d8779c 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
@@ -60,23 +60,7 @@ public class DefaultURLConstructor
     {
         m_engine = engine;
 
-        String baseurl = engine.getBaseURL();
-
-        if( baseurl != null && baseurl.length() > 0 )
-        {
-            try
-            {
-                URL url = new URL( baseurl );
-        
-                String path = url.getPath();
-        
-                m_pathPrefix = path;
-            }
-            catch( MalformedURLException e )
-            {
-                m_pathPrefix = "/JSPWiki/"; // Just a guess.
-            }
-        }
+        m_pathPrefix = engine.getBaseURL() + "/";
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/6d853006/jspwiki-war/src/main/resources/ini/jspwiki.properties
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/resources/ini/jspwiki.properties b/jspwiki-war/src/main/resources/ini/jspwiki.properties
index c00c7f7..589cc8b 100644
--- a/jspwiki-war/src/main/resources/ini/jspwiki.properties
+++ b/jspwiki-war/src/main/resources/ini/jspwiki.properties
@@ -36,19 +36,6 @@
 jspwiki.applicationName = JSPWiki
 
 #
-#  Describe where your wiki lives (the real URL through which it is available
-#  through the internet/intranet).  This is a mandatory attribute.
-#
-#  Be careful if you use a localhost address (http://localhost/ or http://127.0.0.1/),
-#  as this will cause some unwanted side effects if your wiki is accessed from
-#  any other computer than where the wiki is running.
-#
-#  Example:
-#  jspwiki.baseURL = http://jspwiki.apache.org/
-#
-jspwiki.baseURL=http://localhost:8080/JSPWiki/
-
-#
 #  Which page provider class to use.  Possibilities are:
 #
 #    FileSystemProvider     - for simple pure file storage with no version information