Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify missing web resources during wisdom:run #247

Open
Riduidel opened this issue Jun 29, 2014 · 7 comments
Open

Identify missing web resources during wisdom:run #247

Riduidel opened this issue Jun 29, 2014 · 7 comments

Comments

@Riduidel
Copy link
Contributor

When updating an HTML file, it would be of great help to have wisdom identify missing ressources, be them scripts or images.

Typically, I would like to have wisdom:run show me the missing assets in the console.
Ideally, that error message would use data provided by #245 to show available ressources (or a subset of them if possible).

I guess it could be possible to do it using a wisdom Watcher, no ? (don't yet know how to do it, however)

@cescoffier
Copy link
Member

Do you mean logging a message when the resource controller and the webjar controller (these two controllers are serving respectively the assets and the webjar resources) can't find the requested assets ?

To do this, no need for a watcher.

@Riduidel
Copy link
Contributor Author

Riduidel commented Jul 1, 2014

On 30/06/2014 19:01, Clement Escoffier wrote:

Do you mean logging a message when the resource controller and the
webjar controller (these two controllers are serving respectively the
assets and the webjar resources) can't find the requested assets ?

No.
Well .... when thinking about it, it may be a yes.
Let me rephrase it.

My issue was that I was writing an HTML page using angular.js script.
And, dumb as I am, I was unable to locate it.
So i tried
libs/angular/angular.js
and other paths, but none resulted into what I wanted.
So I tried to see that issue fro the developper stand point, and told to
myself "well, if I was in Eclipse, i would have an error marker for
that". Which immediatly sent me into the watcher direction :

what I want is that, when I save an HTML page, contained links are
(<script src="..."/>, , and even and
) are analyzed, and each missing target is displayed in
an error message, with possible replacements alongside.

This led me into the Watcher direction.
Unfortunatly, as you wrote

Unfortunately, because of the dynamics of Wisdom Framework, you
cannot retrieve / compute the route at package time

So I guess logging bad resources paths in the resource and webjar
controller would be a good start. But onluy a start, as it requires me
to modify my HTML file, then go into my browser to reload it.

Nicolas Delsaux

@cescoffier
Copy link
Member

Oh I see !

Actually, it might be possible if you are only looking for self-contained application (an application containing all its assets). In that case you can check / deduce what are the available assets and generate a pipeline error is something is missing.

@cescoffier
Copy link
Member

Just for information, in #13 we have extended the route object injected in template to compute the url of assets as follows:

<link th:href="${#routes.asset('css/bootstrap.min.css')}" rel="stylesheet"/>
<link th:href="${#routes.asset('/css/bootstrap-theme.min.css')}" rel="stylesheet"/>
<script th:src="${#routes.asset('/jquery.js')}"></script>
<script th:src="${#routes.asset('js/bootstrap.min.js')}"></script>

If Wisdom is not able to compute one of these urls, a page explaining the error is displayed (see image)

org_thymeleaf_exceptions_templateprocessingexception_cannot_find_the_url_of_the_asset_js_bootstrap_min_js-missing__bundleentry___56_fwk394714818_templates_samples_samples_thl_html_29_

@Riduidel
Copy link
Contributor Author

Riduidel commented Jul 2, 2014

On 02/07/2014 09:26, Clement Escoffier wrote:

Just for information, in #13
#13 we have extended
the |route| object injected in template to compute the url of assets as
follows:

|

<script th:src="${#routes.asset('/jquery.js')}"></script> <script th:src="${#routes.asset('js/bootstrap.min.js')}"></script>

|
|

If Wisdom is not able to compute one of these urls, a page explaining
the error is displayed (see image)

org_thymeleaf_exceptions_templateprocessingexception_cannot_find_the_url_of_the_asset_js_bootstrap_min_js-missing__bundleentry___56_fwk394714818_templates_samples_samples_thl_html_29_
https://cloud.githubusercontent.com/assets/402301/3452785/24e290a8-01ba-11e4-8b5a-7a0a2a55ab8a.png

This means one should never use direct link, but rather always use
that route resolution ... which, as far as I know, isn't documented :-)
Yeah, i've just checked in main documentation, the "#routes.asset(...)"
expression can't be found. Which obviously idnicates it's an easter egg,
where it's precisely the kind of things that would make that link
checker useless (provided it can be enforced ... which is another question).

Nicolas Delsaux

@cescoffier
Copy link
Member

I've implemented this feature last night (despite the low issue number).
Documentation is coming, just be patient ;-)

On 2 juil. 2014, at 14:09, Nicolas Delsaux [email protected] wrote:

On 02/07/2014 09:26, Clement Escoffier wrote:

Just for information, in #13
#13 we have extended
the |route| object injected in template to compute the url of assets as
follows:

|

<script th:src="${#routes.asset('/jquery.js')}"></script> <script th:src="${#routes.asset('js/bootstrap.min.js')}"></script>

|
|

If Wisdom is not able to compute one of these urls, a page explaining
the error is displayed (see image)

org_thymeleaf_exceptions_templateprocessingexception_cannot_find_the_url_of_the_asset_js_bootstrap_min_js-missing__bundleentry___56_fwk394714818_templates_samples_samples_thl_html_29_
<
https://cloud.githubusercontent.com/assets/402301/3452785/24e290a8-01ba-11e4-8b5a-7a0a2a55ab8a.png

This means one should never use direct link, but rather always use
that route resolution ... which, as far as I know, isn't documented :-)
Yeah, i've just checked in main documentation, the "#routes.asset(...)"
expression can't be found. Which obviously idnicates it's an easter egg,
where it's precisely the kind of things that would make that link
checker useless (provided it can be enforced ... which is another question).

Nicolas Delsaux


Reply to this email directly or view it on GitHub
#247 (comment)
.

@cescoffier
Copy link
Member

I've made some documentation (in the master branch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants