Solved

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

Posted on 2003-11-04
12
275 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

717 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