Plugin that outputs XML file on the fly Follow
I'm trying to build a plugin that outputs a stream of XML on the fly, per HTTP request. I'm new to the Java way of doing something like this. Is there a way to do this from within TeamCity without having to create a corresponding JSP file? Right now I'm inheriting from BaseController and using WebControllerManager to register that controller with TeamCity. All the documentation I look up seems to say that I need a corresponding JSP file for that controller. Is there a way to output a stream of XML to a browser/client without having a corresponding physical JSP file on disk? Thanks!
Please sign in to leave a comment.
You can obtain output stream from HttpServletResponse object (getOutputStream() method) and write your own data as you like. Do not forget to close stream after that.
That gets me closer to where I want to be
However, I'm still having trouble accessing my registered Controller via a URL. Tomcat keeps returning 404 errors no matter what format I try to put in. I have tried to access the Controller via http://<server_name>/Controller and http://<server_name>/Controller.html. Both of these URLs return a 404 error, but appending .html to the URL actually returns an error in the logs; the first URL does not. Is there something else I need to do to register the Controller properly besides making a call to webControllerManager.registerController()?
Your controller should be accessible by the url which you are using when you register it in the web controller manager. The only restriction: url must end with .html. If you will attach here your code probably I will see where is the problem.
Here's how I am registering my controller inside my plugin's constructor:
Here is the controller class:
Accessing it via http://<servername>/controller or http://<servername>/controller.html does not work.
Does that help flesh out the problem?
Try to add leading / to the path: /controller.html
that did the trick. thanks!
Thank you for your feedback, javadoc fixed