commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terefang Verigorn (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JEXL-198) JxltEngine Template deos not expose pragmas
Date Mon, 06 Jun 2016 15:13:20 GMT

     [ https://issues.apache.org/jira/browse/JEXL-198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Terefang Verigorn updated JEXL-198:
-----------------------------------
    Description: 
JexlScript objects have a getPragmas() method which is awesome useful to communicate static
information after compilation/parsing but before evaluation.

JxltEngine.Template objects lack that method.

usage case: JexlServlet vs JexlTemplateServlet

JexlServlet/output-csv.jxp:
{code}
#pragma output-charset "UTF-8"
#pragma output-content-type "text/csv"

_out.println("col1;col2;col3;col4;col5");

for(row : _data)
{
_out.print(row.col1+";");
_out.print(row.col2+";");
_out.print(row.col3+";");
_out.print(row.col4+";");
_out.println(row.col5);
}
{code}


JexlTemplateServlet/output-csv.jxt:
{code}
$$ #pragma output-charset "UTF-8"
$$ #pragma output-content-type "text/csv"
col1;col2;col3;col4;col5
$$ for(row : _data) {
${row.col1};${row.col2};${row.col3};${row.col4};${row.col5}
$$ }
{code}

but since we cant get the pragmas from the template we have to write;
{code}
$$ http_request.setCharset("UTF-8");
$$ http_request.setContentType("text/csv");
col1;col2;col3;col4;col5
$$ for(row : _data) {
${row.col1};${row.col2};${row.col3};${row.col4};${row.col5}
$$ }
{code}

The actual case is that the templating engine cant be used "technology agnostic", as we might
want to use the same script for both http and mail (or sms, xmpp, etc) formatting

  was:
JexlScript objects have a getPragmas() method which is awesome useful to communicate static
information after compilation/parsing but before evaluation.

JxltEngine.Template objects lack that method.

usage case: JexlServlet vs JexlTemplateServlet

JexlServlet/output-csv.jxp:
{code}
#pragma output-charset "UTF-8"
#pragma output-content-type "text/csv"

_out.println("col1;col2;col3;col4;col5");

for(row : _data)
{
_out.print(row.col1+";");
_out.print(row.col2+";");
_out.print(row.col3+";");
_out.print(row.col4+";");
_out.println(row.col5);
}
{/code}


JexlTemplateServlet/output-csv.jxt:
{code}
$$ #pragma output-charset "UTF-8"
$$ #pragma output-content-type "text/csv"
col1;col2;col3;col4;col5
$$ for(row : _data) {
${row.col1};${row.col2};${row.col3};${row.col4};${row.col5}
$$ }
{/code}

but since we cant get the pragmas from the template we have to write;
{code}
$$ http_request.setCharset("UTF-8");
$$ http_request.setContentType("text/csv");
col1;col2;col3;col4;col5
$$ for(row : _data) {
${row.col1};${row.col2};${row.col3};${row.col4};${row.col5}
$$ }
{/code}

The actual case is that the templating engine cant be used "technology agnostic", as we might
want to use the same script for both http and mail (or sms, xmpp, etc) formatting


> JxltEngine Template deos not expose pragmas
> -------------------------------------------
>
>                 Key: JEXL-198
>                 URL: https://issues.apache.org/jira/browse/JEXL-198
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 3.0, 3.0.1, 3.1
>         Environment: any
>            Reporter: Terefang Verigorn
>            Priority: Minor
>
> JexlScript objects have a getPragmas() method which is awesome useful to communicate
static information after compilation/parsing but before evaluation.
> JxltEngine.Template objects lack that method.
> usage case: JexlServlet vs JexlTemplateServlet
> JexlServlet/output-csv.jxp:
> {code}
> #pragma output-charset "UTF-8"
> #pragma output-content-type "text/csv"
> _out.println("col1;col2;col3;col4;col5");
> for(row : _data)
> {
> _out.print(row.col1+";");
> _out.print(row.col2+";");
> _out.print(row.col3+";");
> _out.print(row.col4+";");
> _out.println(row.col5);
> }
> {code}
> JexlTemplateServlet/output-csv.jxt:
> {code}
> $$ #pragma output-charset "UTF-8"
> $$ #pragma output-content-type "text/csv"
> col1;col2;col3;col4;col5
> $$ for(row : _data) {
> ${row.col1};${row.col2};${row.col3};${row.col4};${row.col5}
> $$ }
> {code}
> but since we cant get the pragmas from the template we have to write;
> {code}
> $$ http_request.setCharset("UTF-8");
> $$ http_request.setContentType("text/csv");
> col1;col2;col3;col4;col5
> $$ for(row : _data) {
> ${row.col1};${row.col2};${row.col3};${row.col4};${row.col5}
> $$ }
> {code}
> The actual case is that the templating engine cant be used "technology agnostic", as
we might want to use the same script for both http and mail (or sms, xmpp, etc) formatting



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message