Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JSP - Website - Need to find user's domain name

Posted on 2003-11-04
12
Medium Priority
?
278 Views
Last Modified: 2012-05-04
Extremely new to Java.

Creating a two websites - one is secure, one is non-secure. Based on whatever domain (i.e. .com, .org, .gov, etc.) will determine what site the user will be redirected to. Anyone have any ideas of how to accomplish this. My initial thought is that if I can easily find the domain from which the user is coming from, I could accomplish this. However, I have only found how to retrieve the user's IP address, which doesn't really help because they could be accessing the Internet through a firewall (internal IP address). Any suggestions or help to point me in the right direction would be most appreciated! Thanks in advance.

~JBee
0
Comment
Question by:jbee1301
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9683617
You can't.
0
 
LVL 2

Expert Comment

by:f_98
ID: 9683982
not really sure this would work, try using getRemoteHost() instead of getRemoteAddress() from a servlet request, it will return the REMOTE_HOST property (fully qualified name) BUT  the container is not required to resolve it so if can not or refuses to, it will still give you the IP address
0
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 172 total points
ID: 9684447
http://www-tcsn.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20725826.html
http://www.experts-exchange.com/Operating_Systems/Q_20679472.html
http://www.milov.nl/forum/1/1686

http://javascriptkit.com/script/script2/displayip.shtml

I suggest you to read folloig discussions
some javascript related code that was discussed in above links could help you


and also some SSI related work could help u.

regards,
sudha

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9684463
Hi,
delete the other link you have posted as it is not necessary :-)
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 164 total points
ID: 9686625
Try running the following with the parameters

nslookup www.xxx.yyy.zzz

import java.io.*;

public class RunAsync {

    public static void main(String args[]) {

     try {

        if(args.length < 1) {
          System.out.println("Usage: java RunAsync <command string>");
          System.exit(-1);
        }
        Process pro = null;
        if (args.length > 1) {
          pro = Runtime.getRuntime().exec(args);
        }
        else {
          pro = Runtime.getRuntime().exec(args[0]);
        }
        InputStream error = pro.getErrorStream();
        InputStream output = pro.getInputStream();
        Thread err = new Thread(new OutErrReader(error));
        Thread out = new Thread(new OutErrReader(output));
        out.start();
        err.start();
        pro.waitFor();
     }
     catch(java.io.IOException e) {
       e.printStackTrace();
     }
     catch(java.lang.InterruptedException e) {
       e.printStackTrace();
     }

    }

    static class OutErrReader implements Runnable {
      InputStream is;

      public OutErrReader(InputStream is) {
        this.is = is;
      }

      public void run() {
        try {
          BufferedReader in = new BufferedReader(new InputStreamReader(is));
          String temp = null;
          while((temp = in.readLine()) != null) {
             System.out.println(temp);
          }
          is.close();
        }
        catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
}
0
 
LVL 92

Assisted Solution

by:objects
objects earned 164 total points
ID: 9690748
Doesn't matter what you do, firewalls/proxies will still hide the details of the actual client.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9693695
If they're using a proxy there could be a problem. This, on the other hand,

>>because they could be accessing the Internet through a firewall (internal IP address).

is an unnecessary worry: in order to establish a TCP/IP connection to the client a routable address is required. This can't be a 'private' one, or you'd have no conversation in the first place.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 11426708
split points between sudhakar_koundinya and CEHJ
0
 
LVL 92

Expert Comment

by:objects
ID: 11430931
better including me in the split for mention of firewall problems :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question