i want to get client MAC address (in jsp,java)
it's possible? how to do?
thanks for help
Unfortunately, this is not possible directly in JSP because it will not be passed as part of the HTTP Header. You would need to have some client side script to run, that has access to the network adapter to find this information.
I am not sure if an applet would be able to get this for you, but this would need extended permissions if it were possible, and a user is unlikely to allow it.
Why? Are you aware they can be changed by intermediiate routers? And users? So they are of no practical use except to the network layer?
Related
I created an application that needs information from my website. But I don't want this information to be accessible by any other way. My client-sided app has to be the only entity that can get this information. How can I achieve that?
After some research, I have found these solutions, but I am not sure which approach is the best?
Custom user agent
Password is the request
httpassword, but how to handle it in Java?
If someone want to get this information outside of your app, there is no way to prevent it, if the person really want get it. They can just decompile your code and analyse the function. This should be clear.
But for preventing it for normal people, you can use a robots.txt, user agent, custom HTTP Headers and other things you mentioned. Just an encryption could be helpful too.
I would suggest a private subdomain, combined with API keys (per HTTP Headers) and an encryption.
You can whitelist the IP address of your application from your website.
I'm building my own HTTP server in java, but i'm facing with a problem: I would like to build a page dynamically by creating every HTML object at runtime, the question is: how can i determine the screen dimension of the client's browser?
This information is not present in the HTTP header, so I was thinking about writing a "fake" webpage that runs a javascript that tells the server about the screen (it should redirect to something like www.website.com/w:1920,h:1080) but I don't know anything about cookies (that I suppose are essential to store those informations).
Do you think that I should learn somthng about cookies or there's another way?
BTW I'm not using servlets, just Socket, because that's what I know... should I use servlets?
Thanks for your time!
Matteo
Server knows nothing about client's screen until client send this information. Javascript is easiest way to determine screen size:
window.screen.availHeight
window.screen.availWidth
AJAX request can be used to send the information to the server where it can be stored in session data and backed in database for example if the user is logged in or identified somehow. In such case you don't need cookies. However solution with cookies is easier, check how to set them via javascript. But I'm afraid such solution would be a bit of non-standard, if your site is gonna depend on javascript why not to use it extensively and generate all objects on client side, get that lazy computer working and save your server's resources :) Just feed data by sending simplest HTML containing script doing the work.
Servlets? Can be really light-weight and done with minimal knowledge if you have time go for it.
I want to activate the back button of the HTML-browser. with a JAVA command not Javascript.
does anyone know how?
Assuming you are talking about an applet: I assume you would have to use the netscape.javascript packages to hit the JS API for it.
If you are talking about server side Java, then you have no way to trigger the back functionality. The closest you could come would be to read the referer (warning: Optional! Sometimes forged! Make sure it is a URI on your domain!) and issue a Location header to redirect forwards to it.
You can't. Java runs on the server. JavaScript runs on the client. You could have a JSP output JavaScript which is then run at client time in the browser.
Wondering if anyone knows if there is a way to "return" something from a java web start application into the code on the website. For example say the user needed to select a location in the java application. This would then pass the location value back to the code on the webpage (which is php and javascript). I have figured out how to pass arguments into a program, but so far cannot figure out any way to get them out after much googling. Any help would be much appreciated, thanks.
In principle no, since the Webstart application can be running without any Website open at all.
But if your clients use the Java-plugin from 1.6.0_10 or later (and not Safari and some other browsers with special Java-handling), you can use a JNLP-enabled applet, which is able to do the same things as a Webstart application (i.e. loading files and such), and is always bound to a webpage. It then can use the Javascript-bridge, or simply a loadDocument with the right parameters to feed back information.
You can use URL or sockets to connect back to the "same-origin" host. You can also use BasicService to open a web page, possibly from a different server, in a browser (although this shouldn't be used to send information back, as it'll be a GET not a POST).
I've been trying to find a proper way to pass some information, such as password, to my applet. Since the code is executed on the client, I don't want to put that information in clear text in the "param".
I'm using php as script to generate the web page. So, I was wondering if there was already some kind of solution/mechanism? If not, I suppose the only way would be to encrypt the password in php, pass it as a param and decrypt in the applet? My only problem would be that the way to decrypt it would be in the client applet as well. For that I suppose that someone could decompile the applet and look for it? Or is it safe enouph?
Anyway, I'm looking for a good solutions, hope there is one?
Thanks in advance.
There is no secure way to do this. Any data the applet has access to the user has access to. It is quite trivial to decompile Java applets, and even obfuscators only add a little delay.
An idea:
The applet can contact the server for the password (let's say using https).
Then connect to the (s)ftp server.
Note that if you're using ftp and not sftp, maybe the password is passed in clear on the network.