Tuesday, December 18, 2012

Adding Vert.x includes to Confluence pages

Recently I wanted to include small dynamic page into Confluence site.
I created all logic in Vert.x and it worked fine in browser, but when I tried to add it via HTML Include macro in Conflunce, it gave this error:


Error rendering macro 'html-include' : null

After some investigation I found that this happens because Vert.x does not provide any proper content type header in responses and it have to be done manually, browser ignores it and treats page as HTML by default, but Confluence throws error. So it was easy to fix by adding content type to response, like:


request.response.putHeader("Content-Type", "text/html")