You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Jeremy Thomerson (JIRA)" <ji...@apache.org> on 2010/07/07 23:36:53 UTC

[jira] Closed: (WICKET-2938) mount url coding strategies in webpage class

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

Jeremy Thomerson closed WICKET-2938.
------------------------------------

    Resolution: Invalid

There is a wicket stuff project that allows you to use annotations on your page to mount them.

Your approach could not be in Wicket core for a few reasons. 

- We would have to do classpath scanning at application init to load all the page classes so they could register their url mounting.  
- You couldn't have a page be used in multiple applications, each mounted on different strategies
- You couldn't package a jar that included pages that should only be used in some apps, because it would automatically be mounted, which some apps might not want.  

> mount url coding strategies in webpage class
> --------------------------------------------
>
>                 Key: WICKET-2938
>                 URL: https://issues.apache.org/jira/browse/WICKET-2938
>             Project: Wicket
>          Issue Type: Wish
>          Components: wicket
>            Reporter: Damian Nowak
>            Priority: Minor
>
> Now, the appropriate place to mount url strategies is Application.init().
> @Override
> protected void init() {
> 	mount(new MixedParamHybridUrlCodingStrategy("quote", Single.class, new String[]{"id"}));
> 	// mount another one
> 	// and another..
> }
> But don't you think that Application.init() is not the right place for it?
> public class Single extends WebPage {
> 	static {
> 		MyApplication.get().mount(new MixedParamHybridUrlCodingStrategy("quote", Single.class, new String[]{"id"}));
> 	}
> 	public Single(PageParameters params) {
> 		final int id = params.getAsInteger("id", 0);
> 		// do my stuff here
> 	}
> }
> It looks much better, doesn't it? URL strategy is an implementation detail of the webpage class. Therefore, it should be mounted somewhere here. The code is better maintainable. Suppose you do something with the webpage parameter names - are you sure you look into Application.init()? I bet you will forget about it. :)
> My code almost works. If the webpage class hasn't been loaded by the classloader yet, the application does not know anything about the URL strategy. After the webpage class has been loaded, everything is OK then.
> I know I can introduce a public static init(Application app) in my webpage classes and execute it in my Application.init(). But it would be really nice if I didn't have to.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.