aspose file tools*
The moose likes Servlets and the fly likes where to map the domain name in Tomcat? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "where to map the domain name in Tomcat?" Watch "where to map the domain name in Tomcat?" New topic
Author

where to map the domain name in Tomcat?

arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
In tomcat, i call my jsp through URL:
http://localhost:8080/myapplication/myjsp.jsp
if i have a domain name registered, then how do i map my domain name to the first jsp i want to call. eg if my domain name is:
www.mydomain.com
then where in tomcat do i map www.mydomain.com to http://localhost:8080/myapplication/myjsp.jsp
thanks for the help
arpit
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

You have things back-to-front. The domain name is used to locate the server, not vice versa. When you send a request to http://www.mydomain.com, what you are actually doing is making a request to Domain Name Services to lookup the address of the machine named (or aliased) "www" in the domain "mydomain.com". Then, for good measure, since you requested the http protocol, the message is sent to port 80 on that machine.
Tomcat conventionally uses port 8080 (or, apparently, port 8180 on the rpm distribution of Catalina - countrary to what the documentation says). You could just as easily make it run on port 80 by changing the config file (server.xml) - if you have low-port privileges, but more commonly a forwarding/proxy server is used, such as Apache with mod_jk or mod_webapp.


Customer surveys are for companies who didn't pay proper attention to begin with.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

The sneaky way to do this is to use a META REDIRECT.

I had the same issue. I wanted a domain name (www.mydomain.com) to resolve right down to a certain page.

But the only page that is served with nothing but the domain typed in is 'index.html'

So all you need to do is re-write Tomcat's index.html to do something like this:

So now, when you type www.mydomain.com, Tomcat will serve the 'default' index.html page from it's webapps/ROOT directory.

But you've re-written that page to tell the browser to immediately refresh to the page you really want them to see.
[This message has been edited by Mike Curwen (edited November 09, 2001).]
arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
mike
where do i put this index.html
thanks for your help
arpit
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

He still needs DNS, though for the host part of the server to resolve properly and Tomcat would have to be configured to use port 80.
The redirect may be doing it the hard way. I'd hope that like Apache, Tomcat would have a config parameter that allows you to name the default page anything you like. Failing that, I'd look to see if the mapping facility would save a redirect. I know I can map index.html to a servlet - I don't know if a JSP can be mapped, too, since I'm pulling all this stuff from the top of my empty little head.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Arpit, re-read my last post. I tell you where the index.html is.
Harpreet SinghSingh
Greenhorn

Joined: Sep 23, 2013
Posts: 1
Mike Curwen wrote:The sneaky way to do this is to use a META REDIRECT.

I had the same issue. I wanted a domain name (www.mydomain.com) to resolve right down to a certain page.

But the only page that is served with nothing but the domain typed in is 'index.html'

So all you need to do is re-write Tomcat's index.html to do something like this:

So now, when you type www.mydomain.com, Tomcat will serve the 'default' index.html page from it's webapps/ROOT directory.

But you've re-written that page to tell the browser to immediately refresh to the page you really want them to see.
[This message has been edited by Mike Curwen (edited November 09, 2001).]


where is map www.mydomain.com,
 
jQuery in Action, 2nd edition
 
subject: where to map the domain name in Tomcat?