[ 
https://issues.apache.org/jira/browse/JCR-1787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637954#action_12637954
 ] 

Nicholas DiPiazza commented on JCR-1787:
----------------------------------------

1) Here is the situation. I have XML files that are linked with XSLT files in 
the repository. 

I need to be able to use read-only webdav and serve these XML pages from the 
repository and have them launch in the browser.

The problem was when my XML configuration was turned on, the result of the 
webdav path would return the actual XML from the Node... not the XML contained 
within the jcr:data.

2) Webdav config:

I am using the out of the box webdav config.

<propertymanager>
        <!-- class element defines the manager to be used. The specified class
             must implement the PropertyManager interface.
             Note, that the handlers are being added and called in the order
             they appear in the configuration.
        -->
        <class name="org.apache.jackrabbit.server.io.PropertyManagerImpl" />
        <propertyhandler>
            <class name="org.apache.jackrabbit.server.io.VersionHandler" />
        </propertyhandler>
        <propertyhandler>
            <class name="org.apache.jackrabbit.server.io.VersionHistoryHandler" 
/>
        </propertyhandler>
        <propertyhandler>
            <class name="org.apache.jackrabbit.server.io.ZipHandler" />
        </propertyhandler>
        <propertyhandler>
            <class name="org.apache.jackrabbit.server.io.XmlHandler" />
        </propertyhandler>
        <propertyhandler>
            <class 
name="org.apache.jackrabbit.server.io.DirListingExportHandler" />
        </propertyhandler>
        <propertyhandler>
            <class name="org.apache.jackrabbit.server.io.DefaultHandler" />
        </propertyhandler>
    </propertymanager>

> XmlHandler export functions don't work in XML repository mode - causes XML 
> with XSLT dependencies to show up with jcr:content XML element.
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1787
>                 URL: https://issues.apache.org/jira/browse/JCR-1787
>             Project: Jackrabbit
>          Issue Type: Bug
>            Reporter: Nicholas DiPiazza
>         Attachments: XmlHandler.java
>
>
> I can't view XML files with XSLT dependencies because the XML returned from 
> XML requests will come back as the "jcr:content" XML representation.
> <?xml version="1.0" encoding="UTF-8" ?> 
>   <jcr:content xmlns:jcr="http://www.jcp.org/jcr/1.0"; 
> xmlns:nt="http://www.jcp.org/jcr/nt/1.0"; 
> xmlns:sv="http://www.jcp.org/jcr/sv/1.0"; 
> xmlns:mix="http://www.jcp.org/jcr/mix/1.0"; 
> xmlns:xrc="http://www.xerceo.com/learn/jcr-1.0"; xmlns:rep="internal" 
> jcr:primaryType="nt:resource" jcr:uuid="33951e14-7a9a-4746-b848-4f931f4c01be" 
> jcr:data="" jcr:encoding="UTF-8" 
> jcr:lastModified="2008-10-06T14:46:43.965-05:00" jcr:mimeType="text/xml" /> 
> I suggest changes to package org.apache.jackrabbit.server.io.XmlHandler:
> 1) Create new method:
> /**
>      * @see DefaultHandler#exportData(ExportContext, boolean, Node)
>      */
>     protected void exportData(ExportContext context, boolean isCollection, 
> Node contentNode) throws IOException, RepositoryException {
>         // first child of content is XML document root
>         if (contentNode.getNodes().hasNext()) {
>             contentNode = contentNode.getNodes().nextNode();
>         }
>         
>         OutputStream out = context.getOutputStream();
>         
> out.write(ValueHelper.serialize(contentNode.getProperty("jcr:data").getValue(),
>  false).getBytes());
>     }
> Change canExport method:
> /**
>      * @see IOHandler#canExport(ExportContext, boolean)
>      */
>     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 = 
> context.getMimeResolver().getMimeType(context.getExportRoot().getName());
>                 }
>             } catch (RepositoryException e) {
>                 // ignore and return false
>             }
>             return XML_MIMETYPE.equals(mimeType);
>         }
>         return false;
>     }
> This causes my server to return the correct XML then

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to