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/05 14:24:01 UTC
direct script execution
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?
--
Torgeir Veimo
torgeir@pobox.com
Re: direct script execution
Posted by Torgeir Veimo <to...@pobox.com>.
On 6 Jan 2009, at 07:19, Felix Meschberger wrote:
> Hi Torgeir,
>
> Torgeir Veimo schrieb:
>> 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?
>
> This is not currently possible (though the implementation would be
> rather simple).
>
> The problem is that we also support WebDAV on "/" through the Sling
> WebDAV bundle. So, for WebDAV we might want to expect the script to be
> returned as plaintext to be able to edit and modify it.
>
> I could imagine two options: (1) we add a configuration setting, which
> controls whether scripts are executed or not or (2) add a servlet to
> handle a special extension, which would execute the script. I would
> prefer this second option.
Maybe it could be possible to set a resource type, sling:Script on
these, to allow execution? They could be edited if accessed through
the /dav/ prefix.
--
Torgeir Veimo
torgeir@pobox.com
Re: direct script execution
Posted by Felix Meschberger <fm...@gmail.com>.
Hi Torgeir,
Torgeir Veimo schrieb:
> 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?
This is not currently possible (though the implementation would be
rather simple).
The problem is that we also support WebDAV on "/" through the Sling
WebDAV bundle. So, for WebDAV we might want to expect the script to be
returned as plaintext to be able to edit and modify it.
I could imagine two options: (1) we add a configuration setting, which
controls whether scripts are executed or not or (2) add a servlet to
handle a special extension, which would execute the script. I would
prefer this second option.
The servlet would have a rather simple service() method implementation:
public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException {
Servlet servlet = ((SlingHttpServletRequest) req).
getResource.adaptTo(Servlet.class);
if (servlet != null) {
servlet.service(req, res);
} else {
// send error
}
}
Regards
Felix