cancel
Showing results for 
Search instead for 
Did you mean: 

How can I configure a shorter URL than nxpath/default/default-domain for everything?

René_
Confirmed Champ
Confirmed Champ

Hi there, the URLs of documents in Nuxeo tend to get rather long. https://mydomain.hoster.com/nuxeo/nxpath/default/default-domain/workspaces/project1/folder/document/... That is 115 characters, although there are no lengthy names and only one folder in the hierarchy. A large part of that is the default "middle" part starting from nxpath until default-domain (29 characters), that I cannot influence (to the best of my knowledge). I can rename a domain, but the path remains the same (which makes sense in many cases). Is there a way to change this part? If every part is necessary, I could still use only 1 character so that each URL would be shortened by 24 characters. That avoids problems with large URLs when using a lot of subfolders (which some users do). Thanks in advance for your help Regards René

2 REPLIES 2

Yousuf_Nejati
Star Contributor
Star Contributor

Hey Rene,

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

Hi,

You could setup the "id" URL pattern, which is shorter, as the default one instead of the one relying on the document path.

Here is a sample runtime contribution (not tested) to achieve that:

  <require>org.nuxeo.ecm.platform.ui.web.rest.URLService.contrib</require>
  <extension point="urlpatterns" target="org.nuxeo.ecm.platform.ui.web.rest.URLService">
    <urlPattern enabled="true" name="id">
      <defaultURLPolicy>true</defaultURLPolicy>
      <needBaseURL>true</needBaseURL>
      <needRedirectFilter>true</needRedirectFilter>
      <needFilterPreprocessing>true</needFilterPreprocessing>
      <codecName>docid</codecName>
      <actionBinding>#{restHelper.initContextFromRestRequest}</actionBinding>
      <documentViewBinding>#{restHelper.documentView}</documentViewBinding>
      <newDocumentViewBinding>
        #{restHelper.newDocumentView}
      </newDocumentViewBinding>
      <bindings>
        <binding callGetter="false" name="tabId">
          #{webActions.currentTabId}
        </binding>
        <binding callGetter="false" name="subTabId">
          #{webActions.currentSubTabId}
        </binding>
        <binding name="tabIds">#{webActions.currentTabIds}</binding>
        <binding callGetter="false" name="language">
          #{restHelper.localeString}
        </binding>
      </bindings>
    </urlPattern>

    <urlPattern name="default" enabled="true">
      <defaultURLPolicy>false</defaultURLPolicy>
      <needBaseURL>true</needBaseURL>
      <needRedirectFilter>true</needRedirectFilter>
      <needFilterPreprocessing>true</needFilterPreprocessing>
      <codecName>docpath</codecName>
      <actionBinding>#{restHelper.initContextFromRestRequest}</actionBinding>
      <documentViewBinding>#{restHelper.documentView}</documentViewBinding>
      <newDocumentViewBinding>
        #{restHelper.newDocumentView}
      </newDocumentViewBinding>
      <bindings>
        <binding name="tabId" callGetter="false">
          #{webActions.currentTabId}
        </binding>
        <binding name="subTabId" callGetter="false">
          #{webActions.currentSubTabId}
        </binding>
        <binding name="tabIds">#{webActions.currentTabIds}</binding>
        <binding name="language" callGetter="false">
          #{restHelper.localeString}
        </binding>
        <binding name="mainTabId" callGetter="false">
          #{webActions.currentTabIds}
        </binding>
      </bindings>
    </urlPattern>

  </extension>

Note the change of values for the "defaultURLPolicy" property compared to the default configuration at http://explorer.nuxeo.com/nuxeo/site/distribution/cap-8.3/viewComponent/org.nuxeo.ecm.platform.ui.we...

You can also define your own URL policy, check the documentations at https://doc.nuxeo.com/x/EIzZ and https://doc.nuxeo.com/x/hwFu

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.