proxy host System.setProperty question

2009-11-17 Thread J- MAN

Hi,

i'm sure this has been asked a hundred times, but i can't find the answer on 
google.  I'm trying to make my servlet connect to an external webservice, but 
we have an http proxy at work.  

I was initially trying to put this code in my servlet method:

System.setProperty(http.proxyHost, proxy.myHost.com);
System.setProperty(http.proxyPort, 80);

Which works fine when run as a normal Java application, but does not work when 
run inside tomcat servlet.  I have to manually add 

http.proxyPort=80
http.proxyHost= proxy.myHost.com

To my catalina.properties file for it to work.  why does it work from 
catalina.properties but not from System.setProperty??

Thanks,

-J
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/

System.setProperty question

2006-06-07 Thread Rumpa Giri
Why the system properties are not being set programmatically?
   
  When I say does not take affect it happens only when we do things in a 
certain order.
   
  For example we need to connect to URL_CACERTS and URL_KS. URL_KS connection 
needs the keystore properties. For URL_CACERTS we just imported their public 
key to cacerts.
   
  Case 1: If we connect to URL_CACERTS first and then to URL_KS, connection to 
URL_KS is not successful. Somehow the setting keystore properties does not take 
affect. We have the following lines of code before doing the HttpURLConnection:
  System.setProperty(javax.net.ssl.keyStorePassword, _storePwd);
System.setProperty(javax.net.ssl.keyStore, _keystorePath);
   
  Case 2: If we connect to URL_KS first, and then URL_CACERTS, this sequence 
always works, somehow the keystore properties are set for the entire length.
   
  So to overcome this conflict, we added the properties to the tomcat service:
   
  If we start the tomcat service(or adding to catalina.bat) with the following 
parameters:
  -Djavax.net.ssl.keyStorePassword=changeit
-Djavax.net.ssl.keyStore=C:\certificates\pntKS
   
  These system properties setting takes affect, and order of conneting to 
URL_CACERTS or URL_KS does not matter.
   
  My question in how is connecting to URL_CACERTS first affecting the keystore 
properties?
   
  Without the above and doing the following only, its dependent on the order of 
connection. why?
   
  when we do the same thing by doing this it does not take affect 
  System.setProperty(javax.net.ssl.keyStorePassword, _storePwd);
System.setProperty(javax.net.ssl.keyStore, _keystorePath);
   
  Connecting to URL_CACERTS does not have any special code, we do plain 
HttpURLConnection and write and read from the http connection.
   
  What is happening behind the scene? Why does order matter?
   
  Thanks for reading.
  Rumpa Giri
   

 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com