File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes struts dns tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "struts dns tomcat" Watch "struts dns tomcat" New topic
Author

struts dns tomcat

Luca Carletti
Greenhorn

Joined: Jun 15, 2010
Posts: 12
Hello,

I' m Italiano and sorry for my english!!!


I have the question:

I have a webSite whit:
1) Apache Tomcat 6.0.20
2) Framwork struts 1

my webSite lose the dns:

Exemple:
1)supposing my site: http://www.mysite.it
2)supposing Apache Tomcat IP --> 111.112.113.114 port 8080

when i execute a action for examples login.do,

I want my url:

http://www.mysite.it/login.do

but I have

http://111.112.113.114:8080/login.do --> (my site lose the dns)


thanks, by!!!








Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Benvenuto, Luca! Welcome to the JavaRanch.

I think your problem is probably that you need reverse DNS. Normal "forward" DNS looks up a domain hostname and returns its IP address. Reverse DNS takes an IP address and returns a domain hostname (also known as a fully qualified domain name). You can operate with only forward DNS, but it does cause some problems, and your problem may be one of them.


Customer surveys are for companies who didn't pay proper attention to begin with.
Luca Carletti
Greenhorn

Joined: Jun 15, 2010
Posts: 12


Thank you for replace, I have search about the reverse DNS, but I don't know...
Can you write code e what file I must use...

I think that I must modify a file for apache tomcat...

The only file that I think is server.xml!
Is it correct???
But how I must modify the code???
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

You do not code anything. DNS is provided by the Domain Name Server, which is not part of the Tomcat environment. It's completely outside it, and it is often not even in your datacenter, since your Internet Service provider can supply DNS services for a generally modest fee.

Normal DNS maintains the directory that does forward mapping, taking a fully qualified domain/hostname and returing an IP address like so:

www.mousetech.com -> 216.199.14.18

However, there's another directory in DNS that does the reverse mapping (reverse DNS):

216.199.14.18 -> www.mousetech.com

Whoever set up your DNS server didn't set up a corresponding reverse mapping for your domain/host.
Luca Carletti
Greenhorn

Joined: Jun 15, 2010
Posts: 12
Hello, many thanks for your time!!!I have know about the reverse dns, but
my site is on hosting services.
I have send a email by systems engineer of hosting about your replace, but they say that the problem is how the url is created!!!
I think about the problem is struts that use path relative for generate the url!





Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Struts has an HTML "base" tag that can be placed on a webpage. It will direct the formation of relative URLs.
Luca Carletti
Greenhorn

Joined: Jun 15, 2010
Posts: 12
In effect the tag html <base>
is:

<base href="http://111.112.113.114:8080/jsp/login.jsp">

in the index page!!

But url is:
http://www.mysite.it/jsp/login.jsp


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Don't use the raw HTML "base" tag. Use the Struts tag, which I think is usually "<h:base/>".

It will pull context from the incoming URL and use it as the argument for the generated HTML base.

I think somebody gave an example of that in this forum a few weeks ago.
Luca Carletti
Greenhorn

Joined: Jun 15, 2010
Posts: 12
Excuse me for the message, but the

<base href="http://111.112.113.114:8080/jsp/login.jsp">

is the view of the page source of the html.
But for generate it i have use the stuts library!!

The source code is:
<%@ taglib uri="/tags/struts-html" prefix="html" %>

<html:base/>
Luca Carletti
Greenhorn

Joined: Jun 15, 2010
Posts: 12
I think in effect that the problem is really struts when use a action (servlet), struts use path relative in web.xml for achieve the struts-config.xml and this use path relative for the forwording!!!

Know you if exist some configuration in struts to indicate the path absolute or to indicate a struts the begin part of the url???
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

If you're using forwarding, you may be losing the orignal URL.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts dns tomcat