Question
· Jun 13

Include CSP in CLS.

Is there any way to include a CSP page within a CLS?
Example: #Include file.csp 

Context: I work with a legacy that most screens are built using only CLS. I'm trying to change this by separating the frontend layers to be built only with CSP and backend layers using CLS. I improvised a method that injects an iframe to render the CSP in CLS through that iframe, but I'm still not happy. I need to know if there is any way to include this CSP using some specific resource for this.

Product version: Ensemble 2018.1
Discussion (15)3
Log in or sign up to continue

if you are wanting to completely render the page within the context of another page, then using <iframe src="package.page.csp" </iframe> is going to be your best bet.  Remember that a csp page isn't just a static HTML snippet - it is an entire renderable page, along with pre-page headers, etc.  That is why OnPreHttp(), OnBody() and OnPostHttp() are all included in the page framework for a .csp.  If you simply want to show what is 'rendered' when you call the page directly, you can play with calling OnPage() (which contains the compiled version of the entire body of your .csp file), but that may not operate correctly when called in isolation - it is intended to be called as part of a full pageload process, which the iframe approach above would provide.

I don't understand your question in the context of the original question:

"I work with a legacy that most screens are built using only CLS"

If you want to rewrite using modern approach, then use your favorite front-end framework and implement  a REST API in the Caché backend.......and maybe move from legacy Caché/Ensemble to modern IRIS as well...