Re: handle with a single .war all the request to N subdomains

2008-03-05 Thread Gregory Gerard
Look at the Host header to see how the browser addressed your  
webserver and then you can specialize your output.


theHostString = theHttpServletRequest.getHeader(Host);

if (theHostString != null  theHostString.trim().length  ) {
if (theHostString.startsWith(sub1.)) {
doSub1Content(...);
} else if (...) {
} else {
// unknown subdomain
sendDefaultContent(...);
}
} else {
// someone possible spoofing the host header or HTTP 1.0 which I  
don't believe had the host header

sendDefaultContent(...);
}

greg

On Mar 5, 2008, at 12:52 PM, GF wrote:


Hello,
I have a web application that runs on:

www.myhost.com/myapp/

I would like that the deploy a single .war can handle all the  
requests such as:


sub1.myhost.com/myapp/
sub2.myhost.com/myapp/
sub3.myhost.com/myapp/

And of course i want to receive the parameter on which subdomains the
request has been executed.
Is it possible? Have you any good link about this?

This can be done at Tomcat level.. or should I handle it with
mod_rewrite in Apache and then passing the request to a single path of
 Tomcat using mod_jk?

Thank you!

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: handle with a single .war all the request to N subdomains

2008-03-05 Thread GF
Thank you! for you quick reply!
My problem is a little different, in few words, i'm still at the
previous step, i'm trying to find a way to that all the requests to:

*.myhost.com/myapp/

can be handled by a single war.
So first of all i'm looking if Tomcat handle in someway the wildcard
for sudomains..
I have found something here:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg23452.html

But i've still to search :-)

On Wed, Mar 5, 2008 at 9:59 PM, Gregory Gerard [EMAIL PROTECTED] wrote:
 Look at the Host header to see how the browser addressed your
  webserver and then you can specialize your output.

  theHostString = theHttpServletRequest.getHeader(Host);

  if (theHostString != null  theHostString.trim().length  ) {
  if (theHostString.startsWith(sub1.)) {
  doSub1Content(...);
  } else if (...) {
  } else {
  // unknown subdomain
  sendDefaultContent(...);
  }
  } else {
  // someone possible spoofing the host header or HTTP 1.0 which I
  don't believe had the host header
  sendDefaultContent(...);
  }

  greg




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: handle with a single .war all the request to N subdomains

2008-03-05 Thread Caldarale, Charles R
 From: GF [mailto:[EMAIL PROTECTED] 
 Subject: Re: handle with a single .war all the request to N subdomains
 
 i'm trying to find a way to that all the requests to:
 *.myhost.com/myapp/
 can be handled by a single war.

Unless you've fiddled with the Host config in server.xml, they by
default they will all be handled by one webapp for the one Host.  If
you have added more Host elements, why did you?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]