Hi Felix,

Thank you for your reply.

I realized myself (after some Sling debugging) that
ServletResolver.resolveServlet(ResovlerResolver, String) is of no help to
me.
I'll get back to the drawing board now ;)

___________________________
Daniel Platon


On Wed, Aug 21, 2013 at 3:54 PM, Felix Meschberger-3 [via Apache Sling] <
[email protected]> wrote:

> Hi Daniel
>
> Am 20.08.2013 um 16:30 schrieb Daniel Platon:
>
> > Hi everyone,
> >
> > Q: How can I determine the script used to render a certain resource
> type?
> >
> > Details: I'm trying to do this in a JSP page (for my sling-explorer
> > project) so that the user can see what script renders a certain type of
> > content (a resourceType that is). This is what I tried so far:
> >
> > 1. Obtain a reference to a ServletResolver service using
> > ServletResolver servletResolver =
> sling.getService(ServletResolver.class);
> >
> > 2. Ask the service to "resolve" the resource type:
> > Servlet servlet =
> > servletResolver.resolveServlet(resourceResolver,"myapp/mytype")
>
> The ServletResource.resolveServlet(ResovlerResolver, String) method takes
> a (relative) script path as its second argument not a resource type. And
> since there is no script with this relative path in the ResourceResovler's
> search path, you won't get it.
>
> The method finding a script would be
> ServletResource.resolveServlet(SlingHttpServletRequest) which requires you
> to have a request object, which exposes the Resource whose resource type is
> used (and whose super resource type is also used). The request object also
> provides the method and selectors helping to decide on the script.
>
> Regards
> Felix
>
> >
> > but this returns null.
> >
> > Everything is in place: the script is there, the resource renders
> correctly
> > (the script is in /apps/myapp/mytype/mytype.jsp), it's just that the
> > resolver returns null when asked  to resolve a script.
> >
> > Is there another way (perhaps... the right way :) ) to do this?
> >
> > Thank you and have  a good day.
> > ___________________________
> > Daniel Platon
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-sling.73963.n3.nabble.com/Determine-the-rendering-script-by-resource-type-tp4026386p4026397.html
>  To start a new topic under Sling - Users, email
> [email protected]
> To unsubscribe from Apache Sling, click 
> here<http://apache-sling.73963.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=73963&code=ZHBsYXRvbkBnbWFpbC5jb218NzM5NjN8NTEwNzc3ODQ5>
> .
> NAML<http://apache-sling.73963.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Determine-the-rendering-script-by-resource-type-tp4026386p4026398.html
Sent from the Sling - Users mailing list archive at Nabble.com.

Reply via email to