What's the right way to plug web pages into Team City?
I've written a plugin that adds new web pages to the build server. The plugin uses the UrlMapping object in its constructor to map URLs to its controller like so:
public Plugin(
SBuildServer server,
UrlMapping urlMapping,
WebResourcesManager webResourcesManager)
{
super(server);
this.webResourcesManager = webResourcesManager;
urlMapping.addHandler("/" + PLUGIN_NAME + "*", this);
webResourcesManager.addPluginResources(PLUGIN_NAME, PLUGIN_NAME + ".jar");
}]]>
However, TeamCity's url mappings are are all specified in the server's spring config file. It seems wrong to hard-code the URL mapping into the plugin. Is there a standard way of configuring the URL mapping for a plugin?
Please sign in to leave a comment.
Hello Nat,
There are several classes which might be of special interest for TeamCity
web plugin developers.
WebControllerManager - allows to register plugin controllers and extensions
to existing controllers. In TeamCity you should not use Spring UrlMapping
class directly. Instead register your controller in the
WebControllerManager.
WebExtension - a custom extension to an existing controller. Implement it if
you like to extend some existing pages. See javadoc for WebPlace for more
info about places where you can plug.
WebResourcesManager - use it to provide information about jar file with your
plugin. This jar file should contain buildServerResources/ folder as it
described in
http://www.jetbrains.net/confluence/display/TW/Plugin+Development (section
Web content).
--
Pavel Sher
"Nat" <nat.pryce@gmail.com> wrote in message
news:1630772.1182626139563.JavaMail.itn@is.intellij.net...
>
>
Thanks. The WebControllerManager seems to be what I was looking for. Thanks.
--Nat