You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by sam lee <sk...@gmail.com> on 2010/11/02 21:07:43 UTC
alias or reference?
Hey,
I want:
GET /some/path/jpeg.tidy.infinity.json
to be equivalent to:
GET /some/other/path/foo.tidy.infinity.json
I tried:
/some/path/jpeg/sling:resourceType = /some/other/path/foo
and
/some/path/jpeg/sling:resourceSuperType = /some/other/path/foo
but, the json returned by
GET /some/path/jpeg.tidy.infinity.json
is not same as the json returned by
GET /some/other/path/foo.tidy.inifinity.json
Should I use something other than sling:resourceType ?
sling:alias?
Thanks.
Sam
Re: alias or reference?
Posted by sam lee <sk...@gmail.com>.
I made a node, foo, mix:sharable. Copied foo to bar. I did NOT use
workspace.clone() as the spec said.
This CMS that I'm using comes with a gui repo browser. And, I could
not find .clone() functionality.
So, editing foo did not change bar. :P
I was too lazy to write up a Java program to clone the nodes.
In the end, I have:
/some/path/to/jpeg
/some/path/to/png
/some/path/to/gif
...
I just did not want to create png, gif... and other nodes. But it
seems to be inevitable.
(And, sling:alias won't do good even if it supported String[]
because.. it's complicated :)
Actually, something is callling
http://dev.day.com/content/docs/en/cq/current/javadoc/com/day/cq/commons/servlets/OverlayServlet.html
and it does not consider sling:alias.
I mean.. actual requests are like:
GET /some/path/to/formitems.overlay.json/image/png.json
And, that OverlayServlet seems to test existance of
/some/path/to/image/png/formitems .. and if that does not exist, it
does some other things.
And, setting /some/path/to/image/jpeg@sling:alias=png is not useful
when request is:
GET /some/path/to/image/png/formitems
(sling:alias seems to only work for basenames, or right most things.
GET /some/path/to/image/png is good. GET
/some/path/to/image/png/some/other/stuff does not get resolved to
GET /some/path/to/image/JPEG/some/other/stuff)
I did not formulate my initial question well enough. I misled you. I'm sorry.
Anyway, the problem is solved with /etc/map redirects. :P
Thanks.
Sam
On Fri, Nov 5, 2010 at 3:55 PM, Justin Edelson <ju...@justinedelson.com> wrote:
> Was there some reason that shareable nodes didn't work? Or are you simply
> opposed to them because mix:shareable can't be removed?
>
> Multi-valued sling:alias support was added in SLING-1332 and will be in
> the next release of the JCR Resource bundle.
>
> Justin
>
> On 11/5/10 3:25 PM, "sam lee" <sk...@gmail.com> wrote:
>
>>Ah, Thank you. I see.
>>
>>I hope sling:alias could be String[]. Even if I set sling:alias =
>>{png, gif, tiff}.. only the first entry, png, is used.
>>
>>For example,
>>/some/path/jpeg (sling:alias = {png, gif, tiff})
>>
>>then,
>>GET /some/path/jpeg.json ==> good
>>GET /some/path/png.json ==> good
>>GET /some/path/gif.json ==> bad
>>GET /some/path/tiff.json ==> bad
>>
>>I ended up writing /etc/map config to redirect stuff to
>>/some/path/jpeg (according to
>>http://sling.apache.org/site/mappings-for-resource-resolution.html)
>>
>>I tried mix:shareable .. it was a nightmare since I did not back up
>>the node before setting mixin.. And it's impossible to remove
>>mix:shareable mixin :P
>>
>>SLING-1778 looks promising. I can't apply patches. I'm using Day CQ
>>and have to wait until they apply the patch to the sling they ship
>>with.
>>
>>Thanks.
>>Sam
>>
>>On Wed, Nov 3, 2010 at 10:02 AM, Justin Edelson
>><ju...@justinedelson.com> wrote:
>>> Hi...
>>>
>>> sling:alias only works within the same path segment, i.e. if
>>>
>>> /some/path/jpeg@sling:alias = jpg
>>>
>>> then you could request either /some/path/jpeg or /some/path/jpg and
>>> get the resource at /some/path/jpeg.
>>>
>>> JCR 2 Shareable Nodes might be a solution for you. Or take a look at
>>>SLING-1778.
>>>
>>> Justin
>>>
>>>
>>> On Tue, Nov 2, 2010 at 4:07 PM, sam lee <sk...@gmail.com> wrote:
>>>> Hey,
>>>>
>>>> I want:
>>>> GET /some/path/jpeg.tidy.infinity.json
>>>>
>>>> to be equivalent to:
>>>> GET /some/other/path/foo.tidy.infinity.json
>>>>
>>>> I tried:
>>>> /some/path/jpeg/sling:resourceType = /some/other/path/foo
>>>> and
>>>> /some/path/jpeg/sling:resourceSuperType = /some/other/path/foo
>>>>
>>>> but, the json returned by
>>>> GET /some/path/jpeg.tidy.infinity.json
>>>> is not same as the json returned by
>>>> GET /some/other/path/foo.tidy.inifinity.json
>>>>
>>>> Should I use something other than sling:resourceType ?
>>>> sling:alias?
>>>>
>>>> Thanks.
>>>> Sam
>>>>
>>>
>
>
>
Re: alias or reference?
Posted by Julian Sedding <js...@gmail.com>.
Hi Sam
Regarding SLING-1778: it's not feasible to leverage the SLING-1778 features
for all aspects within CQ5, as some of the CQ5 features directly access the
JCR API and thus the ResourceProvider magic happening in Sling is not
effective. This is especially true for page nodes.
If the nodes you're using are fully controlled by your application, you can
try building the symlinks bundle from the SLING-1778 patch and install it.
It's self-contained and IIRC there are no dependency issues in CQ5.3. So no
patching or updating of bundles delivered with CQ should be required. Only
the symlinks bundle would then be at your responsibility.
Regards
Julian
On Fri, Nov 5, 2010 at 8:25 PM, sam lee <sk...@gmail.com> wrote:
> Ah, Thank you. I see.
>
> I hope sling:alias could be String[]. Even if I set sling:alias =
> {png, gif, tiff}.. only the first entry, png, is used.
>
> For example,
> /some/path/jpeg (sling:alias = {png, gif, tiff})
>
> then,
> GET /some/path/jpeg.json ==> good
> GET /some/path/png.json ==> good
> GET /some/path/gif.json ==> bad
> GET /some/path/tiff.json ==> bad
>
> I ended up writing /etc/map config to redirect stuff to
> /some/path/jpeg (according to
> http://sling.apache.org/site/mappings-for-resource-resolution.html)
>
> I tried mix:shareable .. it was a nightmare since I did not back up
> the node before setting mixin.. And it's impossible to remove
> mix:shareable mixin :P
>
> SLING-1778 looks promising. I can't apply patches. I'm using Day CQ
> and have to wait until they apply the patch to the sling they ship
> with.
>
> Thanks.
> Sam
>
> On Wed, Nov 3, 2010 at 10:02 AM, Justin Edelson
> <ju...@justinedelson.com> wrote:
> > Hi...
> >
> > sling:alias only works within the same path segment, i.e. if
> >
> > /some/path/jpeg@sling:alias = jpg
> >
> > then you could request either /some/path/jpeg or /some/path/jpg and
> > get the resource at /some/path/jpeg.
> >
> > JCR 2 Shareable Nodes might be a solution for you. Or take a look at
> SLING-1778.
> >
> > Justin
> >
> >
> > On Tue, Nov 2, 2010 at 4:07 PM, sam lee <sk...@gmail.com> wrote:
> >> Hey,
> >>
> >> I want:
> >> GET /some/path/jpeg.tidy.infinity.json
> >>
> >> to be equivalent to:
> >> GET /some/other/path/foo.tidy.infinity.json
> >>
> >> I tried:
> >> /some/path/jpeg/sling:resourceType = /some/other/path/foo
> >> and
> >> /some/path/jpeg/sling:resourceSuperType = /some/other/path/foo
> >>
> >> but, the json returned by
> >> GET /some/path/jpeg.tidy.infinity.json
> >> is not same as the json returned by
> >> GET /some/other/path/foo.tidy.inifinity.json
> >>
> >> Should I use something other than sling:resourceType ?
> >> sling:alias?
> >>
> >> Thanks.
> >> Sam
> >>
> >
>
Re: alias or reference?
Posted by Justin Edelson <ju...@justinedelson.com>.
Was there some reason that shareable nodes didn't work? Or are you simply
opposed to them because mix:shareable can't be removed?
Multi-valued sling:alias support was added in SLING-1332 and will be in
the next release of the JCR Resource bundle.
Justin
On 11/5/10 3:25 PM, "sam lee" <sk...@gmail.com> wrote:
>Ah, Thank you. I see.
>
>I hope sling:alias could be String[]. Even if I set sling:alias =
>{png, gif, tiff}.. only the first entry, png, is used.
>
>For example,
>/some/path/jpeg (sling:alias = {png, gif, tiff})
>
>then,
>GET /some/path/jpeg.json ==> good
>GET /some/path/png.json ==> good
>GET /some/path/gif.json ==> bad
>GET /some/path/tiff.json ==> bad
>
>I ended up writing /etc/map config to redirect stuff to
>/some/path/jpeg (according to
>http://sling.apache.org/site/mappings-for-resource-resolution.html)
>
>I tried mix:shareable .. it was a nightmare since I did not back up
>the node before setting mixin.. And it's impossible to remove
>mix:shareable mixin :P
>
>SLING-1778 looks promising. I can't apply patches. I'm using Day CQ
>and have to wait until they apply the patch to the sling they ship
>with.
>
>Thanks.
>Sam
>
>On Wed, Nov 3, 2010 at 10:02 AM, Justin Edelson
><ju...@justinedelson.com> wrote:
>> Hi...
>>
>> sling:alias only works within the same path segment, i.e. if
>>
>> /some/path/jpeg@sling:alias = jpg
>>
>> then you could request either /some/path/jpeg or /some/path/jpg and
>> get the resource at /some/path/jpeg.
>>
>> JCR 2 Shareable Nodes might be a solution for you. Or take a look at
>>SLING-1778.
>>
>> Justin
>>
>>
>> On Tue, Nov 2, 2010 at 4:07 PM, sam lee <sk...@gmail.com> wrote:
>>> Hey,
>>>
>>> I want:
>>> GET /some/path/jpeg.tidy.infinity.json
>>>
>>> to be equivalent to:
>>> GET /some/other/path/foo.tidy.infinity.json
>>>
>>> I tried:
>>> /some/path/jpeg/sling:resourceType = /some/other/path/foo
>>> and
>>> /some/path/jpeg/sling:resourceSuperType = /some/other/path/foo
>>>
>>> but, the json returned by
>>> GET /some/path/jpeg.tidy.infinity.json
>>> is not same as the json returned by
>>> GET /some/other/path/foo.tidy.inifinity.json
>>>
>>> Should I use something other than sling:resourceType ?
>>> sling:alias?
>>>
>>> Thanks.
>>> Sam
>>>
>>
Re: alias or reference?
Posted by sam lee <sk...@gmail.com>.
Ah, Thank you. I see.
I hope sling:alias could be String[]. Even if I set sling:alias =
{png, gif, tiff}.. only the first entry, png, is used.
For example,
/some/path/jpeg (sling:alias = {png, gif, tiff})
then,
GET /some/path/jpeg.json ==> good
GET /some/path/png.json ==> good
GET /some/path/gif.json ==> bad
GET /some/path/tiff.json ==> bad
I ended up writing /etc/map config to redirect stuff to
/some/path/jpeg (according to
http://sling.apache.org/site/mappings-for-resource-resolution.html)
I tried mix:shareable .. it was a nightmare since I did not back up
the node before setting mixin.. And it's impossible to remove
mix:shareable mixin :P
SLING-1778 looks promising. I can't apply patches. I'm using Day CQ
and have to wait until they apply the patch to the sling they ship
with.
Thanks.
Sam
On Wed, Nov 3, 2010 at 10:02 AM, Justin Edelson
<ju...@justinedelson.com> wrote:
> Hi...
>
> sling:alias only works within the same path segment, i.e. if
>
> /some/path/jpeg@sling:alias = jpg
>
> then you could request either /some/path/jpeg or /some/path/jpg and
> get the resource at /some/path/jpeg.
>
> JCR 2 Shareable Nodes might be a solution for you. Or take a look at SLING-1778.
>
> Justin
>
>
> On Tue, Nov 2, 2010 at 4:07 PM, sam lee <sk...@gmail.com> wrote:
>> Hey,
>>
>> I want:
>> GET /some/path/jpeg.tidy.infinity.json
>>
>> to be equivalent to:
>> GET /some/other/path/foo.tidy.infinity.json
>>
>> I tried:
>> /some/path/jpeg/sling:resourceType = /some/other/path/foo
>> and
>> /some/path/jpeg/sling:resourceSuperType = /some/other/path/foo
>>
>> but, the json returned by
>> GET /some/path/jpeg.tidy.infinity.json
>> is not same as the json returned by
>> GET /some/other/path/foo.tidy.inifinity.json
>>
>> Should I use something other than sling:resourceType ?
>> sling:alias?
>>
>> Thanks.
>> Sam
>>
>
Re: alias or reference?
Posted by Justin Edelson <ju...@justinedelson.com>.
Hi...
sling:alias only works within the same path segment, i.e. if
/some/path/jpeg@sling:alias = jpg
then you could request either /some/path/jpeg or /some/path/jpg and
get the resource at /some/path/jpeg.
JCR 2 Shareable Nodes might be a solution for you. Or take a look at SLING-1778.
Justin
On Tue, Nov 2, 2010 at 4:07 PM, sam lee <sk...@gmail.com> wrote:
> Hey,
>
> I want:
> GET /some/path/jpeg.tidy.infinity.json
>
> to be equivalent to:
> GET /some/other/path/foo.tidy.infinity.json
>
> I tried:
> /some/path/jpeg/sling:resourceType = /some/other/path/foo
> and
> /some/path/jpeg/sling:resourceSuperType = /some/other/path/foo
>
> but, the json returned by
> GET /some/path/jpeg.tidy.infinity.json
> is not same as the json returned by
> GET /some/other/path/foo.tidy.inifinity.json
>
> Should I use something other than sling:resourceType ?
> sling:alias?
>
> Thanks.
> Sam
>