You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/01/28 20:37:00 UTC

[jira] [Commented] (JSPWIKI-1127) Get rid off jspwiki.referenceStyle

    [ https://issues.apache.org/jira/browse/JSPWIKI-1127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17025428#comment-17025428 ] 

ASF subversion and git services commented on JSPWIKI-1127:
----------------------------------------------------------

Commit 1e5576e810c5c45aecbee5dccfe8b2d220988a8b in jspwiki's branch refs/heads/master from juanpablo
[ https://gitbox.apache.org/repos/asf?p=jspwiki.git;h=1e5576e ]

JSPWIKI-1127: remove jspwiki.referenceStyle example reference


> Get rid off jspwiki.referenceStyle
> ----------------------------------
>
>                 Key: JSPWIKI-1127
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-1127
>             Project: JSPWiki
>          Issue Type: Task
>            Reporter: Juan Pablo Santos Rodríguez
>            Priority: Major
>             Fix For: 2.11.0-M7
>
>
> Given the following unit test:
> {code:java}
>     @ParameterizedTest
>     @ValueSource( strings = { "DefaultURLConstructor", "ShortURLConstructor", "ShortViewURLConstructor" })
>     public void testGetViewURL( final String urlc ) {
>         final Properties props = TestEngine.getTestProperties();
>         props.setProperty( "jspwiki.urlConstructor", urlc );
>         final TestEngine engine = TestEngine.build( props );
>         final WikiContext ctx = new WikiContext( engine, engine.getPageManager().getPage(NAME1 ) );
>         ctx.setVariable( "jspwiki.referenceStyle", "relative" );
>         Assertions.assertEquals( engine.getViewURL( NAME1 ), ctx.getViewURL( NAME1 ) );
>         ctx.setVariable( "jspwiki.referenceStyle", "absolute" );
>         Assertions.assertEquals( engine.getViewURL( NAME1 ), ctx.getViewURL( NAME1 ) );
>     }
> {code}
>  * {{ctx.getViewURL(..)}} ultimately gets down to {{WikiEngine#getUrl(..)}}, using {{jspwiki.referenceStyle}} from jspwiki.properties to determine if it should generate "absolute" or "relative" urls
>  * {{engine.getViewURL(..)}} also ends up going to {{WikiEngine#getUrl(..)}}, but always generating "absolute" urls.
> Given these preconditions, the test above should not pass. But it does, most probably as a consequence of JSPWIKI-1035 (get rid of {{jspwiki.baseURL}}): {{getUrl(..)}} relied on {{jspwiki.baseURL}} to generate the "absolute" flavour of the url, whereas now it is using {{servletContext.getContextPath()}}.
> As there isn't a way to generate absolute urls (no baseURL property anymore), my proposal is to drop the {{jspwiki.referenceStyle}} property altogether, which will allow 
>  1) to simplify the URL constructors
>  2) to also drop {{WikiEngine#getViewURL(..)}}, as its behaviour is exactly the same as the same method on {{WikiContext}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)