Solved

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

Posted on 2003-11-04
12
235 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
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9684463
Hi,
delete the other link you have posted as it is not necessary :-)
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now