Hello everybody!

I've been trying to generate links to make an uploaded file via an App 
available for downloading in website to visitors. In the model class I get to 
the node that has the jcr:data property and tried to generate the link from it 
with templatingFunctions.link(). It generates this link: 
/testMagnolia-webapp-1.0-SNAPSHOT/Juegos/Mario-Bros/archapk/USE4CALL(201508).apk.apk
 It doesn't work, I have removed the extra  ".apk" generated and tried many 
combos but still doesn't work. 
My workspace is called apks and the node that has the jcr.data property is 
called archapk. Thanks in advance!
I have sth like this:

public String getDownloadLink() {
        Node target = null;
        try {
            target = getTarget().getNode("archapk");          
        } catch (RepositoryException e) {
            e.printStackTrace();
            return "null";
        }
        final String targetNodeIdentifier = PropertyUtil.getString(target, 
"jcr:uuid");                
        return templatingFunctions.link("apks", targetNodeIdentifier);
    }

private Node getTarget() {
        final String targetNodeIdentifier = PropertyUtil.getString(content, 
"apk");
       
        try {
            final Node target = 
templatingFunctions.nodeById(targetNodeIdentifier, "apks");         
            if (target != null) {
                if (target.isNodeType(NodeTypes.Deleted.NAME)) {
                    return null;
                }
                return target;
            } 
        } catch (RepositoryException e) {
            e.printStackTrace();
        }
        return null;
    }

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=54709e04-c4b4-4946-ac40-ead84e3664b7


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to