Custom controller for plugin not being loaded

I am working on a build task plugin with a simple configuration screen in the administration area of TC for users to enter their API key for our service. I am following the docs, samples, and other solutions to similar problems in these forums (as far as I can tell!), but still can't seem to get the controller registered properly.

My spring beans XML file loads a main plugin constructor, which initializes & registers my custom AdminTab and then does the same for my custom controller, which extends BaseController:

    // set up & register the settings tab in admin
    MyAdminTab admin_tab = new MyAdminTab(pagePlaces, pluginDescriptor);
    admin_tab.register();


    // set up & register the controller
    MyAdminController controller = new MyAdminController(server, pluginDescriptor);
    webControllerManager.registerController("/admin/my_controller.html", controller);

This is MyAdminController:

public class MyAdminController extends BaseController {


  public MyAdminController(@NotNull SBuildServer server, @NotNull final PluginDescriptor pluginDescriptor) {

    super(server);

  }


  @Override

  public ModelAndView doHandle(final HttpServletRequest request, final HttpServletResponse response) throws IOException {

    System.out.println("== hello, this is the doHandle method ==");

    response.getOutputStream().print("Hello from doHandle!");

    response.getOutputStream().close();

    return null;

  }

}

When I install my plugin and open the administration pages, I see the custom tab, but localhost:8111/admin/my_controller.html returns a 404:

$ curl -v http://localhost:8111/admin/my_controller.html

* About to connect() to localhost port 8111 (#0)

*   Trying 127.0.0.1...

* Adding handle: conn: 0x1c29260

* Adding handle: send: 0

* Adding handle: recv: 0

* Curl_addHandleToPipeline: length: 1

* - Conn 0 (0x1c29260) send_pipe: 1, recv_pipe: 0

* Connected to localhost (127.0.0.1) port 8111 (#0)

> GET /loaderio.html HTTP/1.1

> User-Agent: curl/7.31.0

> Host: localhost:8111

> Accept: */*

>

< HTTP/1.1 404 Not Found

* Server Apache-Coyote/1.1 is not blacklisted

< Server: Apache-Coyote/1.1

< Content-Type: text/html;charset=utf-8

< Content-Length: 949

< Date: Wed, 08 Jan 2014 19:28:46 GMT<

* Connection #0 to host localhost left intact

[the requested resource is not available message]

* Closing connection #0

Am I missing something obvious?

1 comment
Comment actions Permalink

Turns out maven was hanging on to an old version of my bean XML file and there was an unsatisfied bean dependency throwing an error because I had moved things around. Got the maven package sorted out and everything seems to be working as advertised.

0

Please sign in to leave a comment.