Solved

Getting web server id from applet

Posted on 1998-11-17
5
151 Views
Last Modified: 2010-03-30
How can an applet get the name and/or the IP address
of the Web server machine.
Please do not suggest, passing them as parameters, I want
to use one HTML file in many installations.
0
Comment
Question by:mco
  • 2
  • 2
5 Comments
 

Expert Comment

by:hemadri
ID: 1227625
Try using InetAddress class's getLocalHost() method and use getHostName() method.
0
 
LVL 1

Author Comment

by:mco
ID: 1227626
No, that gives me the name of the local machine (where the browser is running).
I need the machine where the Web server, from which the applet was loaded, runs.

0
 
LVL 1

Author Comment

by:mco
ID: 1227627
No, that gives me the name of the local machine (where the browser is running).
I need the machine where the Web server, from which the applet was loaded, runs.

0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 50 total points
ID: 1227628
(working from memory )
this should work

this.getCodebase().getHost();

(where this is the Applet)
or i'm wrong ?

P.S. Are you sure that getLocalHost WILL return the local machine address (for unsigned applet). What about security restrictions ??


0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227629
and then InetAddress.getByName to find the IP address

public static InetAddress getByName(String host) throws UnknownHostException

hope this helps
  heyhey

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven module vs maven project 3 68
How to determine if a string is a valid SHA value 7 43
Notify sent to other threads in Java 9 41
passing enum to a method 4 34
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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 …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.

685 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