you will have to create a TextTemplateResource to serve such resources
and a TextTemplateResourceReference to create urls for them.

-igor

On Sun, Apr 18, 2010 at 8:25 PM, Ralf Eichinger
<[email protected]> wrote:
> How to change
>
> add(JavascriptPackageResource.getHeaderContribution(this.getClass(),
>  "js/lightbox.js"));
>
> so that variables inside "lightbox.js" are replace on delivery?
>
> I tried something like this:
>
> PackagedTextTemplate jsTemplate = new PackagedTextTemplate(this
>                                .getClass(), "js/lightbox.js");
> TextTemplateSharedResourceFactory resourceReference = new
> TextTemplateSharedResourceFactory(jsTemplate, this.getClass());
>
> String webappContext = WebApplication.get().getServletContext()
>                                .getContextPath();
> Map<String, Object> parameters = new HashMap<String, Object>();
> parameters.put("webappContext", webappContext);
> TextTemplateLink ref = new TextTemplateLink("", resourceReference,
>                                parameters);
> ??? what to do with link ???
>
> or when I try
>
> ...
> add(TextTemplateHeaderContributor.forJavaScript(jsTemplate, new
> Model((Serializable) parameters)));
>
> the content is rendered into head, what I do not want.
> I just want a header contribution to a parsed template like this:
> <script type="text/javascript" src="..."></script>
>
> Any ideas?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to