Solved

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

Posted on 2003-11-04
12
255 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
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

825 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