The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Adding a Proxy user in VW

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Adding a Proxy user in VW Posted: Nov 17, 2003 6:53 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Adding a Proxy user in VW
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement
One of the things you have to deal with when building an HTTP aware application is proxy user settings. VW has a settings tool within the environment for setting and managing proxy settings - the trouble is, it's not necessarily set up for simple reuse within a free standing application. Fortunately, it's not terribly difficult to set up programmatically (building a simple UI to go with this code is left as an exercise for the reader). First off, you need to define a network user:

user := NetUser new.
user fullName: 'First Last'.
user username: 'username'.
user password: 'password'.
user savePassword: true.

Now that you have a user, you'll need to actually add that user to the system registry. If your application is single user, you can go ahead and make that user the default user. If it's not single user, you'll need a way to switch users, and just toggle which one is the default. Here's how to set a user up as the default user:


Net.Settings  addIdentity: user.
Net.Settings  defaultIdentity: user.

Now you've got a user defined, and registered with the system. But what about setting the proxy server, and enabling proxy usage? Here's how you define a proxy server and hand it the appropriate user:


netSettings := Net.Settings.
netSettings httpUseProxy: true.
netSettings httpKeepAlive: true.
netSettings httpRedirectRequest: true.
netSettings httpProxyHost: 
	(HostSpec new
		name: serverNameString;
		port:  port asNumber;
		type: 'http';
		netUser: user;
		yourself).

That will set your application up to use a proxy server, with the appropriate user. To disable proxy usage without getting rid of the settings, all you need to do is toggle the httpUseProxy setting. That's pretty much it; it's not hard to do. This code is what BottomFeeder uses to set up proxy services.

Read: Adding a Proxy user in VW

Topic: Master feed for the Smalltalk blogs Previous Topic   Next Topic Topic: Light reading

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use