cancel
Showing results for 
Search instead for 
Did you mean: 

How to serve an XML file

leonardo_celati
Champ in-the-making
Champ in-the-making
I am currently lost in providing to serve a sitemap.xml file from alfresco.

My purpose is to build an xml conform to sitemap.org schema, but all the tentavies result in having an htrml file on browser.

This is what I have done so far:

sitemap.xml (on alfresco share with mapping sitemap)

This is instead the list of files on the wcmqs webapp:


page/sitemap.xml

<?xml version="1.0" encoding="UTF-8"?>
<page>
   <id>sitemap</id>
   <description>specific page for sitemap</description>
   <template-instance>sitemap</template-instance>
   <authentication>none</authentication>
   <components>
        <component>
            <region-id>content</region-id>
            <url>/content/content-sitemap</url>
        </component>
   </components>
</page>


Then I have this template xml + ftl


template/sitemap.xml

<?xml version="1.0" encoding="UTF-8"?>
<template-instance>
        <title>sitemap</title>
        <description>Template for sitemap</description>
        <template-type>sitemap</template-type>
        <components></components>
</template-instance>



template/sitemap.ftl

<?xml version="1.0" encoding="UTF-8" ?>
<root>
   <@region id="content" scope="page"/>
</root>


Finally I have my webscripts which is supposed to iterate collection and display data


webscripts/sitemap.get.desc.xml

<webscript>
  <shortname>Simple sitemap</shortname>
  <description>Display simple sitemap</description>
  <url>/content/content-sitemap</url>
  <format default="xml"></any>
</webscript>



webscripts/sitemap.get.xml.ftl

<#if collection??>
   // iterate and build tags–>
   // ….
   // <—
</#if>



But everything results in an empty html file. Besides from investigating on why it is empty, but why the mimetype is set to html ?
What am I doing wrong ?
3 REPLIES 3

jpotts
World-Class Innovator
World-Class Innovator
This is cross-posted on stackoverflow.com here:
http://stackoverflow.com/questions/23220013/serving-xml-file-from-alfresco-to-wcmqs

Going forward, please post your question here or there, but not in both places.

Thanks!

Jeff

leonardo_celati
Champ in-the-making
Champ in-the-making
Oops..I didnt' know of such rule, I gave a try to SO because of little interest here about this subject.
I am going to delete the stackoverflow question, hoping for an answer here.

leonardo_celati
Champ in-the-making
Champ in-the-making
The empty content, was due to the fact that from time to time, the wcmqs server need to be restarted, because at some point the direct changes in the .ftl without redeploying are not taken into account anymore !!!

Still remain the fact that the content is rendered as mime type text/html, even though the content-sitemap.xml.ftl is invoked and the debugger in ApplicationDataInterceptor shows the correct property about the retrieved asset cmis:contentStreamMimeType=text/xml.

At this point I am lost, there's something down the chain which is converting the mime type header to html.

[UPDATE]

There is something I am obviously missing, because by following the debugger I came to the org.springframework.extensions.surf.mvc.AbstractWebFrameworkView and found this on line 252


response.setContentType(MIMETYPE_HTML);


which is setting response to html.

Any suggestions ?