You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2020/01/28 20:34:02 UTC

[jspwiki] 01/32: fix WikiEngine#getViewURL so that absolute parameter from makeUrl(..) is correctly calculated against the resolved variable instead to its associated key

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 4a639d78e194844258ea2a372840b0788c15e529
Author: juanpablo <ju...@apache.org>
AuthorDate: Sat Jan 18 00:19:58 2020 +0100

    fix WikiEngine#getViewURL so that absolute parameter from makeUrl(..) is correctly calculated against the resolved variable instead to its associated key
---
 jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
index 2189371..83f4cdc 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
@@ -729,8 +729,9 @@ public class WikiEngine  {
         if( pageName == null ) {
             pageName = getFrontPage();
         }
-        //FIXME: final boolean absolute = getVariableManager().getVariable( this, WikiEngine.PROP_REFSTYLE );
-        return getURLConstructor().makeURL( WikiContext.VIEW, pageName, "absolute".equals( PROP_REFSTYLE ), null );
+        final WikiContext wc = new WikiContext( this, new WikiPage( this, pageName ) );
+        final boolean absolute = Boolean.parseBoolean( getVariableManager().getVariable( wc, WikiEngine.PROP_REFSTYLE ) );
+        return getURLConstructor().makeURL( WikiContext.VIEW, pageName, absolute, null );
     }
 
     /**
@@ -755,8 +756,7 @@ public class WikiEngine  {
      *  @return The front page name.
      */
 
-    public String getFrontPage()
-    {
+    public String getFrontPage() {
         return m_frontPage;
     }
 
@@ -769,8 +769,7 @@ public class WikiEngine  {
      *  @return ServletContext of the WikiEngine, or null.
      */
 
-    public ServletContext getServletContext()
-    {
+    public ServletContext getServletContext() {
         return m_servletContext;
     }
 
@@ -808,7 +807,7 @@ public class WikiEngine  {
      */
     public Collection< String > getAllInlinedImagePatterns() {
         final ArrayList< String > ptrnlist = new ArrayList<>();
-        for( Enumeration< ? > e = m_properties.propertyNames(); e.hasMoreElements(); ) {
+        for( final Enumeration< ? > e = m_properties.propertyNames(); e.hasMoreElements(); ) {
             final String name = ( String )e.nextElement();
             if( name.startsWith( PROP_INLINEIMAGEPTRN ) ) {
                 ptrnlist.add( TextUtil.getStringProperty( m_properties, name, null ) );