You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@freemarker.apache.org by Daniel Dekany <da...@gmail.com> on 2021/02/09 08:03:03 UTC

Maybe freemarker-generator data sources shouldn't be URL-s Re: [freemarker-generator] branch FREEMARKER-154 updated: FREEMARKER-154 Fixed the HTTP URL invocation by setting an explicit charset

I'm sure I have said this in the past... but anyway, this commit reminded
me. I think these URL tricks are quite confusing for the users: {{page=
http://www.google.com#charset=ISO-8859-1}}. Many (most?) will think the
charset part is something that google.com will interpret. I bet most won't
be sure if the anchor part is sent to the server (it never is).

Also I don't see how URL as the way to describe data sources will scale.
Like what if a data source can't be naturally described with an URL? So at
the end, if something is naturally an URL, then adding hacks to it is
confusing, as above, and if something not naturally an URL, then forcing
URL syntax on it with a fake schema (fake in the sense that the URL API-s
can't actually resolve it) is again confusing, or just not nice.

On Tue, Feb 9, 2021 at 12:09 AM <sg...@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> sgoeschl pushed a commit to branch FREEMARKER-154
> in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git
>
>
> The following commit(s) were added to refs/heads/FREEMARKER-154 by this
> push:
>      new e53f96f  FREEMARKER-154 Fixed the HTTP URL invocation by setting
> an explicit charset
> e53f96f is described below
>
> commit e53f96f92dad5e2eda55106ceda64b25877981da
> Author: Siegfried Goeschl <si...@gmail.com>
> AuthorDate: Tue Feb 9 00:07:56 2021 +0100
>
>     FREEMARKER-154 Fixed the HTTP URL invocation by setting an explicit
> charset
> ---
>  freemarker-generator-website/src/main/docgen/book.xml | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/freemarker-generator-website/src/main/docgen/book.xml
> b/freemarker-generator-website/src/main/docgen/book.xml
> index 88f97bd..08119ec 100644
> --- a/freemarker-generator-website/src/main/docgen/book.xml
> +++ b/freemarker-generator-website/src/main/docgen/book.xml
> @@ -962,13 +962,13 @@ freemarker-generator -t
> freemarker-generator/info.ftl my_users=[docgen:wd]/examp
>        used:</para>
>
>        <programlisting>[docgen.insertOutput from="FreeMarker Generator
> DataSources" to=r"^\s*$" printCommand=true]
> -freemarker-generator -t freemarker-generator/info.ftl
> http://google.com?foo=bar
> +freemarker-generator <http://google.com?foo=bar+freemarker-generator> -t
> freemarker-generator/info.ftl https://www.google.com#charset=ISO-8859-1
>  [/docgen.insertOutput]</programlisting>
>
>        <para>and also combined with a name:</para>
>
>        <programlisting>[docgen.insertOutput from="FreeMarker Generator
> DataSources" to=r"^\s*$" printCommand=true]
> -freemarker-generator -t freemarker-generator/info.ftl page=
> http://google.com?foo=bar
> +freemarker-generator <http://google.com?foo=bar+freemarker-generator> -t
> freemarker-generator/info.ftl page=
> http://www.google.com#charset=ISO-8859-1
>  [/docgen.insertOutput]</programlisting>
>      </section>
>
>
>

-- 
Best regards,
Daniel Dekany

Re: Maybe freemarker-generator data sources shouldn't be URL-s Re: [freemarker-generator] branch FREEMARKER-154 updated: FREEMARKER-154 Fixed the HTTP URL invocation by setting an explicit charset

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Daniel,

I think you did not mention it before - or I forgot it :-)

Technically I’m using URIs here with support of ordinary strings (without URI scheme) interpreted as 

https://github.com/apache/freemarker-generator/blob/master/freemarker-generator-cli/src/site/markdown/cli/concepts/named-uris.md <https://github.com/apache/freemarker-generator/blob/master/freemarker-generator-cli/src/site/markdown/cli/concepts/named-uris.md>
https://github.com/apache/freemarker-generator/blob/master/freemarker-generator-cli/src/site/markdown/cli/concepts/data-sources.md <https://github.com/apache/freemarker-generator/blob/master/freemarker-generator-cli/src/site/markdown/cli/concepts/data-sources.md> 

With URIs the following data sources are supported

* examples/data/csv/user.csv (technically not a URI)
* file:/some/absolute/path/examples/data/csv/user.csv
* https://xkcd.com/info.0.json 
* env:///DB_CONFIG#mimetType=application/json <env:///DB_CONFIG#mimetType=application/json>


And with additional “DataSourceLoaders” it is possible to support other protocols, e.g

* s3://mybucket/config/file.json <s3://mybucket/config/file.json>

Cheers,

Siegfried Goeschl

> On 9 Feb 2021, at 09:03, Daniel Dekany <da...@gmail.com> wrote:
> 
> I'm sure I have said this in the past... but anyway, this commit reminded
> me. I think these URL tricks are quite confusing for the users: {{page=
> http://www.google.com#charset=ISO-8859-1}}. Many (most?) will think the
> charset part is something that google.com will interpret. I bet most won't
> be sure if the anchor part is sent to the server (it never is).
> 
> Also I don't see how URL as the way to describe data sources will scale.
> Like what if a data source can't be naturally described with an URL? So at
> the end, if something is naturally an URL, then adding hacks to it is
> confusing, as above, and if something not naturally an URL, then forcing
> URL syntax on it with a fake schema (fake in the sense that the URL API-s
> can't actually resolve it) is again confusing, or just not nice.
> 
> On Tue, Feb 9, 2021 at 12:09 AM <sg...@apache.org> wrote:
> 
>> This is an automated email from the ASF dual-hosted git repository.
>> 
>> sgoeschl pushed a commit to branch FREEMARKER-154
>> in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git
>> 
>> 
>> The following commit(s) were added to refs/heads/FREEMARKER-154 by this
>> push:
>>     new e53f96f  FREEMARKER-154 Fixed the HTTP URL invocation by setting
>> an explicit charset
>> e53f96f is described below
>> 
>> commit e53f96f92dad5e2eda55106ceda64b25877981da
>> Author: Siegfried Goeschl <si...@gmail.com>
>> AuthorDate: Tue Feb 9 00:07:56 2021 +0100
>> 
>>    FREEMARKER-154 Fixed the HTTP URL invocation by setting an explicit
>> charset
>> ---
>> freemarker-generator-website/src/main/docgen/book.xml | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/freemarker-generator-website/src/main/docgen/book.xml
>> b/freemarker-generator-website/src/main/docgen/book.xml
>> index 88f97bd..08119ec 100644
>> --- a/freemarker-generator-website/src/main/docgen/book.xml
>> +++ b/freemarker-generator-website/src/main/docgen/book.xml
>> @@ -962,13 +962,13 @@ freemarker-generator -t
>> freemarker-generator/info.ftl my_users=[docgen:wd]/examp
>>       used:</para>
>> 
>>       <programlisting>[docgen.insertOutput from="FreeMarker Generator
>> DataSources" to=r"^\s*$" printCommand=true]
>> -freemarker-generator -t freemarker-generator/info.ftl
>> http://google.com?foo=bar
>> +freemarker-generator <http://google.com?foo=bar+freemarker-generator> -t
>> freemarker-generator/info.ftl https://www.google.com#charset=ISO-8859-1
>> [/docgen.insertOutput]</programlisting>
>> 
>>       <para>and also combined with a name:</para>
>> 
>>       <programlisting>[docgen.insertOutput from="FreeMarker Generator
>> DataSources" to=r"^\s*$" printCommand=true]
>> -freemarker-generator -t freemarker-generator/info.ftl page=
>> http://google.com?foo=bar
>> +freemarker-generator <http://google.com?foo=bar+freemarker-generator> -t
>> freemarker-generator/info.ftl page=
>> http://www.google.com#charset=ISO-8859-1
>> [/docgen.insertOutput]</programlisting>
>>     </section>
>> 
>> 
>> 
> 
> -- 
> Best regards,
> Daniel Dekany