WebClient-Monticello

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

WebClient-Monticello

Sven Van Caekenberghe
Hi,

I wrote a proof-of-concept Monticello server implementation called MCWebServer, using WebServer from Andreas Raab's WebClient package. I think this is a nice example of how to use WebServer for something useful and real. It also documents the MC HTTP client/server protocol with working code. It is available from http://www.squeaksource.com/ADayAtTheBeach as WebClient-Monticello.x.n.mcz.

Load the code using Gofer (the code was written in Pharo but should be portable) (alternatively use Installer or do it manually):

Gofer new squeaksource: 'WebClient'; package: 'WebClient-Core'; load.
Gofer new squeaksource: 'ADayAtTheBeach'; package: 'WebClient-Monticello'; load.

Setting up your own minimal MC source code repository is now very easy:

(MCWebServer reset default)
        directory: (FileDirectory  on: '/tmp/monticello/');
        addUser: 'john' withPassword: 'secret';
        listenOn: 8800.

Make sure the specified directory exists. Choose a server port that is unused.

Access with the following specification:

MCHttpRepository
        location: '<a href="http://localhost:8800'">http://localhost:8800'
        user: 'john'
        password: 'secret'.

Enjoy,

Sven

--
Sven Van Caekenberghe - http://homepage.mac.com/svc
Beta Nine - software engineering - http://www.beta9.be



Reply | Threaded
Open this post in threaded view
|

Re: WebClient-Monticello

garduino
Hi:

Thanks by share. I will take a look as soon as I can.

In the maintime want to ask if you have extended/implemented on
WebClient the possibility of make post's with multipart/form-data (See
my mail of yesterday with subject: "Using WebClient").

Cheers.
Germán.


2010/6/22 Sven Van Caekenberghe <[hidden email]>:

> Hi,
>
> I wrote a proof-of-concept Monticello server implementation called MCWebServer, using WebServer from Andreas Raab's WebClient package. I think this is a nice example of how to use WebServer for something useful and real. It also documents the MC HTTP client/server protocol with working code. It is available from http://www.squeaksource.com/ADayAtTheBeach as WebClient-Monticello.x.n.mcz.
>
> Load the code using Gofer (the code was written in Pharo but should be portable) (alternatively use Installer or do it manually):
>
> Gofer new squeaksource: 'WebClient'; package: 'WebClient-Core'; load.
> Gofer new squeaksource: 'ADayAtTheBeach'; package: 'WebClient-Monticello'; load.
>
> Setting up your own minimal MC source code repository is now very easy:
>
> (MCWebServer reset default)
>        directory: (FileDirectory  on: '/tmp/monticello/');
>        addUser: 'john' withPassword: 'secret';
>        listenOn: 8800.
>
> Make sure the specified directory exists. Choose a server port that is unused.
>
> Access with the following specification:
>
> MCHttpRepository
>        location: '<a href="http://localhost:8800'">http://localhost:8800'
>        user: 'john'
>        password: 'secret'.
>
> Enjoy,
>
> Sven
>
> --
> Sven Van Caekenberghe - http://homepage.mac.com/svc
> Beta Nine - software engineering - http://www.beta9.be
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: WebClient-Monticello

Sven Van Caekenberghe
Hi Germán,

I never wrote code to do the client side of a multipart/form-data encoded post, but I did do the server part (in Common Lisp), although it was a long time ago. Furthermore I remember that it was a bit of a mess ;-)

But looking at the Drakma Common Lisp web client documentation ( http://www.weitz.de/drakma/#form-data ) it seems as if they are doing what you are looking for, which would essentially be a mix between your code and Andreas' form post code: i.e. combine parameters with files in one post using another encoding.

Still, you will always have to known upfront which fields are expected.

Maybe if I have some time I will look into it, but I can't promise anything.

Sven


On 23 Jun 2010, at 01:24, Germán Arduino wrote:

> Hi:
>
> Thanks by share. I will take a look as soon as I can.
>
> In the maintime want to ask if you have extended/implemented on
> WebClient the possibility of make post's with multipart/form-data (See
> my mail of yesterday with subject: "Using WebClient").
>
> Cheers.
> Germán.
>
>
> 2010/6/22 Sven Van Caekenberghe <[hidden email]>:
>> Hi,
>>
>> I wrote a proof-of-concept Monticello server implementation called MCWebServer, using WebServer from Andreas Raab's WebClient package. I think this is a nice example of how to use WebServer for something useful and real. It also documents the MC HTTP client/server protocol with working code. It is available from http://www.squeaksource.com/ADayAtTheBeach as WebClient-Monticello.x.n.mcz.
>>
>> Load the code using Gofer (the code was written in Pharo but should be portable) (alternatively use Installer or do it manually):
>>
>> Gofer new squeaksource: 'WebClient'; package: 'WebClient-Core'; load.
>> Gofer new squeaksource: 'ADayAtTheBeach'; package: 'WebClient-Monticello'; load.
>>
>> Setting up your own minimal MC source code repository is now very easy:
>>
>> (MCWebServer reset default)
>>        directory: (FileDirectory  on: '/tmp/monticello/');
>>        addUser: 'john' withPassword: 'secret';
>>        listenOn: 8800.
>>
>> Make sure the specified directory exists. Choose a server port that is unused.
>>
>> Access with the following specification:
>>
>> MCHttpRepository
>>        location: '<a href="http://localhost:8800'">http://localhost:8800'
>>        user: 'john'
>>        password: 'secret'.
>>
>> Enjoy,
>>
>> Sven
>>
>> --
>> Sven Van Caekenberghe - http://homepage.mac.com/svc
>> Beta Nine - software engineering - http://www.beta9.be
>>
>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: WebClient-Monticello

Chris Cunnington
In reply to this post by Sven Van Caekenberghe
I like this a lot and will be combing over it for a while. 

I did find in your instructions that:

directory: (FileDirectory on: '/tmp/monticello')

presented some problems for me. Putting a folder called "monticello" in the Squeak folder, ensuring anybody could write/read to it, 
and then using: 

directory: (FileDirectory default directoryNamed: 'monticello')

worked as expected. 

I don't think MCWebServer could find the directory due to an incomplete path. I have a feeling that you expected the relative path to be assisted by the fuller path that gets put into the directory instvar during initialization. But I don't think the example instructions you've provided do that. They clobber whatever's in the directory instvar and leave it with only a relative path. That seems to be why I was getting errors. 

Thanks for sharing this. 

Chris 






Reply | Threaded
Open this post in threaded view
|

Re: WebClient-Monticello

Sven Van Caekenberghe
Chris,

On 23 Jun 2010, at 18:47, Chris Cunnington wrote:

> I like this a lot and will be combing over it for a while.
>
> I did find in your instructions that:
>
> directory: (FileDirectory on: '/tmp/monticello')
>
> presented some problems for me. Putting a folder called "monticello" in the Squeak folder, ensuring anybody could write/read to it,
> and then using:
>
> directory: (FileDirectory default directoryNamed: 'monticello')
>
> worked as expected.
>
> I don't think MCWebServer could find the directory due to an incomplete path. I have a feeling that you expected the relative path to be assisted by the fuller path that gets put into the directory instvar during initialization. But I don't think the example instructions you've provided do that. They clobber whatever's in the directory instvar and leave it with only a relative path. That seems to be why I was getting errors.
>
> Thanks for sharing this.
>
> Chris

Thanks for testing! It did work on my system (Mac OS X, Pharo 1.1), but maybe I introduced something non-portable here. Now that I think of it, does a slash separated path work on all platforms ? Probably not. Maybe the only portable way to do it is compose FileDirectory objects like you did.

Sven


Reply | Threaded
Open this post in threaded view
|

Re: WebClient-Monticello

garduino
In reply to this post by Sven Van Caekenberghe
Hi Sven:

2010/6/23 Sven Van Caekenberghe <[hidden email]>:
> Hi Germán,
>
> I never wrote code to do the client side of a multipart/form-data encoded post, but I did do the server part (in Common Lisp), although it was a long time ago. Furthermore I remember that it was a bit of a mess ;-)
>

Same here :)


> But looking at the Drakma Common Lisp web client documentation ( http://www.weitz.de/drakma/#form-data ) it seems as if they are doing what you are looking for, which would essentially be a mix between your code and Andreas' form post code: i.e. combine parameters with files in one post using another encoding.
>
> Still, you will always have to known upfront which fields are expected.

Exactly, I was thinking if could find some way of read the form first,
and then ask by the needed fields.

And thanks by the link, I'm reading ....

Cheers.
Germán.


>
> Maybe if I have some time I will look into it, but I can't promise anything.
>
> Sven
>
>
> On 23 Jun 2010, at 01:24, Germán Arduino wrote:
>
>> Hi:
>>
>> Thanks by share. I will take a look as soon as I can.
>>
>> In the maintime want to ask if you have extended/implemented on
>> WebClient the possibility of make post's with multipart/form-data (See
>> my mail of yesterday with subject: "Using WebClient").
>>
>> Cheers.
>> Germán.
>>
>>
>> 2010/6/22 Sven Van Caekenberghe <[hidden email]>:
>>> Hi,
>>>
>>> I wrote a proof-of-concept Monticello server implementation called MCWebServer, using WebServer from Andreas Raab's WebClient package. I think this is a nice example of how to use WebServer for something useful and real. It also documents the MC HTTP client/server protocol with working code. It is available from http://www.squeaksource.com/ADayAtTheBeach as WebClient-Monticello.x.n.mcz.
>>>
>>> Load the code using Gofer (the code was written in Pharo but should be portable) (alternatively use Installer or do it manually):
>>>
>>> Gofer new squeaksource: 'WebClient'; package: 'WebClient-Core'; load.
>>> Gofer new squeaksource: 'ADayAtTheBeach'; package: 'WebClient-Monticello'; load.
>>>
>>> Setting up your own minimal MC source code repository is now very easy:
>>>
>>> (MCWebServer reset default)
>>>        directory: (FileDirectory  on: '/tmp/monticello/');
>>>        addUser: 'john' withPassword: 'secret';
>>>        listenOn: 8800.
>>>
>>> Make sure the specified directory exists. Choose a server port that is unused.
>>>
>>> Access with the following specification:
>>>
>>> MCHttpRepository
>>>        location: '<a href="http://localhost:8800'">http://localhost:8800'
>>>        user: 'john'
>>>        password: 'secret'.
>>>
>>> Enjoy,
>>>
>>> Sven
>>>
>>> --
>>> Sven Van Caekenberghe - http://homepage.mac.com/svc
>>> Beta Nine - software engineering - http://www.beta9.be
>>>
>>>
>>>
>>>
>>
>
>
>



--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================

Reply | Threaded
Open this post in threaded view
|

Re: WebClient-Monticello

Andreas.Raab
In reply to this post by Sven Van Caekenberghe
Hi Sven -

Thanks for MCWebServer - I think that this is a *great* example for the
use of WebServer that's both educational and practically useful. Also,
thanks for your comments and suggestions - all of these are very welcome.

Cheers,
   - Andreas

On 6/22/2010 2:54 PM, Sven Van Caekenberghe wrote:

> Hi,
>
> I wrote a proof-of-concept Monticello server implementation called MCWebServer, using WebServer from Andreas Raab's WebClient package. I think this is a nice example of how to use WebServer for something useful and real. It also documents the MC HTTP client/server protocol with working code. It is available from http://www.squeaksource.com/ADayAtTheBeach as WebClient-Monticello.x.n.mcz.
>
> Load the code using Gofer (the code was written in Pharo but should be portable) (alternatively use Installer or do it manually):
>
> Gofer new squeaksource: 'WebClient'; package: 'WebClient-Core'; load.
> Gofer new squeaksource: 'ADayAtTheBeach'; package: 'WebClient-Monticello'; load.
>
> Setting up your own minimal MC source code repository is now very easy:
>
> (MCWebServer reset default)
> directory: (FileDirectory  on: '/tmp/monticello/');
> addUser: 'john' withPassword: 'secret';
> listenOn: 8800.
>
> Make sure the specified directory exists. Choose a server port that is unused.
>
> Access with the following specification:
>
> MCHttpRepository
> location: '<a href="http://localhost:8800'">http://localhost:8800'
> user: 'john'
> password: 'secret'.
>
> Enjoy,
>
> Sven
>
> --
> Sven Van Caekenberghe - http://homepage.mac.com/svc
> Beta Nine - software engineering - http://www.beta9.be
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: WebClient-Monticello

Levente Uzonyi-2
In reply to this post by Sven Van Caekenberghe
On Tue, 22 Jun 2010, Sven Van Caekenberghe wrote:

> Hi,
>
> I wrote a proof-of-concept Monticello server implementation called MCWebServer, using WebServer from Andreas Raab's WebClient package. I think this is a nice example of how to use WebServer for something useful and real. It also documents the MC HTTP client/server protocol with working code. It is available from http://www.squeaksource.com/ADayAtTheBeach as WebClient-Monticello.x.n.mcz.
>
> Load the code using Gofer (the code was written in Pharo but should be portable) (alternatively use Installer or do it manually):
>
> Gofer new squeaksource: 'WebClient'; package: 'WebClient-Core'; load.
> Gofer new squeaksource: 'ADayAtTheBeach'; package: 'WebClient-Monticello'; load.
>
> Setting up your own minimal MC source code repository is now very easy:
>
> (MCWebServer reset default)
> directory: (FileDirectory  on: '/tmp/monticello/');
> addUser: 'john' withPassword: 'secret';
> listenOn: 8800.
>
> Make sure the specified directory exists. Choose a server port that is unused.
>
> Access with the following specification:
>
> MCHttpRepository
> location: '<a href="http://localhost:8800'">http://localhost:8800'
> user: 'john'
> password: 'secret'.

Thanks, this seems to be a nice and simple replacement of SqueakSource for
small projects.


Levente

>
> Enjoy,
>
> Sven
>
> --
> Sven Van Caekenberghe - http://homepage.mac.com/svc
> Beta Nine - software engineering - http://www.beta9.be
>
>
>
>