Virtual Hostnames with Jetty?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Virtual Hostnames with Jetty?

Arsalan Zaidi
Hi.

Here's what I want to do:

The web app (someapp.com) being made allows the creation of new users,
each of which is given an inidividual name e.g.
http://1234.someapp.com. The users can create a more suitable name
like http://someuser.someapp.com which maps to
http://1234.someapp.com, as well.

How do I support functionality like this in Jetty? All users
eventually go to the same set of servlets. The different host names is
simply for convenience.

Regards.

--Arsalan Zaidi


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Hostnames with Jetty?

Chris Haynes
Have you first solved the DNS problem?

How does your DNS get to know about the dynamically-generated, user-modified
host names?

Chris Haynes


"Arsalan Zaidi" <[hidden email]> asked

Hi.

Here's what I want to do:

The web app (someapp.com) being made allows the creation of new users,
each of which is given an inidividual name e.g.
http://1234.someapp.com. The users can create a more suitable name
like http://someuser.someapp.com which maps to
http://1234.someapp.com, as well.

How do I support functionality like this in Jetty? All users
eventually go to the same set of servlets. The different host names is
simply for convenience.






-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Hostnames with Jetty?

Arsalan Zaidi
On 8/12/05, Chris Haynes <[hidden email]> wrote:
> Have you first solved the DNS problem?
>
> How does your DNS get to know about the dynamically-generated, user-modified
> host names?

I'm no expert, but I thought all I had to do was have
http://*.someapp.com resolve to the server. Once we're on the server,
the server itself should handle the mapping for *. Kind of like how
Apache handles name based virtual hosts...

Is there another way? I don't need detailed instructions, just point
me at some docs. :-) I tried googling, but couldn't find anything much
on Jetty.

--Arsalan

PS. Sorry for the triple posts (?). I still haven't seen a copy of my
posts in my inbox, even though delivery for those is turned on. I
thought there was some glitch with the server.



>
> Chris Haynes
>
>
> "Arsalan Zaidi" <[hidden email]> asked
>
> Hi.
>
> Here's what I want to do:
>
> The web app (someapp.com) being made allows the creation of new users,
> each of which is given an inidividual name e.g.
> http://1234.someapp.com. The users can create a more suitable name
> like http://someuser.someapp.com which maps to
> http://1234.someapp.com, as well.
>
> How do I support functionality like this in Jetty? All users
> eventually go to the same set of servlets. The different host names is
> simply for convenience.
>
>
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Hostnames with Jetty?

Chris Haynes
Maybe I'm, wrong. but I thought DNS wild-cards didn't work like that.  I stand
to be corrected.

So, about the Jetty side of things. There are APIs for adding virtual host names
during start-up - use: HttpContext#addVirtualHost(String). I'm pretty sure that
will also be recognized if added while running.

You will, presumably, have two times when you need to add a virtual host name:

1) While Jetty is running and a new name is generated,
2) When Jetty restarts - there must be a file somewhere with all the valid names
in it.

You will have to play around with some design ideas.

I suspect you will end up needing two separate mechanisms, for the two
situations.

If yuu can work out how to add one host name dynamically, then it should be easy
to get a start-up method somewhere (in a servlet init?) to ad all the names in
the file at that time.  You'll just have to work out how to get at the Jetty
APIs you need from within a Servlet - 'cause most of them are intentionally
inaccessible from within the Servlet environment for security reasons.  There
have been posts recently (in the last 4-6 weeks?) with suggestions on different
ways of doing this.

HTH

Chris


----- Original Message -----
From: "Arsalan Zaidi" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, August 13, 2005 2:53 PM
Subject: Re: [Jetty-support] Virtual Hostnames with Jetty?


On 8/12/05, Chris Haynes <[hidden email]> wrote:
> Have you first solved the DNS problem?
>
> How does your DNS get to know about the dynamically-generated, user-modified
> host names?

I'm no expert, but I thought all I had to do was have
http://*.someapp.com resolve to the server. Once we're on the server,
the server itself should handle the mapping for *. Kind of like how
Apache handles name based virtual hosts...

Is there another way? I don't need detailed instructions, just point
me at some docs. :-) I tried googling, but couldn't find anything much
on Jetty.

--Arsalan

PS. Sorry for the triple posts (?). I still haven't seen a copy of my
posts in my inbox, even though delivery for those is turned on. I
thought there was some glitch with the server.



>
> Chris Haynes
>
>
> "Arsalan Zaidi" <[hidden email]> asked
>
> Hi.
>
> Here's what I want to do:
>
> The web app (someapp.com) being made allows the creation of new users,
> each of which is given an inidividual name e.g.
> http://1234.someapp.com. The users can create a more suitable name
> like http://someuser.someapp.com which maps to
> http://1234.someapp.com, as well.
>
> How do I support functionality like this in Jetty? All users
> eventually go to the same set of servlets. The different host names is
> simply for convenience.
>
>
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support







-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Hostnames with Jetty?

Steve Sobol
Chris Haynes wrote:
> Maybe I'm, wrong. but I thought DNS wild-cards didn't work like that.  I
> stand to be corrected.

Pointing *.blah.foo at 127.0.0.1 will cause IP address lookups for anything
ending in .blah.foo to return 127.0.0.1, including a.blah.foo, b.blah.foo,
c.d.blah.foo...

> So, about the Jetty side of things. There are APIs for adding virtual
> host names during start-up - use: HttpContext#addVirtualHost(String).
> I'm pretty sure that will also be recognized if added while running.

Here's a thought.

We don't need to hack addVirtualHost. There should be no reason
addVirtualHost *wouldn't* accept something like "*.blah.foo".

We need to hack whichever class maps hostnames to VirtualHosts to do a regex
lookup instead of a simple String.equalsIgnoreCase() (haven't checked the
code, but I'm assuming that's what is done now).

Unfortunately, I don't have time this week to actually write the code to do
this, or I would... creating a proof-of-concept should be pretty easy.

--
Steve Sobol, Professional Geek   888-480-4638   PGP: 0xE3AE35ED
Company website: http://JustThe.net/
Personal blog, resume, portfolio: http://SteveSobol.com/
E: [hidden email] Snail: 22674 Motnocab Road, Apple Valley, CA 92307



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support