Importing a xml document into jackrabbit throught DAV result in creating a node with mime type "application/xml" (see below comment of XML_MIMETYPE_ALT : the alternative xml mimetype. tika detects xml as this ("application/xml")).

As a consequence, the method "canExport(ExportContext context, boolean isCollection)" will return false (see below) , and any http request that retreive the xml file will get an empty file.

Is this the behavior that jackrabbit is supposed to have ?

The method canExport could return true in both case , when mimetype is "text/xml" or "application/xml".

public class XmlHandler extends DefaultHandler {

    private static Logger log = LoggerFactory.getLogger(XmlHandler.class);

    /**
     * the xml mimetype
     */
    public static final String XML_MIMETYPE = "text/xml";

    /**
     * the alternative xml mimetype. tika detects xml as this.
     */
    public static final String XML_MIMETYPE_ALT = "application/xml";

    private static final Set<String> supportedTypes;
    static {
        supportedTypes = new HashSet<String>();
        supportedTypes.add(XML_MIMETYPE);
        supportedTypes.add(XML_MIMETYPE_ALT);
    }

......
......

 public boolean canExport(ExportContext context, boolean isCollection) {
        if (super.canExport(context, isCollection)) {
            String mimeType = null;
            try {
                Node contentNode = getContentNode(context, isCollection);
                if (contentNode.hasProperty(JcrConstants.JCR_MIMETYPE)) {
mimeType = contentNode.getProperty(JcrConstants.JCR_MIMETYPE).getString();
                } else {
                    mimeType = detect(context.getExportRoot().getName());
                }
            } catch (RepositoryException e) {
                // ignore and return false
            }
            return XML_MIMETYPE.equals(mimeType);
        }
        return false;
    }

Reply via email to