This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-a7a3cece-f55a-496e-8d57-1da2410bac97 XWIKI-25636 Open

The url.standard.hideViewAction property has no effect and url.standard.entityPathPrefix does not replace xwiki.defaultservletpath

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-825066fb-e339-4e1e-b7d9-3c3469b3df60 Eleni created this issue on 02/Nov/26 16:08
 
Summary: The url.standard.hideViewAction property has no effect and url.standard.entityPathPrefix does not replace xwiki.defaultservletpath
Issue Type: cid:jira-generated-image-avatar-a7a3cece-f55a-496e-8d57-1da2410bac97 Bug
Affects Versions: 18.9.0
Assignee: Unassigned
Components: URLs
Created: 02/Nov/26 16:08
Priority: cid:jira-generated-image-static-major-148c74d7-bee6-44a1-9d55-1c513bad2c11 Major
Reporter: Eleni
Description:

xwiki.properties advertises two URL properties as replacements for older xwiki.cfg ones:

  • url.standard.hideViewAction — "Note that this replaces the old xwiki.showviewaction property in the xwiki.cfg file." (xwiki.properties.vm:1034-1039, since 7.2M1)
  • url.standard.entityPathPrefix — "Note that this replaces the old xwiki.defaultservletpath property in the xwiki.cfg file." (xwiki.properties.vm:1017-1024, since 5.2M1)

Neither statement is true of the running product.

1. url.standard.hideViewAction is read by nothing

StandardURLConfiguration.isViewActionHidden() has no caller in main code. The only occurrences in the whole platform are the interface, DefaultStandardURLConfiguration,
LegacyStandardURLConfiguration and two comments in AbstractEntityResourceReferenceResolver. A scan of every jar in a shipped WEB-INF/lib (18.9.0) finds the symbol only in
xwiki-platform-url-scheme-standard and xwiki-platform-legacy-url, i.e. the declaring classes.

Its last caller was removed by 52dfa89f801 (XWIKI-12842, "Improve URL backward-compatibility after introduction of Nested Spaces", 2015-11-20, 7.4), which replaced the conditional
parsing with the unconditional one that is there today. The property has had no effect since.

What actually decides whether view appears in a generated URL is XWikiServletURLFactory.addAction() calling XWiki.showViewAction() (XWiki.java:7184-7194), which reads
the XWikiPreferences field showviewaction and then xwiki.cfg's xwiki.showviewaction (default 1).

2. url.standard.entityPathPrefix only affects parsing

getEntityPathPrefix() has exactly one consumer in main code, StandardStringResourceTypeResolver:60, which decides whether an incoming path segment introduces an entity path.
Generated URLs come from XWiki.getServletPath() (XWiki.java:5688-5699): xwiki.servletpath, falling back to xwiki.defaultservletpath when the request path does not
start with /bin. So the property changes which URLs XWiki accepts, never the ones it emits — it does not replace xwiki.defaultservletpath.

Steps to reproduce

On a 18.9.0 standalone distribution, counting the links the home page generates:

  curl -s http://localhost:8080/xwiki/bin/view/Main/WebHome | grep -o '/xwiki/bin/view/' | wc -l
  
  • stock configuration: 37
  • url.standard.hideViewAction=true in xwiki.properties + restart: 37 (no change)
  • xwiki.showviewaction=0 in xwiki.cfg + restart: 0 — links become /xwiki/bin/Sandbox/, while edit links correctly keep their action

 

 
 

1 update

 
cid:jira-generated-image-avatar-825066fb-e339-4e1e-b7d9-3c3469b3df60 Changes by Eleni on 02/Nov/26 16:09
 
Description: {{xwiki.properties}} advertises two URL properties as replacements for older {{xwiki.cfg}} ones:
* {{url.standard.hideViewAction}} — "Note that this replaces the old xwiki.showviewaction property in the xwiki.cfg file." ({{{}xwiki.properties.vm:1034-1039{}}}, since 7.2M1)
* {{url.standard.entityPathPrefix}} — "Note that this replaces the old xwiki.defaultservletpath property in the xwiki.cfg file." ({{{}xwiki.properties.vm:1017-1024{}}}, since 5.2M1)

Neither statement is true of the running product.
h2. 1. url.standard.hideViewAction is read by nothing

{{StandardURLConfiguration.isViewActionHidden()}} has no caller in main code. The only occurrences in the whole platform are the interface, {{{}DefaultStandardURLConfiguration{}}},
{{LegacyStandardURLConfiguration}} and two comments in {{{}AbstractEntityResourceReferenceResolver{}}}. A scan of every jar in a shipped {{WEB-INF/lib}} (18.9.0) finds the symbol only in
{{xwiki-platform-url-scheme-standard}} and {{{}xwiki-platform-legacy-url{}}}, i.e. the declaring classes.

Its last caller was removed by 52dfa89f801 (XWIKI-12842, "Improve URL backward-compatibility after introduction of Nested Spaces", 2015-11-20, 7.4), which replaced the conditional
parsing with the unconditional one that is there today. The property has had no effect since.

What actually decides whether {{view}} appears in a generated URL is {{XWikiServletURLFactory.addAction()}} calling {{XWiki.showViewAction()}} ({{{}XWiki.java:7184-7194{}}}), which reads
the {{XWikiPreferences}} field {{showviewaction}} and then {{{}xwiki.cfg{}}}'s {{xwiki.showviewaction}} (default {{{}1{}}}).
h2. 2. url.standard.entityPathPrefix only affects parsing

{{getEntityPathPrefix()}} has exactly one consumer in main code, {{{}StandardStringResourceTypeResolver:60{}}}, which decides whether an incoming path segment introduces an entity path.
Generated URLs come from {{XWiki.getServletPath()}} ({{{}XWiki.java:5688-5699{}}}): {{{}xwiki.servletpath{}}}, falling back to {{xwiki.defaultservletpath}} when the request path does not
start with {{{}/bin{}}}. So the property changes which URLs XWiki {*}accepts{*}, never the ones it *emits* — it does not replace {{{}xwiki.defaultservletpath{}}}.
h2. Steps to reproduce

On a 18.9.0 standalone distribution, counting the links the home page generates:
{code:java}
  curl -s http://localhost:8080/xwiki/bin/view/Main/WebHome | grep -o '/xwiki/bin/view/' | wc -l
  {code}
* stock configuration:
{ * 37 }40{ * }
* {{url.standard.hideViewAction=true}} in {{xwiki.properties}} + restart: *
37 40 *   (no change)
* {{xwiki.showviewaction=0}} in {{xwiki.cfg}} + restart: *0* — links become {{{}/xwiki/bin/Sandbox/{}}}, while {{edit}} links correctly keep their action