sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Edelson <jus...@justinedelson.com>
Subject Re: Templating without a SlingRequest
Date Tue, 27 Jun 2017 22:33:32 GMT
Hi,
Yes, this is possible via the SlingRequestProcessor service[1]. You need to
construct "fake" request and response objects which provide the information
needed to execute the script/servlet. You can use [2] for these
request/response objects or roll your own.

Regards,
Justin

[1]
https://sling.apache.org/apidocs/sling6/org/apache/sling/engine/SlingRequestProcessor.html
[2] http://sling.apache.org/documentation/bundles/servlet-helpers.html

On Tue, Jun 27, 2017 at 6:26 PM Hakim Sadikali <
hakim.sadikali@contentthread.com> wrote:

> Hi,
>
> Is it possible to dispatch/include a templating file (HTL/JSP) from within
> an OSGi service?
>
> Here is the use-case:
>
> 1. Nightly schedule job that finds all resources that have expired
> 2. Create an email with the content of the resources (title/path/links etc)
> 3. Send the email to a user for them to act on it.
>
> You could easily create a static email and then build on top of that, but
> since sling is already a templating engine it would be great if you could
> leverage that to generate the email by invoking a script with the
> parameters passed in. I believe earlier versions of the Health Check had
> something similar setup.
>
> Hakim
>
> --
> --
> Hakim Sadikali
> CQ Architect
> Content Thread
> mailto: hakim.sadikali@contentthread.com
> mobile: +1-647-205-6941 <(647)%20205-6941>
> office: +1-888-240-1467 <(888)%20240-1467>
> -------------------------------------------------
> CONFIDENTIALITY NOTICE:
> This email, including any attachments, may contain legally confidential,
> privileged and proprietary information.  It is intended only for the named
> recipient(s); if you are not the named recipient(s) you are not authorized
> to copy, print, share, save or rely upon any portion of this
> communication.  If you are not the named recipient and/or have received
> this information in error please immediately notify the sender and delete
> this email and any attachments.  Thank you.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message