Solved

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

Posted on 2003-11-04
12
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
12 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 43 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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 41 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 41 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
servlet example 11 73
Java basic valueOf question 1 45
Netbeans and org.apache.commons.lang3 issue 3 50
Is there a Google Voice API? 9 61
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

740 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