very minor issue with freemarker ContextTemplateLoader

3 messages Options
Embed this post
Permalink
Stoph

very minor issue with freemarker ContextTemplateLoader

Reply Threaded More More options
Print post
Permalink
I am using Restlet with the included Freemarker integration and it's working very well. I have found a minor issue when using the ContextTemplateLoader.

File URIs given to the ContextTemplateLoader must not include the colon, i.e. use file://c/ instead of file://c:/

Otherwise you get a screen full of this warning:

[java] WARNING: Can't parse hostPort : [hostRef,requestUri]=[null,file://c:/my/path/src/mypackage/templates/user_en_US.html]
Thierry Boileau

Re: very minor issue with freemarker ContextTemplateLoader

Reply Threaded More More options
Print post
Permalink
Hello Stoph,

Thanks a lot for reporting this issue.
I've entered a new issue for this:
http://restlet.tigris.org/issues/show_bug.cgi?id=858

Best regards,
Thierry Boileau

> I am using Restlet with the included Freemarker integration and it's working
> very well. I have found a minor issue when using the ContextTemplateLoader.
>
> File URIs given to the ContextTemplateLoader must not include the colon,
> i.e. use file://c/ instead of file://c:/
>
> Otherwise you get a screen full of this warning:
>
> [java] WARNING: Can't parse hostPort :
> [hostRef,requestUri]=[null,file://c:/my/path/src/mypackage/templates/user_en_US.html]
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2376593
Thierry Boileau

RE: Re: very minor issue with freemarker ContextTemplateLoader

Reply Threaded More More options
Print post
Permalink
Hello Stoph,

actually, the message is correct and points to the fact the the URI is not very well constructed.
Basically and very quickly, the URIs are parsed using this pattern:
protocol://[host[:port]]/path.
When using the FILE protocol, we estimate there is no host part which leads to handle this kind of URIs:
file:///c:/my/​path/src/mypackage/...

Please note the starting part "file:///" which contains three "/" characters instead of two as you imagined...
You can also rely on the LocalReference#create* methods in order to build your URIs.

Best regards,
Thierry Boileau

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413719