enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
198 stars 34 forks source link

Limit mount to root context-path #10546

Closed alansemenov closed 2 weeks ago

alansemenov commented 2 months ago
<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="urn:enonic:xp:model:1.0">
   <context-path>any</context-path>
</api>

context-path can either be default or any

default means api is available only root context path - this is the default, if context-path is not specified any means api is available on any context path

Reason any exists is to have an ability to create APIs capable to read content path - similar to how "component" service works.

api mount does not use context-path parameter admin default mounts on /admin/tool/_/ admin any mounts as admin default and on /admin/tool/.../_/ webapp default mounts on /webapp/{some_webpp}/_/. If webapp does not match application's api - 404 returned. webapp any mounts as webapp default and on /webapp/{webpp}/.../_/. If webapp does not match application's api - 404 returned. all_webapps default - same as webapp default except for restriction for webapp to exist or have application set. all_webapps any - same as webapp any except for restriction for webapp to have application set. site default mounts on nearest site /site/{project}/{branch}/.../{site}/_/ or project /site/{project}/{branch}/_/ - when there is no nearest site. If nearest site/project does not have application installed - 404 returned. site any mounts as site default and on nearest site path /site/{project}/{branch}/.../{site}/.../_/ or project /site/{project}/{branch}/.../_/ - when there is no nearest site. all_sites default same as site default except for restriction for site/project to have application set. all_sites any same as site any except for restriction for site/project to have application set.

anatol-sialitski commented 1 month ago

WIP

api: skip 

---------------------------

s: /
t1: /webapp/com.enonic.app.officeleauge

webapp (any):
rawPath: /webapp/com.enonic.app.officeleauge/.../_/app/...
uri: /.../_/app/...

s: /bla
uri: /bla/.../_/app/...

webapp (default):
rawPath: /webapp/com.enonic.app.officeleauge/_/app/...
uri: /_/app/...

t2: /

webapp (any):
rawPath: /webapp/com.enonic.app.officeleauge/.../_/app/...
uri: /webapp/com.enonic.officeleauge/.../_/app/...

webapp (default):
rawPath: /webapp/com.enonic.app.officeleauge/_/app/...
uri: /webapp/com.enonic.app.officeleauge/_/app/...

t3: /webapp

webapp (any):
rawPath: /webapp/com.enonic.app.officeleauge/.../_/app/...
uri: /com.enonic.app.officeleauge/.../_/app/...

webapp (default):
rawPath: /webapp/com.enonic.app.officeleauge/_/app/...
uri: /com.enonic.app.officeleauge/_/app/...

s: /app

uri (default): /app/com.enonic.app.officeleauge/_/app/...

t4: /webapp/com.enonic.app.officeleauge/subfolder

webapp (any):
rawPath: /webapp/com.enonic.app.officeleauge/subfolder/.../_/app/...
uri: /.../_/app

webapp (default):
rawPath:/webapp/com.enonic.app.officeleauge/subfolder/_/app/...
uri: /_/app/...

----------------------------

s:/
t1: /admin

admin (any):

rawPath: /admin/tool/.../_/app/...
uri: /tool/.../_/app/...

admin (default):

rawPath: /admin/tool/_/app/...
uri: /tool/_/app/...

t2: /

admin (any):

rawPath: /admin/tool/.../_/app/...
uri: /admin/tool/.../_/app/...

admin (default):

rawPath: /admin/tool/_/app/...
uri: /admin/tool/_/app/...

s: /admin-su
t: /admin
any
rawPath: /admin/tool/.../_/app/...
uri: /admin-su/tool/.../_/app/...
default
rawPath: /admin/tool/_/app/...
uri: /admin-su/tool/_/app/...

----------------------------

s: /
t: /

mount: all_sites (any)

rawPath: /site/repo/branch/.../_/...
uri: /site/repo/branch/.../_/...

t2: /site/repo/branch/mysite
rawPath: /site/repo/branch/mysite/.../_/...
uri: /.../_/...

mount: all_sites (default)

rawPath: /site/repo/branch/mysite/_/...
uri: /site/repo/branch/mysite/_/...

t2: /site/repo/branch/mysite
rawPath: /site/repo/branch/mysite/_/...
uri: /_/...

t3: /site

t4: /site/repo

t5: /site/repo/branch

[t6: /site/repo/branch/mysite/content] ???