This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello, I'm trying to write a servlet which first of all, checks the windows registry to see if a proxy is being used to connect. If this is the case, it will then get the values for the proxy, i.e http and port. then uses the
to enable the use of a proxy server.
I found a way to do this using JNI. But it only works when my application is not a servlet. As soon as I add the methods to my servlet it starts messing up. I've even tried using Runtime as in:
to load the dll, but it doesn't function properly. Can anyone help explain to me how I can use Jni in a servlet. Or if there is any other way, at least how to get the proxy settings for a computer within a servlet. Many thanks.
I found a way to do this using JNI. But it only works when my application is not a servlet. As soon as I add the methods to my servlet it starts messing up.
"starts messing up" is not very clear - does it throw a security exception or what? Security settings aside, a servlet is just a Java program and should be able to do anything a stand-alone application can do. You should also include the Java version and servlet container version in your posts. Bill
Actually last time we did this sort of thing on tomcat, we had problems as well (dont remember the specific exception). But we found out that the dll have to be placed somewhere in tomcat's folders. When running as standalone as long as the dll is in whatever folder your java.library.path System property (when you use the java command) is set to you're all set (in windows you can also dump it in the system32 folder), on an appserver its very different, you have to make sure the dll is placed in whatever is configured as the app server's java.library.path , since you are running within the app servers VM.