You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Wayne Pope <wa...@googlemail.com> on 2009/02/23 16:52:56 UTC

subdomains and setting up WebSession

Hi,

I need to be able to map urls like:

foo.myapp.com
foo2.myapp.com
woo.myapp.com
etc..

and be able to have a parameter in my session (say a String) set to
either foo, foo2, woo, etc

These subdomains are database driven and therefore I don't want to add
any subdomains hardcoded to web.xml or apache .
I was thinking about doing a mod rewrite in apache and either
appending an extra parameter or mapping to something like:

/webappurl/foo
/webappurl/foo2
/webappurl/woo

and then (by majic!) be able to pick this up in the wicket session.

Anyone got any idea's on how I could go about this?

I did think about adding another servlet filter and setting some
threadlocal variable, but this doesn't feel right.

many thanks

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


Re: subdomains and setting up WebSession

Posted by Nino Martinez <ni...@gmail.com>.
In my case no, since the whole idea are to share statistics. Only diff 
between the 2 are some forum rights and the small title...

If you want the same application to run with different databases I 
suggest you do one of these:

    * Custom request cycle (do something with your injection framework here)
    * Extend the filter from your injection framework

In addition to above you would need for apache http to set a special 
request header, like domain etc, so your request cycle or filter can 
pick it up...

Im not sure how much benefit there is, than running separate 
applications, based on the same code but with different configuration 
files and its a lot easier..

Theres lots of other options, I just dont have them on the tip of my 
tongue..

regards Nino

Bert wrote:
> Sorry for stepping in here, but this interest me too ;)
>
> do you map these different domains to different databases,
> but using only one application deployment?
>
> if so, i would like to know how you did this...
>
> thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: subdomains and setting up WebSession

Posted by Bert <ta...@gmail.com>.
Sorry for stepping in here, but this interest me too ;)

do you map these different domains to different databases,
but using only one application deployment?

if so, i would like to know how you did this...

thanks

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


Re: subdomains and setting up WebSession

Posted by Nino Martinez <ni...@gmail.com>.
I did not do what I said.. :( Apparently I have to seperate virtual 
sites for it.. In the exerciselog one I set:

RequestHeader set domain "exerciselog.eu"

I had to turn of : ProxyPreserveHost Off, cant remember why, but there 
was a reason to it...Could be because I share cookies or something cant 
remember..

There is a mod cookie, but request header is better I think..



Wayne Pope wrote:
> Hi Nino,
> thanks for that. I wasn't aware that I can get apache to append a cookie.
> I've done things in the past using mod-rewrite like:
> Redirect <subdomain>.example.org/<path> to www.example.org/<subdomain>/<path>
>
> Which directive are you using?
>
> On Mon, Feb 23, 2009 at 5:17 PM, Nino Martinez
> <ni...@gmail.com> wrote:
>   
>> Hi Wayne
>>
>> Thats exactly what I've done with my traningslog.dk and exerciselog.eu ,
>> both are pointing at the same app...I just used apache http to append a
>> special cookie containing the domain.. There are several ways of doing this
>> with apache http.. I did this since I am running several apps on the same
>> tomcat so I need some logic in front of tomcat anyhow..
>>
>> regards Nino
>>
>> Wayne Pope wrote:
>>     
>>> Hi Martin,
>>>
>>> basically I need subdomains to map to a context within the application.
>>>
>>> For example if you have a application that has several customers, I
>>> want to have a separate subdomain for each customer:
>>>
>>> william.myapp.com
>>> jo.myapp.com
>>> sarah.myapp.com
>>>
>>> I'd like 'william' to always see his URLS like:
>>> http://william.myapp.com/?wicket:interface=:4::::
>>>
>>>
>>> However in the application I need to figure out that I'm in the
>>> 'william' context, so i can serve williams content only.
>>>
>>>
>>>
>>>
>>> On Mon, Feb 23, 2009 at 5:00 PM, Martin Makundi
>>> <ma...@koodaripalvelut.com> wrote:
>>>
>>>       
>>>> I think you can see the request ulr root by calling
>>>> ((WebRequest)RequestCycle.get().getRequest()).getRequestURL()
>>>>
>>>> Is that what you want?
>>>>
>>>> **
>>>> Martin
>>>>
>>>> 2009/2/23 Wayne Pope <wa...@googlemail.com>:
>>>>
>>>>         
>>>>> Hi,
>>>>>
>>>>> I need to be able to map urls like:
>>>>>
>>>>> foo.myapp.com
>>>>> foo2.myapp.com
>>>>> woo.myapp.com
>>>>> etc..
>>>>>
>>>>> and be able to have a parameter in my session (say a String) set to
>>>>> either foo, foo2, woo, etc
>>>>>
>>>>> These subdomains are database driven and therefore I don't want to add
>>>>> any subdomains hardcoded to web.xml or apache .
>>>>> I was thinking about doing a mod rewrite in apache and either
>>>>> appending an extra parameter or mapping to something like:
>>>>>
>>>>> /webappurl/foo
>>>>> /webappurl/foo2
>>>>> /webappurl/woo
>>>>>
>>>>> and then (by majic!) be able to pick this up in the wicket session.
>>>>>
>>>>> Anyone got any idea's on how I could go about this?
>>>>>
>>>>> I did think about adding another servlet filter and setting some
>>>>> threadlocal variable, but this doesn't feel right.
>>>>>
>>>>> many thanks
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: subdomains and setting up WebSession

Posted by Wayne Pope <wa...@googlemail.com>.
Hi Nino,
thanks for that. I wasn't aware that I can get apache to append a cookie.
I've done things in the past using mod-rewrite like:
Redirect <subdomain>.example.org/<path> to www.example.org/<subdomain>/<path>

Which directive are you using?

On Mon, Feb 23, 2009 at 5:17 PM, Nino Martinez
<ni...@gmail.com> wrote:
> Hi Wayne
>
> Thats exactly what I've done with my traningslog.dk and exerciselog.eu ,
> both are pointing at the same app...I just used apache http to append a
> special cookie containing the domain.. There are several ways of doing this
> with apache http.. I did this since I am running several apps on the same
> tomcat so I need some logic in front of tomcat anyhow..
>
> regards Nino
>
> Wayne Pope wrote:
>>
>> Hi Martin,
>>
>> basically I need subdomains to map to a context within the application.
>>
>> For example if you have a application that has several customers, I
>> want to have a separate subdomain for each customer:
>>
>> william.myapp.com
>> jo.myapp.com
>> sarah.myapp.com
>>
>> I'd like 'william' to always see his URLS like:
>> http://william.myapp.com/?wicket:interface=:4::::
>>
>>
>> However in the application I need to figure out that I'm in the
>> 'william' context, so i can serve williams content only.
>>
>>
>>
>>
>> On Mon, Feb 23, 2009 at 5:00 PM, Martin Makundi
>> <ma...@koodaripalvelut.com> wrote:
>>
>>>
>>> I think you can see the request ulr root by calling
>>> ((WebRequest)RequestCycle.get().getRequest()).getRequestURL()
>>>
>>> Is that what you want?
>>>
>>> **
>>> Martin
>>>
>>> 2009/2/23 Wayne Pope <wa...@googlemail.com>:
>>>
>>>>
>>>> Hi,
>>>>
>>>> I need to be able to map urls like:
>>>>
>>>> foo.myapp.com
>>>> foo2.myapp.com
>>>> woo.myapp.com
>>>> etc..
>>>>
>>>> and be able to have a parameter in my session (say a String) set to
>>>> either foo, foo2, woo, etc
>>>>
>>>> These subdomains are database driven and therefore I don't want to add
>>>> any subdomains hardcoded to web.xml or apache .
>>>> I was thinking about doing a mod rewrite in apache and either
>>>> appending an extra parameter or mapping to something like:
>>>>
>>>> /webappurl/foo
>>>> /webappurl/foo2
>>>> /webappurl/woo
>>>>
>>>> and then (by majic!) be able to pick this up in the wicket session.
>>>>
>>>> Anyone got any idea's on how I could go about this?
>>>>
>>>> I did think about adding another servlet filter and setting some
>>>> threadlocal variable, but this doesn't feel right.
>>>>
>>>> many thanks
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: subdomains and setting up WebSession

Posted by Nino Martinez <ni...@gmail.com>.
Hi Wayne

Thats exactly what I've done with my traningslog.dk and exerciselog.eu , 
both are pointing at the same app...I just used apache http to append a 
special cookie containing the domain.. There are several ways of doing 
this with apache http.. I did this since I am running several apps on 
the same tomcat so I need some logic in front of tomcat anyhow..

regards Nino

Wayne Pope wrote:
> Hi Martin,
>
> basically I need subdomains to map to a context within the application.
>
> For example if you have a application that has several customers, I
> want to have a separate subdomain for each customer:
>
> william.myapp.com
> jo.myapp.com
> sarah.myapp.com
>
> I'd like 'william' to always see his URLS like:
> http://william.myapp.com/?wicket:interface=:4::::
>
>
> However in the application I need to figure out that I'm in the
> 'william' context, so i can serve williams content only.
>
>
>
>
> On Mon, Feb 23, 2009 at 5:00 PM, Martin Makundi
> <ma...@koodaripalvelut.com> wrote:
>   
>> I think you can see the request ulr root by calling
>> ((WebRequest)RequestCycle.get().getRequest()).getRequestURL()
>>
>> Is that what you want?
>>
>> **
>> Martin
>>
>> 2009/2/23 Wayne Pope <wa...@googlemail.com>:
>>     
>>> Hi,
>>>
>>> I need to be able to map urls like:
>>>
>>> foo.myapp.com
>>> foo2.myapp.com
>>> woo.myapp.com
>>> etc..
>>>
>>> and be able to have a parameter in my session (say a String) set to
>>> either foo, foo2, woo, etc
>>>
>>> These subdomains are database driven and therefore I don't want to add
>>> any subdomains hardcoded to web.xml or apache .
>>> I was thinking about doing a mod rewrite in apache and either
>>> appending an extra parameter or mapping to something like:
>>>
>>> /webappurl/foo
>>> /webappurl/foo2
>>> /webappurl/woo
>>>
>>> and then (by majic!) be able to pick this up in the wicket session.
>>>
>>> Anyone got any idea's on how I could go about this?
>>>
>>> I did think about adding another servlet filter and setting some
>>> threadlocal variable, but this doesn't feel right.
>>>
>>> many thanks
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: subdomains and setting up WebSession

Posted by Wayne Pope <wa...@googlemail.com>.
ok thanks Martin, I'll give it a go

On Mon, Feb 23, 2009 at 5:27 PM, Martin Makundi
<ma...@koodaripalvelut.com> wrote:
> ((WebRequest)RequestCycle.get().getRequest()).getRequestURL() should
> work for you.
>
> **
> Martin
>
> 2009/2/23 Wayne Pope <wa...@googlemail.com>:
>> Hi Martin,
>>
>> basically I need subdomains to map to a context within the application.
>>
>> For example if you have a application that has several customers, I
>> want to have a separate subdomain for each customer:
>>
>> william.myapp.com
>> jo.myapp.com
>> sarah.myapp.com
>>
>> I'd like 'william' to always see his URLS like:
>> http://william.myapp.com/?wicket:interface=:4::::
>>
>>
>> However in the application I need to figure out that I'm in the
>> 'william' context, so i can serve williams content only.
>>
>>
>>
>>
>> On Mon, Feb 23, 2009 at 5:00 PM, Martin Makundi
>> <ma...@koodaripalvelut.com> wrote:
>>> I think you can see the request ulr root by calling
>>> ((WebRequest)RequestCycle.get().getRequest()).getRequestURL()
>>>
>>> Is that what you want?
>>>
>>> **
>>> Martin
>>>
>>> 2009/2/23 Wayne Pope <wa...@googlemail.com>:
>>>> Hi,
>>>>
>>>> I need to be able to map urls like:
>>>>
>>>> foo.myapp.com
>>>> foo2.myapp.com
>>>> woo.myapp.com
>>>> etc..
>>>>
>>>> and be able to have a parameter in my session (say a String) set to
>>>> either foo, foo2, woo, etc
>>>>
>>>> These subdomains are database driven and therefore I don't want to add
>>>> any subdomains hardcoded to web.xml or apache .
>>>> I was thinking about doing a mod rewrite in apache and either
>>>> appending an extra parameter or mapping to something like:
>>>>
>>>> /webappurl/foo
>>>> /webappurl/foo2
>>>> /webappurl/woo
>>>>
>>>> and then (by majic!) be able to pick this up in the wicket session.
>>>>
>>>> Anyone got any idea's on how I could go about this?
>>>>
>>>> I did think about adding another servlet filter and setting some
>>>> threadlocal variable, but this doesn't feel right.
>>>>
>>>> many thanks
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: subdomains and setting up WebSession

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
((WebRequest)RequestCycle.get().getRequest()).getRequestURL() should
work for you.

**
Martin

2009/2/23 Wayne Pope <wa...@googlemail.com>:
> Hi Martin,
>
> basically I need subdomains to map to a context within the application.
>
> For example if you have a application that has several customers, I
> want to have a separate subdomain for each customer:
>
> william.myapp.com
> jo.myapp.com
> sarah.myapp.com
>
> I'd like 'william' to always see his URLS like:
> http://william.myapp.com/?wicket:interface=:4::::
>
>
> However in the application I need to figure out that I'm in the
> 'william' context, so i can serve williams content only.
>
>
>
>
> On Mon, Feb 23, 2009 at 5:00 PM, Martin Makundi
> <ma...@koodaripalvelut.com> wrote:
>> I think you can see the request ulr root by calling
>> ((WebRequest)RequestCycle.get().getRequest()).getRequestURL()
>>
>> Is that what you want?
>>
>> **
>> Martin
>>
>> 2009/2/23 Wayne Pope <wa...@googlemail.com>:
>>> Hi,
>>>
>>> I need to be able to map urls like:
>>>
>>> foo.myapp.com
>>> foo2.myapp.com
>>> woo.myapp.com
>>> etc..
>>>
>>> and be able to have a parameter in my session (say a String) set to
>>> either foo, foo2, woo, etc
>>>
>>> These subdomains are database driven and therefore I don't want to add
>>> any subdomains hardcoded to web.xml or apache .
>>> I was thinking about doing a mod rewrite in apache and either
>>> appending an extra parameter or mapping to something like:
>>>
>>> /webappurl/foo
>>> /webappurl/foo2
>>> /webappurl/woo
>>>
>>> and then (by majic!) be able to pick this up in the wicket session.
>>>
>>> Anyone got any idea's on how I could go about this?
>>>
>>> I did think about adding another servlet filter and setting some
>>> threadlocal variable, but this doesn't feel right.
>>>
>>> many thanks
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: subdomains and setting up WebSession

Posted by Wayne Pope <wa...@googlemail.com>.
Hi Martin,

basically I need subdomains to map to a context within the application.

For example if you have a application that has several customers, I
want to have a separate subdomain for each customer:

william.myapp.com
jo.myapp.com
sarah.myapp.com

I'd like 'william' to always see his URLS like:
http://william.myapp.com/?wicket:interface=:4::::


However in the application I need to figure out that I'm in the
'william' context, so i can serve williams content only.




On Mon, Feb 23, 2009 at 5:00 PM, Martin Makundi
<ma...@koodaripalvelut.com> wrote:
> I think you can see the request ulr root by calling
> ((WebRequest)RequestCycle.get().getRequest()).getRequestURL()
>
> Is that what you want?
>
> **
> Martin
>
> 2009/2/23 Wayne Pope <wa...@googlemail.com>:
>> Hi,
>>
>> I need to be able to map urls like:
>>
>> foo.myapp.com
>> foo2.myapp.com
>> woo.myapp.com
>> etc..
>>
>> and be able to have a parameter in my session (say a String) set to
>> either foo, foo2, woo, etc
>>
>> These subdomains are database driven and therefore I don't want to add
>> any subdomains hardcoded to web.xml or apache .
>> I was thinking about doing a mod rewrite in apache and either
>> appending an extra parameter or mapping to something like:
>>
>> /webappurl/foo
>> /webappurl/foo2
>> /webappurl/woo
>>
>> and then (by majic!) be able to pick this up in the wicket session.
>>
>> Anyone got any idea's on how I could go about this?
>>
>> I did think about adding another servlet filter and setting some
>> threadlocal variable, but this doesn't feel right.
>>
>> many thanks
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: subdomains and setting up WebSession

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
I think you can see the request ulr root by calling
((WebRequest)RequestCycle.get().getRequest()).getRequestURL()

Is that what you want?

**
Martin

2009/2/23 Wayne Pope <wa...@googlemail.com>:
> Hi,
>
> I need to be able to map urls like:
>
> foo.myapp.com
> foo2.myapp.com
> woo.myapp.com
> etc..
>
> and be able to have a parameter in my session (say a String) set to
> either foo, foo2, woo, etc
>
> These subdomains are database driven and therefore I don't want to add
> any subdomains hardcoded to web.xml or apache .
> I was thinking about doing a mod rewrite in apache and either
> appending an extra parameter or mapping to something like:
>
> /webappurl/foo
> /webappurl/foo2
> /webappurl/woo
>
> and then (by majic!) be able to pick this up in the wicket session.
>
> Anyone got any idea's on how I could go about this?
>
> I did think about adding another servlet filter and setting some
> threadlocal variable, but this doesn't feel right.
>
> many thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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