Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BE97A200C2B for ; Thu, 2 Mar 2017 10:22:55 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BD43B160B6F; Thu, 2 Mar 2017 09:22:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0F439160B61 for ; Thu, 2 Mar 2017 10:22:54 +0100 (CET) Received: (qmail 43787 invoked by uid 500); 2 Mar 2017 09:22:54 -0000 Mailing-List: contact dev-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list dev@sling.apache.org Received: (qmail 43776 invoked by uid 99); 2 Mar 2017 09:22:54 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2017 09:22:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id C0167C0290 for ; Thu, 2 Mar 2017 09:22:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.451 X-Spam-Level: * X-Spam-Status: No, score=1.451 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id NlJ9uZ324vio for ; Thu, 2 Mar 2017 09:22:51 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4798C5FCE7 for ; Thu, 2 Mar 2017 09:22:51 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B0732E012C for ; Thu, 2 Mar 2017 09:22:50 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 673BA24160 for ; Thu, 2 Mar 2017 09:22:45 +0000 (UTC) Date: Thu, 2 Mar 2017 09:22:45 +0000 (UTC) From: "Konrad Windszus (JIRA)" To: dev@sling.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SLING-6587) Resource Merger does not work correctly with content MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 02 Mar 2017 09:22:55 -0000 [ https://issues.apache.org/jira/browse/SLING-6587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15891900#comment-15891900 ] Konrad Windszus commented on SLING-6587: ---------------------------------------- The resource resolver always first tries to resolve the URL directly (without any splitting) against all registered resource providers. Since your resource picker actually returns a resource for a resource path including the extension the resource resolver just takes this resource. Only in case the first attempt does not return a resource the resolver will split up the URL. So in this case you should be able to fix in your {{ResourcePicker}} by just returning an empty collection for resource paths containing ".". > Resource Merger does not work correctly with content > ---------------------------------------------------- > > Key: SLING-6587 > URL: https://issues.apache.org/jira/browse/SLING-6587 > Project: Sling > Issue Type: Bug > Components: Extensions > Affects Versions: Resource Merger 1.3.0 > Reporter: Georg Henzler > > I tried to create the following resource picker in the hope I could merge content resources and render them as html: > {code} > @Component(label = "Content Resource Picker", description = "", metatype = true) > @Service(value = { MergedResourcePicker2.class }) > @Properties({ > @Property(name = MergedResourcePicker2.MERGE_ROOT, value = WwwMergingResourcePicker.DEFAULT_ROOT, label = "Root", description = "The mount point of merged resources"), > @Property(name = MergedResourcePicker2.READ_ONLY, boolValue = false, label = "Read Only", description = "Specifies if the resources are read-only or can be modified.") > }) > public class WwwMergingResourcePicker implements MergedResourcePicker2 { > private static final Logger LOG = LoggerFactory.getLogger(WwwMergingResourcePicker.class); > public static final String DEFAULT_ROOT = "/mnt/contentwww"; > @Override > public List pickResources(final ResourceResolver resolver, final String relativePath, > final Resource relatedResource) { > String resourcePath = StringUtils.substringBefore(relativePath, "."); // for some reason path/to/page.html including ".html" is passed in here > List resources = new ArrayList(); > String overrideContentBasePath = "/content/www/override"; > String masterBasePath = "/content/www/master"; > String overrideContentPath = overrideContentBasePath + "/" + resourcePath; > Resource overrideContentResource = resolver.getResource(overrideContentPath); > resources.add(overrideContentResource); > String masterPath = masterBasePath + "/" + resourcePath; > Resource masterResource = resolver.getResource(masterPath); > resources.add(masterResource); > return resources; > } > } > {code} > The request to `/mnt/contentwww/path/to/my/page.html` answers with a redirect to /mnt/contentwww/path/to/my/page.html/, trailing slash instead of returning an html rendering, the root cause seems to be that for some reason the request path is completely taken as resource path instead of splitting it in the sling way (extension should be html, .html should be cut off the resource path: > {code} > 0 TIMER_END{0,ResourceResolution} URI=/mnt/contentwww/path/to/my/page.html resolves to Resource=MergedResource [path=/mnt/contentwww/path/to/my/page.html, resources=[Ljava.lang.String;@31d6983a] > 0 LOG Resource Path Info: SlingRequestPathInfo: path='/mnt/contentwww/path/to/my/page.html', selectorString='null', extension='null', suffix='null' > ... > 4 TIMER_START{org.apache.sling.servlets.get.DefaultGetServlet#0} > 4 LOG Using org.apache.sling.servlets.get.impl.helpers.StreamRendererServlet to render for extension=null > {code} > Looking at the code of the resource merger module, it is just registering a resource provider and hence, conceptually it should work (the resource provider should never get to see a path with extension ".html" IMHO, to me it looks like the problem might be in some other module). -- This message was sent by Atlassian JIRA (v6.3.15#6346)