You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Robert Munteanu <ro...@apache.org> on 2015/10/31 17:26:20 UTC
How to I set a sling:redirect property to something under /content
?
Hi,
I'm trying to create a redirect from / to /content/blog/posts . The way
I did this was to change the sling:redirect property of / to
/content/blog/posts.
However, the redirect ends up being sent to /blog/posts ( /content
prefix removed ). By debugging I realised that this is removed by the
ResourceResolver.map() call since there the
ResourceResolverFactoryActivator URL mappings contain
"/:/", "/content/:/", "/system/docroot/:/"
which means that for the ResourceResolver.map() call /content is
removed.
I am not too familiar with that area of Sling, so my questions are:
1) Is another ( clean ) way of doing this? I imagine I could redirect
to /content/content/blog/posts or http://localhost:8080/content/blog/po
sts, but both seem workardounds
2) Does this look like a bug?
Thanks,
Robert
Re: How to I set a sling:redirect property to something under
/content?
Posted by Robert Munteanu <ro...@apache.org>.
On Sat, 2015-10-31 at 21:37 +0100, Oliver Lietz wrote:
> On Saturday 31 October 2015 18:26:20 Robert Munteanu wrote:
> > Hi,
>
> Hi Robert,
>
> > I'm trying to create a redirect from / to /content/blog/posts . The
> > way
> > I did this was to change the sling:redirect property of / to
> > /content/blog/posts.
> >
> > However, the redirect ends up being sent to /blog/posts ( /content
> > prefix removed ). By debugging I realised that this is removed by
> > the
> > ResourceResolver.map() call since there the
> > ResourceResolverFactoryActivator URL mappings contain
> >
> > "/:/", "/content/:/", "/system/docroot/:/"
> >
> > which means that for the ResourceResolver.map() call /content is
> > removed.
> >
> > I am not too familiar with that area of Sling, so my questions are:
> >
> > 1) Is another ( clean ) way of doing this? I imagine I could
> > redirect
> > to /content/content/blog/posts or http://localhost:8080/content/blo
> > g/po
> > sts, but both seem workardounds
> >
> > 2) Does this look like a bug?
>
> you usually don't want /content/ in your external URLs (visible to
> clients)
> and your resources under /content/blog/posts should be available also
> under
> /blog/posts. Does it work?
Well, I can work around it, but I think I should not have to :-)
> Have you read "Mappings for Resource Resolution"[0]?
Now I have. However, it's mostly concerned with what is under /etc/map,
whereas in my scenario /etc/map does not even exist.
>
> Are you playing with a public available example?
No, it's not public ( but not rocket-science either ).
/ has "sling:target": "/content/blog/posts.html"
/content/blog/posts is a regular Sling resource.
Robert
>
> Regards,
> O.
>
> [0] https://sling.apache.org/documentation/the-sling-engine/mappings-
> for-resource-resolution.html
>
> > Thanks,
> >
> > Robert
>
Re: How to I set a sling:redirect property to something under /content?
Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Saturday 31 October 2015 18:26:20 Robert Munteanu wrote:
> Hi,
Hi Robert,
> I'm trying to create a redirect from / to /content/blog/posts . The way
> I did this was to change the sling:redirect property of / to
> /content/blog/posts.
>
> However, the redirect ends up being sent to /blog/posts ( /content
> prefix removed ). By debugging I realised that this is removed by the
> ResourceResolver.map() call since there the
> ResourceResolverFactoryActivator URL mappings contain
>
> "/:/", "/content/:/", "/system/docroot/:/"
>
> which means that for the ResourceResolver.map() call /content is
> removed.
>
> I am not too familiar with that area of Sling, so my questions are:
>
> 1) Is another ( clean ) way of doing this? I imagine I could redirect
> to /content/content/blog/posts or http://localhost:8080/content/blog/po
> sts, but both seem workardounds
>
> 2) Does this look like a bug?
you usually don't want /content/ in your external URLs (visible to clients)
and your resources under /content/blog/posts should be available also under
/blog/posts. Does it work?
Have you read "Mappings for Resource Resolution"[0]?
Are you playing with a public available example?
Regards,
O.
[0] https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html
> Thanks,
>
> Robert