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 2011/03/03 20:17:13 UTC

implicit sling:resourceType?

Hey,

I have a node:

/content/page

whose sling:resourceType = "/apps/foo/bar"

So,  GET /content/page.html  will be handled by /apps/foo/bar/html.jsp

I cannot modify sling:resourceType of /content/page.

However, I would like GET /content/page.edit.html  to be handled by
/apps/foo/bar2/edit.html.jsp

Is this possible? I cannot modify /apps/foo/bar  and /content/page. But I
want .edit.html to be handled by /apps/foo/bar2.

Should I add a servlet with:
sling.servlet.resourceTypes = sling/servlet/default
sling.servlet.selectors = edit

to capture all .edit.html  and somehow "call" /apps/foo/bar2/edit.html.jsp
?  (maybe a redirect?)

Re: implicit sling:resourceType?

Posted by Julian Sedding <js...@gmail.com>.
Hi Sam

I think the RequestDispatcherOptions[0] might be what you're looking
for. It allows you to control certain aspects of re-dispatching
("forwarding" and "including") a request, including forcing a
different resource type. You could use this API in a servlet
registered for the "edit" selector, as you suggested.

Regards
Julian

[0] http://sling.apache.org/apidocs/sling5/org/apache/sling/api/request/RequestDispatcherOptions.html



On Thu, Mar 3, 2011 at 8:17 PM, sam lee <sk...@gmail.com> wrote:
> Hey,
>
> I have a node:
>
> /content/page
>
> whose sling:resourceType = "/apps/foo/bar"
>
> So,  GET /content/page.html  will be handled by /apps/foo/bar/html.jsp
>
> I cannot modify sling:resourceType of /content/page.
>
> However, I would like GET /content/page.edit.html  to be handled by
> /apps/foo/bar2/edit.html.jsp
>
> Is this possible? I cannot modify /apps/foo/bar  and /content/page. But I
> want .edit.html to be handled by /apps/foo/bar2.
>
> Should I add a servlet with:
> sling.servlet.resourceTypes = sling/servlet/default
> sling.servlet.selectors = edit
>
> to capture all .edit.html  and somehow "call" /apps/foo/bar2/edit.html.jsp
> ?  (maybe a redirect?)
>

Re: implicit sling:resourceType?

Posted by Sarwar Bhuiyan <sa...@gmail.com>.
Hi Sam,

Why does it have to be handled by /apps/foo/bar2?  In your /apps/foo/bar,
create a jsp called edit.jsp and you're done because that one will be called
based on your "edit" selector when you call /content/page.edit.html  What is
the reasoning behind another component handling your edits?



Sarwar


On Thu, Mar 3, 2011 at 7:17 PM, sam lee <sk...@gmail.com> wrote:

> Hey,
>
> I have a node:
>
> /content/page
>
> whose sling:resourceType = "/apps/foo/bar"
>
> So,  GET /content/page.html  will be handled by /apps/foo/bar/html.jsp
>
> I cannot modify sling:resourceType of /content/page.
>
> However, I would like GET /content/page.edit.html  to be handled by
> /apps/foo/bar2/edit.html.jsp
>
> Is this possible? I cannot modify /apps/foo/bar  and /content/page. But I
> want .edit.html to be handled by /apps/foo/bar2.
>
> Should I add a servlet with:
> sling.servlet.resourceTypes = sling/servlet/default
> sling.servlet.selectors = edit
>
> to capture all .edit.html  and somehow "call" /apps/foo/bar2/edit.html.jsp
> ?  (maybe a redirect?)
>