Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

Proxies

Thread view: 
freesoft_2000 - 16 Jul 2005 20:51 GMT
Hi everyone,

If i were to set the http proxy for a particular url i did this

Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost", proxy);
systemProperties.setProperty("http.proxyPort", port);

Is the way that i did the best way to do it and am i doing it correctly??

Richard West
Hemal  Pandya - 17 Jul 2005 16:51 GMT
> Hi everyone,
>
[quoted text clipped - 5 lines]
>
> Is the way that i did the best way to do it and am i doing it correctly??

Depends on who is going to use the proxy value. If it is some API that
looks for the proxy settings in the system properties then this is the
right way to do it. If the API is not going to look in system
properties then this is useless.

> Richard West
Esmond Pitt - 18 Jul 2005 01:15 GMT
Hemal Pandya wrote:

>>If i were to set the http proxy for a particular url i did this
>>
[quoted text clipped - 8 lines]
> right way to do it. If the API is not going to look in system
> properties then this is useless.

If you don't know the answer please don't just create noise.

As the API concerned is the Java Development Kit, specifically
java.net.HttpURLConnection and the sun.* classes it uses, this way of
doing it is correct.
freesoft_2000 - 22 Jul 2005 16:37 GMT
Hi Everyone,

            esmond tahnks for your reply but i have one more question in
that if my proxy requires a username and password i do this

System.setProperty("http.proxyUser","user");
System.setProperty("http.proxyPassword","password");  

Is the way that i did the best way to do it and am i doing it correctly??

Another thing i have to ask you is that proxy authentication, is the same
as web page authentication??

Richard West
Esmond Pitt - 23 Jul 2005 08:10 GMT
> if my proxy requires a username and password i do this
>
> System.setProperty("http.proxyUser","user");
> System.setProperty("http.proxyPassword","password");

I am not aware of these properties. AFAIK you have to use a
java.net.Authenticator.

> Another thing i have to ask you is that proxy authentication, is the same
> as web page authentication??

Well, there are two values for Authenticator.RequestorType, so there is
a difference.
freesoft_2000 - 23 Jul 2005 11:56 GMT
Hi everyone,

             Thanks for answering to my reply Esmond. I read up on the
Authenticator class and now know how to use it but i have one more
question.

             Can the Authenticator class also be use to access a password
protected https or ftp site or is the Java Authenticator class only meant
for http internet protocol only.

              If it can access more than http have you done it before and
did it work??

              I know these may seem like basic questions to you but
please bear with me.

Hoping to hear from you

Yours Sincerely

Richard West
Esmond Pitt - 24 Jul 2005 06:28 GMT
> Thanks for answering to my reply Esmond. I read up on the
> Authenticator class and now know how to use it but i have one more
[quoted text clipped - 3 lines]
> protected https or ftp site or is the Java Authenticator class only meant
> for http internet protocol only.

HTTP or HTTPS, proxy or server.

> If it can access more than http have you done it before and
> did it work??

Probably at some point, I can't remember for sure.
freesoft_2000 - 26 Jul 2005 10:46 GMT
Hi everyone,

             Sorry Esmond but going back to the proxy story in my first
post i did something like that

Properties systemProperties = System.getProperties();
systemProperties.setProperty("ftp.proxyHost", proxy);
systemProperties.setProperty("ftp.proxyPort", port);

but i notice that in one wesite that i have read some people did it like
this

Properties systemProperties = System.getProperties();
systemProperties.setProperty("ftpproxyHost", proxy);
systemProperties.setProperty("ftpproxyPort", port);

Are both versions correct??
If not which is the correct version and which one do you normally use??

Richard West
Esmond Pitt - 27 Jul 2005 09:58 GMT
> Hi everyone,
>
[quoted text clipped - 14 lines]
> Are both versions correct??
> If not which is the correct version and which one do you normally use??

There are some old system properties e.g. proxyHost/proxyPort which are
still supported because their existence 'leaked' (from the HotJava
Bean), and there is also proxySet which people are still coding into
applications even though it has made no difference for about seven
years. Use the http.* and ftp.* ones.

EJP


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.