You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Major Péter <ma...@sch.bme.hu> on 2010/11/27 16:22:04 UTC

Easyfying mounts in 1.5

Hi,

is there some specific reason, why WebApplication#mount is deprecated in 
1.5? It could be a really good shortcut:
mount(new MyMapper("", A.class);
rather then:
getRootRequestMapperAsCompound().add(new MyMapper("", A.class));

also PackageMapper looks really weird:
mount(new MountMapper("/error", new 
PackageMapper(PackageName.forClass(InternalServerError.class))));

PackageMapper is a valid IRequestMapper, so I could write this:
mount(new PackageMapper(PackageName.forClass(InternalServerError.class)));
which is syntactically correct, but semantically it's a wtf. (what 
mountpath will be used then, would it even match?)
Thoughts?

Thanks,
Peter

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


Re: Easyfying mounts in 1.5

Posted by Martin Grigorov <mg...@apache.org>.
BookmarkableMapper produces something like:
/wicket/bookmarkable/com.example.MyPage

There is a mistake in the line below, it should be
WebApplication#mountBookmarkable(pageClass) which will
call getRootRequestMapperAsCompound().add(new
BookmarkableMapper(pageClass));
i.e. without the "path"

mountPage() uses MountedMapper which uses user-defined path

On Sat, Nov 27, 2010 at 9:40 PM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:

> How is your last suggestion different from mount page you mention first ?
>
> Jeremy Thomerson
> http://wickettraining.com
> -- sent from my "smart" phone, so please excuse spelling, formatting, or
> compiler errors
>
> On Nov 27, 2010 12:17 PM, "Martin Grigorov" <mg...@apache.org> wrote:
>
> Hi,
>
> Currently we have :
> WebApplication.mountPage(path, pageClass) which is a shortcut for
> WebApplication.getRootRequestMapperAsCompound().add(new MountedMapper(path,
> pageClass));
>
> and
> org.apache.wicket.protocol.http.WebApplication.mountSharedResource(String,
> ResourceReference) which is:
> getResourceReferenceRegistry().registerResourceReference(reference);
> getRootRequestMapperAsCompound().add(new ResourceMapper(path, reference));
>
> I agree that
> getRootRequestMapperAsCompound().add(new MountMapper("pMount", new
> PackageMapper( PackageName.forClass(PackageMountedPage.class))));
> shows that mappers are flexible but it is also a bit scary. We can add
> WebApplication#mountPackage(path, PackageName).
>
> The last reasonable shortcut that we can add is
> WebApplication#mountBookmarkable(path, pageClass) which will
> be getRootRequestMapperAsCompound().add(new BookmarkableMapper(path,
> pageClass));
>
> What do you think ?
>
> 2010/11/27 Major Péter <ma...@sch.bme.hu>
>
>
> > Hi,
> >
> > is there some specific reason, why WebApplication#mount is deprecated in
> > 1.5? It could ...
>

Re: Easyfying mounts in 1.5

Posted by Jeremy Thomerson <je...@wickettraining.com>.
How is your last suggestion different from mount page you mention first ?

Jeremy Thomerson
http://wickettraining.com
-- sent from my "smart" phone, so please excuse spelling, formatting, or
compiler errors

On Nov 27, 2010 12:17 PM, "Martin Grigorov" <mg...@apache.org> wrote:

Hi,

Currently we have :
WebApplication.mountPage(path, pageClass) which is a shortcut for
WebApplication.getRootRequestMapperAsCompound().add(new MountedMapper(path,
pageClass));

and
org.apache.wicket.protocol.http.WebApplication.mountSharedResource(String,
ResourceReference) which is:
getResourceReferenceRegistry().registerResourceReference(reference);
getRootRequestMapperAsCompound().add(new ResourceMapper(path, reference));

I agree that
getRootRequestMapperAsCompound().add(new MountMapper("pMount", new
PackageMapper( PackageName.forClass(PackageMountedPage.class))));
shows that mappers are flexible but it is also a bit scary. We can add
WebApplication#mountPackage(path, PackageName).

The last reasonable shortcut that we can add is
WebApplication#mountBookmarkable(path, pageClass) which will
be getRootRequestMapperAsCompound().add(new BookmarkableMapper(path,
pageClass));

What do you think ?

2010/11/27 Major Péter <ma...@sch.bme.hu>


> Hi,
>
> is there some specific reason, why WebApplication#mount is deprecated in
> 1.5? It could ...

Re: Easyfying mounts in 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Currently we have :
WebApplication.mountPage(path, pageClass) which is a shortcut for
WebApplication.getRootRequestMapperAsCompound().add(new MountedMapper(path,
pageClass));

and org.apache.wicket.protocol.http.WebApplication.mountSharedResource(String,
ResourceReference) which is:
getResourceReferenceRegistry().registerResourceReference(reference);
getRootRequestMapperAsCompound().add(new ResourceMapper(path, reference));

I agree that
getRootRequestMapperAsCompound().add(new MountMapper("pMount", new
PackageMapper( PackageName.forClass(PackageMountedPage.class))));
shows that mappers are flexible but it is also a bit scary. We can add
WebApplication#mountPackage(path, PackageName).

The last reasonable shortcut that we can add is
WebApplication#mountBookmarkable(path, pageClass) which will
be getRootRequestMapperAsCompound().add(new BookmarkableMapper(path,
pageClass));

What do you think ?

2010/11/27 Major Péter <ma...@sch.bme.hu>

> Hi,
>
> is there some specific reason, why WebApplication#mount is deprecated in
> 1.5? It could be a really good shortcut:
> mount(new MyMapper("", A.class);
> rather then:
> getRootRequestMapperAsCompound().add(new MyMapper("", A.class));
>
> also PackageMapper looks really weird:
> mount(new MountMapper("/error", new
> PackageMapper(PackageName.forClass(InternalServerError.class))));
>
> PackageMapper is a valid IRequestMapper, so I could write this:
> mount(new PackageMapper(PackageName.forClass(InternalServerError.class)));
> which is syntactically correct, but semantically it's a wtf. (what
> mountpath will be used then, would it even match?)
> Thoughts?
>
> Thanks,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>