Jenkins : Figuring out URL binding of Stapler

A part of writing UI in Hudson plugin is about figuring out what method/views Stapler maps to what URLs.

Tracing Stapler's URL dispatching process

When you run Hudson with the stapler.trace system property set to true (which happens automatically when you run mvn hpi:run), Stapler will produce the log of how the incoming URL is evaluated/dispatched. This trace is made available as HTTP response headers like "Stapler-Trace-001", "Stapler-Trace-002", ...

On Firefox, use the Live HTTP header extension to inspect response HTTP headers. Firebug can do this, too.

On Chrome, use View->Developer->Developer Tools->Network Tab->Click page you were loading to see headers

Also, in this mode, 404 error page will also contain the similar trace in the HTML format, along with how it eventually failed and what are possible URL bindings that were available at the point of failure.

These records are meant to assist plugin developers by showing URL mapping of stapler. You can use it against Hudson core or other plugins to see how their URL binding works, too. For the complete reference of how URL mapping works in stapler, see the stapler documentation.