0

I have a controller that looks like this:

@Override
protected ModelAndView doHandle(HttpServletRequest request, HttpServletResponse response) throws Exception {
 System.out.println("Called from actionregister example at "+ DateTime.now());
    return null;
}

Registered with "/admin/testcontroller.html";

Id like to know if there is a way to trigger this controller by using the registered url, assuming it is all running on the same server.

That way I can call the url and see the sys out on the server.

Id like to do this so that spring applications on the same server can use controllers from other applications without having knowledge of the class they belong to?

To elaborate more, I have written a controller in spring application A. the controller is registered under url "/admin/testcontroller.html". I now have another application B. Its running on the same server. I would like methods in application B to be able to trigger the doHandle method in A by referencing the URL. I would like to know if this is possible given that Application B would have no knowledge of the class name of the base controller.

Thanks

mogoli
  • 1,343
  • 5
  • 18
  • 35
  • Can you please add more details. Your question is not really clear to me. Sorry !!! – Kunal Vohra Mar 11 '19 at 18:07
  • Edited, now, hopefully that helps. – mogoli Mar 11 '19 at 18:11
  • 1
    Here is an example how to do a http request https://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests or here https://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java – derUser Mar 11 '19 at 18:16
  • Thanks @derUser, it did just the trick. – mogoli Mar 11 '19 at 21:35

0 Answers0