HTTPSocket class - getting to the instance

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

HTTPSocket class - getting to the instance

Andy Burnett

First, Smalltalk is just amazing!  I am so impressed with what it is possible to do - with practically no knowledge!

Second. Due to my lack of knowledge I am now stuck ;-)

I am still working on the problem of building a Smalltalk version of Wget.  I have used the HTTPClient as my basic object and that is doing most of what I want. However, I can't get to the HTTP Headers. I noticed that HTTPSocket does seem to offer the headers but this is where I get stuck.

The creation methods of HTTPSocket  (i.e. telling it which url to go to) seem to only exist on the class side.  But the methods for getting to headers etc only exist in the instance.  I can't work out how to create an instance of the socket and tell it which url to go to.  All the construction methods just seem to return the class.  

Obviously I am missing something pretty basic. Could someone please enlighten me?

TVM
AB
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: HTTPSocket class - getting to the instance

Ron Teitelbaum
Hi Andy,

Take a look at the method:
HTTPSocket class >> httpGetDocument: url args: args accept: mimeType
request: requestString

Go about half way down after it has parsed the URL.  Start at:

HTTPSocket new.

You too can get an instance of HTTPSocket but issuing new.  

Hope that helps!

Happy coding.

Ron Teitelbaum

________________________________________
From: [hidden email]
Sent: Thursday, August 24, 2006 11:59 AM


First, Smalltalk is just amazing!  I am so impressed with what it is
possible to do - with practically no knowledge!

Second. Due to my lack of knowledge I am now stuck ;-)

I am still working on the problem of building a Smalltalk version of Wget.
 I have used the HTTPClient as my basic object and that is doing most of
what I want. However, I can't get to the HTTP Headers. I noticed that
HTTPSocket does seem to offer the headers but this is where I get stuck.

The creation methods of HTTPSocket  (i.e. telling it which url to go to)
seem to only exist on the class side.  But the methods for getting to
headers etc only exist in the instance.  I can't work out how to create an
instance of the socket and tell it which url to go to.  All the construction
methods just seem to return the class.  

Obviously I am missing something pretty basic. Could someone please
enlighten me?

TVM
AB

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: HTTPSocket class - getting to the instance

stéphane ducasse-2
In reply to this post by Andy Burnett

On 24 août 06, at 17:58, [hidden email] wrote:

>
> First, Smalltalk is just amazing!  I am so impressed with what it  
> is possible to do - with practically no knowledge!
>
> Second. Due to my lack of knowledge I am now stuck ;-)
>
> I am still working on the problem of building a Smalltalk version  
> of Wget.

this is cool
Do not forget to publish on squeaksource :)
http://www.iam.unibe.ch/~ducasse/Videos/

>  I have used the HTTPClient as my basic object and that is doing  
> most of what I want. However, I can't get to the HTTP Headers. I  
> noticed that HTTPSocket does seem to offer the headers but this is  
> where I get stuck.
>
> The creation methods of HTTPSocket  (i.e. telling it which url to  
> go to) seem to only exist on the class side.

but don't they create instances?

get the reference to the class HTTPSocket by bringing the menu and  
looking for references (also shift N)
then you can see some uses of the class. I hope this can help you.

>  But the methods for getting to headers etc only exist in the  
> instance.  I can't work out how to create an instance of the socket  
> and tell it which url to go to.  All the construction methods just  
> seem to return the class.

normally they should not.

>
> Obviously I am missing something pretty basic. Could someone please  
> enlighten me?
>
> TVM
> AB
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: HTTPSocket class - getting to the instance

tblanchard
In reply to this post by Andy Burnett
The ugly details are found in HttpSocket's class side method;
httpGetDocument: url args: args accept: mimeType request: requestString

Its a little ugly - an HttpRequest class should bundle up a lot of that complexity in a nice data structure that represents the structure of a request.

But there it is.

On Aug 24, 2006, at 8:58 AM, [hidden email] wrote:


First, Smalltalk is just amazing!  I am so impressed with what it is possible to do - with practically no knowledge!

Second. Due to my lack of knowledge I am now stuck ;-)

I am still working on the problem of building a Smalltalk version of Wget.  I have used the HTTPClient as my basic object and that is doing most of what I want. However, I can't get to the HTTP Headers. I noticed that HTTPSocket does seem to offer the headers but this is where I get stuck.

The creation methods of HTTPSocket  (i.e. telling it which url to go to) seem to only exist on the class side.  But the methods for getting to headers etc only exist in the instance.  I can't work out how to create an instance of the socket and tell it which url to go to.  All the construction methods just seem to return the class.  

Obviously I am missing something pretty basic. Could someone please enlighten me?

TVM
AB
_______________________________________________
Beginners mailing list


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners