as far as having /username....

i recently had to do this for a cms im building. here is my quick hack
i used to get it working until i have time to revisit it...

the code below is from the webapp subclass, the way it works:

your homepage has pageparams constructor, if you hit a url that doesnt
match anything the homepage is called and pageparams.path contains the
url fragment that could not be resolved.

        @Override
        protected IRequestCycleProcessor newRequestCycleProcessor() {

                return new CmsRequestCycleProcessor();
        }

        private static class CmsRequestCycleProcessor extends
                        WebRequestCycleProcessor {
                @Override
                protected IRequestCodingStrategy newRequestCodingStrategy() {
                        return new CmsRequestCodingStrategy();
                }
        }

        private static class CmsRequestCodingStrategy extends
                        WebRequestCodingStrategy {
                private final CmsUrlCodingStrategy strat = new 
CmsUrlCodingStrategy();

                @Override
                public IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(
                                String path) {
                        IRequestTargetUrlCodingStrategy target = super
                                        .urlCodingStrategyForPath(path);
                        if (target == null) {
                                target = strat;
                        }
                        return target;
                }

        }

        private static class CmsUrlCodingStrategy extends
                        BookmarkablePageRequestTargetUrlCodingStrategy {

                public CmsUrlCodingStrategy() {
                        super("/", CmsPage.class, null);
                }

                @Override
                public IRequestTarget decode(RequestParameters 
requestParameters) {
                        PageParameters params = new PageParameters();
                        params.put("path", "/" + requestParameters.getPath());
                        return new BookmarkablePageRequestTarget(CmsPage.class, 
params);
                }
        }

-igor

On Jan 18, 2008 12:56 AM, Erik van Oosten <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In my app I have several mounted URLs with a simple prefix:
> /city/name_of_city
> /support/name_of_support_page
> etc. Easy.
>
> But now my client want to have members (yes, yet another community site
> ;) ) directly on the root:
> /name_of_member
>
> In addition, he want us to guess URLs. For example:
> /amsterdam would redirect to /city/amsterdam.
>
> What is the best way to catch all requests that could not be handled by
> Wicket?
>
> I was thinking about adding a filter that does database lookups and then
> http redirects, but I am just very unsure if this plays well with other
> app server and Wicket mechanisms.
>
> Regards,
>     Erik.
>
>
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to