This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes General Computing and the fly likes how can a single java web app serve multiple domains/subdomains/folders within a domain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "how can a single java web app serve multiple domains/subdomains/folders within a domain" Watch "how can a single java web app serve multiple domains/subdomains/folders within a domain" New topic
Author

how can a single java web app serve multiple domains/subdomains/folders within a domain

Arvind Ik Chari
Greenhorn

Joined: Dec 02, 2012
Posts: 13
Hello,

I am working on a CMS --this will basically be a Java web app (WAR File).

Now suppose the app will be deployed at http://www.domain.com/

Now, I want the same web app to serve multiple websites, in the following scenarios--

(1) Same web app serves multiple folders within the main single domain-- www.domain.com/folder1 and www.domain.com/folder2 and so on.

(2) Same web app serves multiple sub domains within the main single domain-- http://site1.domain.com/ and http://site2.domain.com/ and so on.

(3) Same web app serves different domains-- http://www.domainnew1.com/ and http://www.domainnew2.com/ and so on.

What kind of configuration changes/coding do I have to do, to make the above happen with my single java web app. Also, what kind of DNS records/configuration has to be done for this purpose?

Thanks,
Arvind.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I was about to point out that the way to arrange that would be to configure the DNS entries for the domain so that they mapped requests to the machine where your server is located. But I see you have already figured that out for yourself.

So, if you want the DNS changed to do that, then you should ask the people who are hosting your domains to do it. First of all it's their job to do that, and second of all they won't want beginners getting in there and messing with their DNS.
Arvind Ik Chari
Greenhorn

Joined: Dec 02, 2012
Posts: 13
Hello Paul,

Actually I understand how to serve different websites with each folder mapped to one website. However, I do wish to know in greater detail exactly what kind of DNS records have to be created for the other 2 scenarios-- viz serving different websites in subdomains of a domain, and serving different websites in different domains. If you could shed some more light on the exact types of DNS records that have to be created, that is what I am looking for...

Thanks,
Arvind.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7492
    
  18

Arvind Ik Chari wrote:Actually I understand how to serve different websites with each folder mapped to one website. However, I do wish to know in greater detail exactly what kind of DNS records have to be created for the other 2 scenarios-- viz serving different websites in subdomains of a domain, and serving different websites in different domains. If you could shed some more light on the exact types of DNS records that have to be created, that is what I am looking for...

This doesn't really sound like a Java question to me, but I'm not sure exactly where to move it.

DNS administration is a bit of a nightmare (at least it was when I had to deal with named), and very easy to get wrong; which is why Paul is absolutely right: nobody is going to be wanting you mucking about with their DNS records.

If you're really interested, I'd suggest Googling something like "DNS administration", and see what you get.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can a single java web app serve multiple domains/subdomains/folders within a domain
 
Similar Threads
Interaction between WebApp and Java
Getting ready for the job market quickly - so many technology combinations, how to focus ?
Crystal Report Problem
Understanding creating a "super" class obj from a "subclass" object
uploading images and java