• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

where to map the domain name in Tomcat?

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mike
where do i put this index.html
thanks for your help
arpit
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Arpit, re-read my last post. I tell you where the index.html is.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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,
 
My previous laptop never exploded like that. Read this tiny ad while I sweep up the shards.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic