How to embed plugin urls?

I would like to create a β€œwrapper” for the Grails project, which hosts the functions of the plugins, with the URLs separated by the name of the plugin.

So, the URLs of the Blog plugin used in the Shell project may look like this: /shell/blog/viewBlogPost

But I really see that all the plugin controllers behave as if they are part of the shell project itself: /shell/viewBlogPost

Is it possible to declare that plugin controllers on blogs are only available under the /blog path in the URL?

+1
source share
3 answers

It seems that Grails plugins cannot do this. The problem is that they lack encapsulation and composability, which leads to conflicts with the artifact:

  • URL routing from plugins is simply aggregated and cannot be nested
  • Controllers do not take up placements
  • Services do not fit in namespace

I discovered the problem: GRAILS-9300

The Grails team has preliminary plans for solving this problem in 2.2, using the plugin name as the namespace for artifacts.

+1
source

Yes, your plugins can register URL mappings just like your other shell applications.

0
source

You can declare UrlMappings in the plugin by creating a file with a name ending in UrlMappings in your plugin (e.g. BlogPluginUrlMappings.groovy ) and they will be merged into the main UrlMappings application. You can configure the mapping, starting with /blog/ , to route to your plugin controllers.

0
source

Source: https://habr.com/ru/post/1492802/


All Articles