You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthew Welch <ma...@welchkin.net> on 2009/04/20 06:54:12 UTC

Custom URL Handling

I have been happily using HybridUrlCodingStrategy for the common pages of my
current app, however I am now beginning to implement a section which has
slightly different requirements for the URL and while I have some idea about
where I can start to implement this custom URL handling, I would like the
advice of those more experienced that I to make sure I'm not heading down a
rathole.

My application will serve many different organizations. All users will see
the same set of pages, but the organization that they are choosing to view
(users can view the data from any organization) will affect the data on
those pages. I would like the urls to be something like this:

http://myapp.com/organization1/calendar
http://myapp.com/organization1/events

http://myapp.com/organization2/calendar
http://myapp.com/organization2/events

I would need to know the organization part of the URL before retrieving the
data for the page, so in reality it's nothing more that page parameter. In
all other respects, I would like to keep the functionality provided by
HybridUrlCodingStrategy, so would my best bet be to extend that strategy? Is
there somewhere else I should be inserting custom code to intercept the URL
before it gets to the coding strategy instead?

Matt

Re: Custom URL Handling

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Oh, yeah - okay, so there was a little difference.  It depends on your setup
- mainly - will you ever need links from two organizations on the same page?

Basically, what I was doing was creating branded sites.  So, here's the gist
of what I had:

Apache frontend, based on site, would proxy to Tomcat with an additional
path element ahead of the proxy like this:

Your request URL:  www.site-one.com/foo
Apache proxied to Tomcat: www.site-one.com/org-one/foo
My filter modified that so that it was again /foo and stuck the org into the
session
So, the Wicket-generated links of /foo or /bar worked fine - because the org
didn't actually appear in the URL *path* - it was based on URL *domain*

Does that make sense?  I guess it would only work if you could use domain or
subdomain based orgs rather than URL path based.

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, Apr 20, 2009 at 4:32 PM, Matt Welch <ma...@welchkin.net> wrote:

>
>
> Jeremy Thomerson-5 wrote:
> >
> > In the past, I've accomplished something similar in a hack-ish sort of
> way
> > that may work for you.  Basically, I extended the WicketFilter and
> > stripped
> > the first argument off, storing it in the request before Wicket used the
> > URL
> > to determine the requested page.  Maybe you can go down a similar route?
> >
> Thanks. That's something to consider. How did you get wicket to write out
> the correct URL's for links though?
>
> --
> View this message in context:
> http://www.nabble.com/Custom-URL-Handling-tp23130367p23145343.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Custom URL Handling

Posted by Matt Welch <ma...@welchkin.net>.

Jeremy Thomerson-5 wrote:
> 
> In the past, I've accomplished something similar in a hack-ish sort of way
> that may work for you.  Basically, I extended the WicketFilter and
> stripped
> the first argument off, storing it in the request before Wicket used the
> URL
> to determine the requested page.  Maybe you can go down a similar route?
> 
Thanks. That's something to consider. How did you get wicket to write out
the correct URL's for links though?

-- 
View this message in context: http://www.nabble.com/Custom-URL-Handling-tp23130367p23145343.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Custom URL Handling

Posted by Jeremy Thomerson <je...@wickettraining.com>.
In the past, I've accomplished something similar in a hack-ish sort of way
that may work for you.  Basically, I extended the WicketFilter and stripped
the first argument off, storing it in the request before Wicket used the URL
to determine the requested page.  Maybe you can go down a similar route?

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, Apr 20, 2009 at 3:03 PM, Matt Welch <ma...@welchkin.net> wrote:

>
>
> David Leangen-8 wrote:
> >
> > What version are you using?
> >
> I'm using 1.4.
>
> It wouldn't have occurred to me that it would be so difficult. I know it
> may
> seem odd, but URL control is actually very important here because
> organization identity is vital in the domain that the app will serve.
>
> Hmmm....
>
> Matt
>
> --
> View this message in context:
> http://www.nabble.com/Custom-URL-Handling-tp23130367p23143850.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: Custom URL Handling

Posted by David Leangen <wi...@leangen.net>.
> > What version are you using?
> >
> I'm using 1.4.

Ok, then I can't really help you much.

> URL control is actually very important here because
> organization identity is vital in the domain that the app will serve.

Agreed. IIUC, it may be easier in 1.4:

  http://www.nabble.com/-PROPOSAL--Use-path-in-URL-when-target-is-instance-o
f-BookmarkablePageRequestTarget-td18188845.html


Good luck! Please let me know how this works out.

Cheers,
=David




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


Re: Custom URL Handling

Posted by Matt Welch <ma...@welchkin.net>.

David Leangen-8 wrote:
> 
> What version are you using?
> 
I'm using 1.4. 

It wouldn't have occurred to me that it would be so difficult. I know it may
seem odd, but URL control is actually very important here because
organization identity is vital in the domain that the app will serve.

Hmmm....

Matt

-- 
View this message in context: http://www.nabble.com/Custom-URL-Handling-tp23130367p23143850.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Custom URL Handling

Posted by David Leangen <wi...@leangen.net>.
Matt,

I have done something similar, but depending on the version of Wicket  
you use, I wouldn't necessary recommend it. Things can get a little  
messy.

I did this in 1.3.x. IIRC, I was told this was made easier in 1.4.


What version are you using?

=dml



On Apr 20, 2009, at 1:54 PM, Matthew Welch wrote:

> I have been happily using HybridUrlCodingStrategy for the common  
> pages of my
> current app, however I am now beginning to implement a section which  
> has
> slightly different requirements for the URL and while I have some  
> idea about
> where I can start to implement this custom URL handling, I would  
> like the
> advice of those more experienced that I to make sure I'm not heading  
> down a
> rathole.
>
> My application will serve many different organizations. All users  
> will see
> the same set of pages, but the organization that they are choosing  
> to view
> (users can view the data from any organization) will affect the data  
> on
> those pages. I would like the urls to be something like this:
>
> http://myapp.com/organization1/calendar
> http://myapp.com/organization1/events
>
> http://myapp.com/organization2/calendar
> http://myapp.com/organization2/events
>
> I would need to know the organization part of the URL before  
> retrieving the
> data for the page, so in reality it's nothing more that page  
> parameter. In
> all other respects, I would like to keep the functionality provided by
> HybridUrlCodingStrategy, so would my best bet be to extend that  
> strategy? Is
> there somewhere else I should be inserting custom code to intercept  
> the URL
> before it gets to the coding strategy instead?
>
> Matt


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


Re: Custom URL Handling

Posted by Erik van Oosten <e....@grons.nl>.
Hi Matthew,

Without some serious hacking in the Wicket internals this is not 
possible. (I did it, but the code is too specific to share.) Wicket 1.5 
will improve URL handling, then this case will hopefully be easily.

Regards,
    Erik.


Matthew Welch wrote:
> I have been happily using HybridUrlCodingStrategy for the common pages of my
> current app, however I am now beginning to implement a section which has
> slightly different requirements for the URL and while I have some idea about
> where I can start to implement this custom URL handling, I would like the
> advice of those more experienced that I to make sure I'm not heading down a
> rathole.
>
> My application will serve many different organizations. All users will see
> the same set of pages, but the organization that they are choosing to view
> (users can view the data from any organization) will affect the data on
> those pages. I would like the urls to be something like this:
>
> http://myapp.com/organization1/calendar
> http://myapp.com/organization1/events
>
> http://myapp.com/organization2/calendar
> http://myapp.com/organization2/events
>
> I would need to know the organization part of the URL before retrieving the
> data for the page, so in reality it's nothing more that page parameter. In
> all other respects, I would like to keep the functionality provided by
> HybridUrlCodingStrategy, so would my best bet be to extend that strategy? Is
> there somewhere else I should be inserting custom code to intercept the URL
> before it gets to the coding strategy instead?
>
> Matt
>
>   

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



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