• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

How to record an ip with the Java Web Start client?

Hi experts,

My application runs as a Java client which connects to the JBoss server on another machine. I woul d like to log the ip of the person who logs in. Usually delivered as Java Web Start.

1. Can I get his ip in the client code?
2. Maybe I should record it on the server using server's web interface though which the client is started? My only concern here is that the jnlp file is a link. Clicking on it starts the app - where is my trigger to record ip?

Thank you.
0
kerzner
Asked:
kerzner
  • 10
  • 9
  • 8
  • +1
1 Solution
 
objectsCommented:
1. http://www.objects.com.au/java/qa/1360122715.html

2. Get it from request, and also get your client to collect it
0
 
objectsCommented:
the ip gathered on the client will be more accurate, think your code will need to be signed though to get it.
0
 
kerznerAuthor Commented:
Thank you, objects, this

InetAddress address = InetAddress.getLocalHost();
byte[] ip = address.getAddress();

gets me 127.0.0.1, I hoped to obtain the outside ip
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
objectsCommented:
this shows how to get all ip's

http://www.objects.com.au/java/qa/191009181.html
0
 
CEHJCommented:
Why not get the ip at the server end?
0
 
kerznerAuthor Commented:
Hi CEHJ

 Clicking on it starts the app - where is my trigger to record ip?
0
 
CEHJCommented:
kerzner, how will you know which one of potentially several ip addresses was used with that approach?
0
 
CEHJCommented:
>>Clicking on it starts the app - where is my trigger to record ip?

The trigger is when a uniquely-ip-addressed connection is received at the server. What better trigger can there be? ;-)
0
 
objectsCommented:
>  Clicking on it starts the app - where is my trigger to record ip?

you can get it from the request as I originally mentioned.
Not guaranteed it will be correct though
0
 
kerznerAuthor Commented:
thank you, CEHJ, your input is certainly valuable too - how do I give you points? How about if I add them on the next question I ask?
0
 
CEHJCommented:
>>how do I give you points? How about if I add them on the next question I ask?

No - that's against site rules. The correct approach is to award them here. I'll get the q. reopened - you don't need to do anything yet
0
 
objectsCommented:

> your input is certainly valuable too

I already mentioned getting it from the request, he just repeated what I already stated.

> how do I give you points?

you don't, EE clear on comments made on closed questions. no points required (or reopening)

0
 
kerznerAuthor Commented:
guys, please, don't argue. You are both smart, 100 times more than I am, and you both deserve points. Somehow it will work out
0
 
kerznerAuthor Commented:
Ok, maybe I can ask this question - I am not sure how to I get the ip when the user clicks.

I mean, here is my jsp page. When it works, I know that it works and I can get the ip.

But after it has sent the html to the client browser, and he clicks on the jnlp link, then the server just serves this jnlp file and the applications starts. Where is the hook in my code, sort of a callback for me?
0
 
CEHJCommented:
http://www.rgagnon.com/javadetails/java-0363.html

shows you how to get the address, then it's just a matter of storing it
0
 
kerznerAuthor Commented:
Of course, but when an html link is clicked and a jnlp file is served, no jsp page is working.

I could change this, and serve the jnlp file programmatically. Actually, it could be a good idea, because it would then allow to me serve different jnlp files from different servers.

If that makes sense, I found an answer to my question.
0
 
CEHJCommented:
>>I could change this, and serve the jnlp file programmatically.

Well yes, but you don't necessarily need to serve it programatically. Simply invoke a jsp page instead of an html one
0
 
kerznerAuthor Commented:
I hate to be picky, but there is some misunderstanding between us.

It is already a jsp page. When it finishes working, it creates an html page, and this is what the server send to the client browser. Then the user clicks on a link in this html page, and after this no jsp is involved.

But serving jnlp page programmatically actually is even better, so I would say we are done.
0
 
CEHJCommented:
>>But serving jnlp page programmatically actually is even better, so I would say we are done.

Yes, that would give you ultimate control
0
 
CEHJCommented:
:-)
0
 
objectsCommented:
Netminder,

The comments posted by CEHJ simply repeated what had already been said.

Plus EE clearly states:

"Further discussion or comments related to this question may be posted to help clarify the solution, update the solution if the information is outdated, show alternate ways the solution worked for you, or other related comments. No additional expert points may be awarded to this solution."

So what exactly is going on here?? I answer the question and CEHJ gets awarded the majority of the points.

Does this mean you can go around commenting on open questions in an attempt to get them reopened???

0
 
objectsCommented:
kerzner,

exactly which comments of CEHJ did you think answered the question (How to record an ip with the Java Web Start client?) better than what I posted??
0
 
NetminderCommented:
objects / CEHJ,

This has gone on long enough, so after consulting with EE and Computer101, we have decided that this is what is going to happen, beginning with this question, and will continue henceforth:

If either of you "takes it upon yourself" to suggest TO the Asker or FOR the Asker -- be that by email, a request to either CS or CA, or carrier pigeon -- that a question be reopened so points can be reallocated, we will make note of the solutions -- both the accepted one and the one suggested by the discussion comments. We will then reopen the question and post a comment noting those comments:

http:/#20073441
http:/#20080522

We will then reduce the points to zero and close the question, accepting the Administrative comment as the answer. The Moderators, the Community Advisors, and the customer service staff at EE have been informed of this procedure. It is truly unfortunate that it has had to come to this, but the incessant battle between the two of you over who is right and who is wrong must stop.

Netminder
Site Admin
0
 
CEHJCommented:
Well, as you can see, i was responding to the wishes of the questioner, following the site's rules against 'points passing':

>>thank you, CEHJ, your input is certainly valuable too - how do I give you points? How about if I add them on the next question I ask?
0
 
kerznerAuthor Commented:
sorry to have caused the disagreement, both guys are great
0
 
CEHJCommented:
>>sorry to have caused the disagreement, both guys are great

Noooooo kerzner - you're not in any way responsible. Don't worry
0
 
objectsCommented:
> sorry to have caused the disagreement, both guys are great

not your fault. Just ask a new question next time if you have something else you want to ask about.
Or ask me for clarification on any answer I post :)
0
 
kerznerAuthor Commented:
love you both guys!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 10
  • 9
  • 8
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now