SitemapXMLController returns string
The SitemapXMLController
controller returns a String
:
$ curl https://www.genesys-pgr.org/sitemap.xml
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">
<sitemap>
<loc>https://www.genesys-pgr.org/sitemap-content.xml</loc>
</sitemap>
<sitemap>
<loc>https://www.genesys-pgr.org/sitemap-geo.xml</loc>
</sitemap>
<sitemap>
<loc>https://www.genesys-pgr.org/sitemap-wiews.xml</loc>
</sitemap>
<sitemap>
<loc>https://www.genesys-pgr.org/sitemap-crop.xml</loc>
</sitemap>
</sitemapindex>"
Notice the starting and ending "
which is incorrect and the response content is not valid XML.
Options:
- Update
@RequestMapping
withproduces = ...
, perhaps that already fixes the problem - Don't use
StringBuffer
and write directly to the response output stream (and flush it when done) - Any other idea?