UrlModule: Add comment about missing binding for /plugins/ REST collection

UrlModule binds servlets for all REST root collections except for
'/plugins/'. Due to this plugins cannot add REST views on PLUGIN_KIND.
However this is intentional. '/plugins/' is already handled by
HttpPluginServlet which is bound in HttpPluginModule. Binding 2
different servlets on the same regex would result in undefined
behavior. If a plugin is serving anything under its '/plugins/<id>/'
namespace like a static file for JavaScript or a custom servlet or
protocol it may no longer work if UrlModule's binding is being used.

Add a comment to UrlModule so we are not tempted to add a binding for
a servlet that handles '/plugins/' here, as this would break the
plugins as described above.

Change-Id: I50a7883d5674c54d7637fd1ee2767b171c773e58
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-09-05 09:44:31 +02:00
parent a7e0fce3eb
commit 834458e26c

View File

@@ -98,6 +98,11 @@ class UrlModule extends ServletModule {
filter("/a/*").through(RequireIdentifiedUserFilter.class);
serveRegex("^/(?:a/)?tools/(.*)$").with(ToolServlet.class);
// Bind servlets for REST root collections.
// The '/plugins/' root collection is already handled by HttpPluginServlet
// which is bound in HttpPluginModule. We cannot bind it here again although
// this means that plugins can't add REST views on PLUGIN_KIND.
serveRegex("^/(?:a/)?access/(.*)$").with(AccessRestApiServlet.class);
serveRegex("^/(?:a/)?accounts/(.*)$").with(AccountsRestApiServlet.class);
serveRegex("^/(?:a/)?changes/(.*)$").with(ChangesRestApiServlet.class);