You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Torgeir Veimo <to...@pobox.com> on 2009/01/02 09:44:34 UTC

script selector when resource has no resourceType property

Is it possible to use non-default scripts for resources that have no  
resourceType property?

Also, is it possible to request a script directly, eg. use a request  
such as /apps/notes/html.esp, and make that script execute instead of  
being returned as plaintext?

The document at http://cwiki.apache.org/SLING/url-to-script-resolution.html 
  is desperately lacking in examples..

-- 
Torgeir Veimo
torgeir@pobox.com





Re: script selector when resource has no resourceType property

Posted by Felix Meschberger <fm...@gmail.com>.
Hmm, I should not write mails too fast ....

Felix Meschberger schrieb:
> I have created https://issues.apache.org/jira/browse/SLING-815 to track
> this.

This issue is not related to this thrad. Sorry for the confusion.

Regards
Felix

> 
> Regards
> Felix
> 
> Bertrand Delacretaz schrieb:
>> Hi,
>>
>> On Sat, Jan 3, 2009 at 5:21 AM, Torgeir Veimo <to...@pobox.com> wrote:
>>> ...Ok, I found the configuration for DefaultResourceTypeProvider. However,
>>> looking at the source for this component, it seem to be used only for node
>>> types of type nt:unstructured?...
>> That's correct, and maybe that check is not really needed - I don't
>> remember off the top of my head if that check really takes place after
>> all other possibilities for defining the resource type have been
>> exhausted.
>>
>> You might want to try removing that check for nt:unstructured, and see
>> if the launchpad/testing tests still pass.
>>
>> -Bertrand
>>
>>> ...
>>> http://svn.apache.org/repos/asf/incubator/sling/trunk/samples/path-based-rtp/src/main/java/org/apache/sling/samples/pathbasedrtp/DefaultResourceTypeProvider.java...
> 

Re: script selector when resource has no resourceType property

Posted by Felix Meschberger <fm...@gmail.com>.
I have created https://issues.apache.org/jira/browse/SLING-815 to track
this.

Regards
Felix

Bertrand Delacretaz schrieb:
> Hi,
> 
> On Sat, Jan 3, 2009 at 5:21 AM, Torgeir Veimo <to...@pobox.com> wrote:
>> ...Ok, I found the configuration for DefaultResourceTypeProvider. However,
>> looking at the source for this component, it seem to be used only for node
>> types of type nt:unstructured?...
> 
> That's correct, and maybe that check is not really needed - I don't
> remember off the top of my head if that check really takes place after
> all other possibilities for defining the resource type have been
> exhausted.
> 
> You might want to try removing that check for nt:unstructured, and see
> if the launchpad/testing tests still pass.
> 
> -Bertrand
> 
>> ...
>> http://svn.apache.org/repos/asf/incubator/sling/trunk/samples/path-based-rtp/src/main/java/org/apache/sling/samples/pathbasedrtp/DefaultResourceTypeProvider.java...
> 

Re: script selector when resource has no resourceType property

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Wed, Jan 7, 2009 at 2:00 PM, Torgeir Veimo <to...@pobox.com> wrote:
> On 7 Jan 2009, at 22:25, Felix Meschberger wrote:
>>  * otherwise use primary node type
> Shouldn't node type determination be scriptable like other things in sling?

You could implement that in a custom JcrResourceTypeProvider that uses scripts.

That might be useful for legacy applications, but I'm not sure about
making that standard in Sling, that might make things much harder to
follow.

-Bertrand

Re: script selector when resource has no resourceType property

Posted by Torgeir Veimo <to...@pobox.com>.
On 7 Jan 2009, at 22:25, Felix Meschberger wrote:

>  * otherwise use primary node type


Shouldn't node type determination be scriptable like other things in  
sling?

-- 
Torgeir Veimo
torgeir@pobox.com





Re: script selector when resource has no resourceType property

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Bertrand Delacretaz schrieb:
> Hi,
> 
> On Sat, Jan 3, 2009 at 5:21 AM, Torgeir Veimo <to...@pobox.com> wrote:
>> ...Ok, I found the configuration for DefaultResourceTypeProvider. However,
>> looking at the source for this component, it seem to be used only for node
>> types of type nt:unstructured?...
> 
> That's correct, and maybe that check is not really needed - I don't
> remember off the top of my head if that check really takes place after
> all other possibilities for defining the resource type have been
> exhausted.

Resource Type resolution for JCR-based resources takes these three steps:

  * check slign:resourceType property
  * otherwise check ResourceTypeProviders
  * otherwise use primary node type

I could imagine, that the path-based resource type provider should be
taken if no more specific node type is used than nt:unstructured. For
example, you might - in some situations - want to is nt:file of a file
as the resource type and not the path based resource type.

Of course YMMV and the path based resource type provider might have to
be enhanced to use other selection criteria.

Regards
Felix

> 
> You might want to try removing that check for nt:unstructured, and see
> if the launchpad/testing tests still pass.
> 
> -Bertrand
> 
>> ...
>> http://svn.apache.org/repos/asf/incubator/sling/trunk/samples/path-based-rtp/src/main/java/org/apache/sling/samples/pathbasedrtp/DefaultResourceTypeProvider.java...
> 

Re: script selector when resource has no resourceType property

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Sat, Jan 3, 2009 at 5:21 AM, Torgeir Veimo <to...@pobox.com> wrote:
> ...Ok, I found the configuration for DefaultResourceTypeProvider. However,
> looking at the source for this component, it seem to be used only for node
> types of type nt:unstructured?...

That's correct, and maybe that check is not really needed - I don't
remember off the top of my head if that check really takes place after
all other possibilities for defining the resource type have been
exhausted.

You might want to try removing that check for nt:unstructured, and see
if the launchpad/testing tests still pass.

-Bertrand

> ...
> http://svn.apache.org/repos/asf/incubator/sling/trunk/samples/path-based-rtp/src/main/java/org/apache/sling/samples/pathbasedrtp/DefaultResourceTypeProvider.java...

Re: script selector when resource has no resourceType property

Posted by Torgeir Veimo <to...@pobox.com>.
On 3 Jan 2009, at 05:07, Felix Meschberger wrote:

>> "If the selected resource has no special resource type a script  
>> will be
>> looked up based on the content path. For example, the script for
>> /content/corporate/jobs.html will be searched in /apps/corporate."
>
> You have to make sure, the "Sample Path Based Resource Type Provider"
> (samples/path-based-rtp) is installed.

Ok, I found the configuration for DefaultResourceTypeProvider.  
However, looking at the source for this component, it seem to be used  
only for node types of type nt:unstructured?

http://svn.apache.org/repos/asf/incubator/sling/trunk/samples/path-based-rtp/src/main/java/org/apache/sling/samples/pathbasedrtp/DefaultResourceTypeProvider.java


-- 
Torgeir Veimo
torgeir@pobox.com





Re: script selector when resource has no resourceType property

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Torgeir Veimo schrieb:
> 
> On 2 Jan 2009, at 18:44, Torgeir Veimo wrote:
> 
>> Is it possible to use non-default scripts for resources that have no
>> resourceType property?
> 
> 
> According to
> http://dev.day.com/microsling/content/blogs/main/slingrequestprocessrevisited.html,
> requesting /content/notes.html should end up in executing the script
> /apps/notes/html.esp? It doesn't seem to happen in my setup with current
> sling trunk. (I get a "Resource dumped by HtmlRendererServlet" page).
> 
> "If the selected resource has no special resource type a script will be
> looked up based on the content path. For example, the script for
> /content/corporate/jobs.html will be searched in /apps/corporate."

You have to make sure, the "Sample Path Based Resource Type Provider"
(samples/path-based-rtp) is installed.

> 
> That sentence, if still correct, should probably be added to
> http://cwiki.apache.org/SLING/url-to-script-resolution.html
> 

Yes, this is true.

Regards
Felix

Re: script selector when resource has no resourceType property

Posted by Torgeir Veimo <to...@pobox.com>.
On 2 Jan 2009, at 18:44, Torgeir Veimo wrote:

> Is it possible to use non-default scripts for resources that have no  
> resourceType property?


According to http://dev.day.com/microsling/content/blogs/main/slingrequestprocessrevisited.html 
, requesting /content/notes.html should end up in executing the  
script /apps/notes/html.esp? It doesn't seem to happen in my setup  
with current sling trunk. (I get a "Resource dumped by  
HtmlRendererServlet" page).

"If the selected resource has no special resource type a script will  
be looked up based on the content path. For example, the script for / 
content/corporate/jobs.html will be searched in /apps/corporate."

That sentence, if still correct, should probably be added to http://cwiki.apache.org/SLING/url-to-script-resolution.html

-- 
Torgeir Veimo
torgeir@pobox.com