Uploaded image for project: 'JSPWiki'
  1. JSPWiki
  2. JSPWIKI-1127

Get rid off jspwiki.referenceStyle

Bulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.11.0-M7
    • None
    • None

    Description

      Given the following unit test:

          @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 ) );
          }
      
      • 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

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            juanpablo Juan Pablo Santos Rodríguez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment