You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thorsten Schöning <ts...@am-soft.de> on 2020/03/03 19:28:19 UTC

How to make Wicket prefer a custom resource finder always?

Hi all,

I'm maintaining a Wicket webapp with slightly modified directories to
get templates and language files from and created implementations of
IResourceFinder for both. Things worked like epxected for some years
now, but recently I changed deployment a bit to provide Javadoc by
default for all my artifacts.

Javadoc is simply deployed as JARs and because it's stored in
"WEB-INF/lib", available in the classpath by default. That leads to
the problem that Wicket now finds HTML files generated by Javadoc as
templates to use. That doesn't work of course and results in errors
like the following:

> Expected to find <wicket:panel> in associated markup file. Markup:
> jar:file:/C:/Program%20Files/Apache/Tomcat%209.0/webapps/de.am_soft.sm_mtg.frontend.bug_2590_gradle/WEB-INF/lib/de.am_soft.sm_mtg.frontend-javadoc.jar!/de/am_soft/sm_mtg/frontend/panels/collectors/PnReadWithRealEstates.html

So the first approach was to simply change the place where I provide
my own resource finders to Wicket to make them the first items in the
list. The current code is the following:

> ResourceSettings      settings = this.getResourceSettings();
> List<IResourceFinder> finders  = settings.getResourceFinders();
>
> finders.add(0, new CustDefTmplResFinder(this.getServletContext()));
> finders.add(1, new LangResFinder(this.getServletContext()));

But that works for some pages only, sadly not for all. E.g. the
login-page works well that way, but after logging in, the former error
occurs again.

So how do I tell Wicket to really always use my resource finders
first? Thanks!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to make Wicket prefer a custom resource finder always?

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Sven Meier,
am Mittwoch, 4. März 2020 um 10:19 schrieben Sie:

> Maybe the default classpath finder is kicking in and loads a
> template for a class that would otherwise inherit its markup from its superclass?

Thanks for the hint, that was exactly what was happening. Putting my
finders at the front of the list otherwise worked as expected. After
clearing all default finders things work again, but there's a
downside: 

For some templates and languages I still relied on what gets bundled
with Wicket, e.g. FeedbackPanel, and those need custom files now as
well. There's no classpath-finder which could find them in the
Wicket-JARs anymore. Not yet sure if I like this or not: Should only
be very few templates currently and my directories easy fit to the
default package-based naming scheme, so adding new files is easy.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to make Wicket prefer a custom resource finder always?

Posted by Sven Meier <sv...@meiers.net>.
Hi,

have you tried removing the default finders?

settings.getResourceFinders().clear();

Maybe the default classpath finder is kicking in and loads a template for a class that would otherwise inherit its markup from its superclass?

Sven

Am 3. März 2020 20:28:19 MEZ schrieb "Thorsten Schöning" <ts...@am-soft.de>:
>Hi all,
>
>I'm maintaining a Wicket webapp with slightly modified directories to
>get templates and language files from and created implementations of
>IResourceFinder for both. Things worked like epxected for some years
>now, but recently I changed deployment a bit to provide Javadoc by
>default for all my artifacts.
>
>Javadoc is simply deployed as JARs and because it's stored in
>"WEB-INF/lib", available in the classpath by default. That leads to
>the problem that Wicket now finds HTML files generated by Javadoc as
>templates to use. That doesn't work of course and results in errors
>like the following:
>
>> Expected to find <wicket:panel> in associated markup file. Markup:
>>
>jar:file:/C:/Program%20Files/Apache/Tomcat%209.0/webapps/de.am_soft.sm_mtg.frontend.bug_2590_gradle/WEB-INF/lib/de.am_soft.sm_mtg.frontend-javadoc.jar!/de/am_soft/sm_mtg/frontend/panels/collectors/PnReadWithRealEstates.html
>
>So the first approach was to simply change the place where I provide
>my own resource finders to Wicket to make them the first items in the
>list. The current code is the following:
>
>> ResourceSettings      settings = this.getResourceSettings();
>> List<IResourceFinder> finders  = settings.getResourceFinders();
>>
>> finders.add(0, new CustDefTmplResFinder(this.getServletContext()));
>> finders.add(1, new LangResFinder(this.getServletContext()));
>
>But that works for some pages only, sadly not for all. E.g. the
>login-page works well that way, but after logging in, the former error
>occurs again.
>
>So how do I tell Wicket to really always use my resource finders
>first? Thanks!
>
>Mit freundlichen Grüßen,
>
>Thorsten Schöning
>
>-- 
>Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
>AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
>Telefon...........05151-  9468- 55
>Fax...............05151-  9468- 88
>Mobil..............0178-8 9468- 04
>
>AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
>AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org