Aida Internals and upcoming 6.5

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

Aida Internals and upcoming 6.5

bobcalco
I want to understand Aida's internal design. Does anyone have a sort of 30,000 ft view of what happens in the course of multiple HTTP requests internally to preserve state in the components in Aida? I am trying to study all the individual objects in each package but I could benefit from a high-level understanding of what's going on, and how the different pieces relate.

Also I would like to know how (and whether) others are providing web service APIs in Aida. I understand the new 6.5 Aida coming out soon will have more explicit support for REST (which I need, like, yesterday :) ), but maybe some other people have rolled their own support and I'm curious how you did it and what you learned along the way.

Thanks,

Bob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Request path (was Re: Internals and upcoming 6.5)

Janko Mivšek
S, Robert Calco piše:

> I want to understand Aida's internal design. Does anyone have a sort of
> 30,000 ft view of what happens in the course of multiple HTTP requests
> internally to preserve state in the components in Aida? I am trying to
> study all the individual objects in each package but I could benefit
> from a high-level understanding of what's going on, and how the
> different pieces relate.

Ok, let we start with a web request path in an Aida app from tutorial,
to the anAddressBook therefore:

1. Swazoo web server opens a connection and receives a request
2. it finds a proper AIDASite and calls its answerTo: method
3. user's session is found (from a cookie) or created
4. request is now routed to the right domain object for that URL
5. domain object is asked for it's presenter
6. presenter is returned or created, an instance of AddressBookApp in
   our case,
7. presenter is asked to represent itself as a web page
8. a composite web page (like a DOM tree) is composed
9. streaming as HTML to the web response of web page is the last step.

To step through that sequence you can put a breakpoint in
AidaSite>>answerTo: . then open object's URL. Some more intereting
objects and methods to wach through that journey (Aida 6.5!):

AIDASite answerTo: aRequest

 WebSessionManager findOrCreateSessionFor: aRequest
 WebRouter resourceFor: aRequest
  URLResolver resourceFor: aRequest
   URLResolver objectOnUrl: url

  AIDASite answer: anObject to: aRequest on: aSession
   AIDASite answer: anObject toGetOrPost: aRequest on: aSession
    AddressBook(Object) aidaPresenterFor: aRequest on: aSession
     AddressBook(Object) aidaWebAppFor: aSession
      WebApplication newFor: anObject on: aSession

     AdressBookApp(WebApplication) composeWebPageFor: aRequest
      AdressBookApp(WebApplication) composeWebPageStepTwoFor: aRequest
       AdressBookApp(WebApplication) composeWebView:aViewSymbol for:aReq
        AddressBookApp class viewMethodForView: aViewSymbol
        AddressBookApp perform: method

    AIDASite addResponseHeadersTo: response forPage: presenter on:..
    AddressBookApp streamHtmlTo: aStream for: aRequest on: aSession
     WebPage streamHtmlTo: aStream for: aRequest on: aSession
      WebWindow streamHtmlTo: aStream for: aRequest on: aSession
        WebWidget streamHtmlTo: aStream for: aRequest on: aSession
          etc... recursively down to all composition









>
> Also I would like to know how (and whether) others are providing web
> service APIs in Aida. I understand the new 6.5 Aida coming out soon will
> have more explicit support for REST (which I need, like, yesterday :) ),
> but maybe some other people have rolled their own support and I'm
> curious how you did it and what you learned along the way.
>
> Thanks,
>
> Bob
>
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida Internals and upcoming 6.5

Janko Mivšek
In reply to this post by bobcalco
Hi Bob,

S, Robert Calco piše:

> I want to understand Aida's internal design. Does anyone have a sort of
> 30,000 ft view of what happens in the course of multiple HTTP requests
> internally to preserve state in the components in Aida? I am trying to
> study all the individual objects in each package but I could benefit
> from a high-level understanding of what's going on, and how the
> different pieces relate.

The Architecture page with a lot diagrams can probably help you too:

        http://www.aidaweb.si/architecture

I added few more diagrams and I propose  that you look then ask
questions. Answers will then go to that page as well to become more
complete.



> Also I would like to know how (and whether) others are providing web
> service APIs in Aida. I understand the new 6.5 Aida coming out soon will
> have more explicit support for REST (which I need, like, yesterday :) ),
> but maybe some other people have rolled their own support and I'm
> curious how you did it and what you learned along the way.
>
> Thanks,
>
> Bob
>
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida Internals and upcoming 6.5

bobcalco
Hi Janko,

Is the main Aida site down? I keep getting connection reset errors trying to access it.

- Bob

2012/2/7 Janko Mivšek <[hidden email]>
Hi Bob,

S, Robert Calco piše:

> I want to understand Aida's internal design. Does anyone have a sort of
> 30,000 ft view of what happens in the course of multiple HTTP requests
> internally to preserve state in the components in Aida? I am trying to
> study all the individual objects in each package but I could benefit
> from a high-level understanding of what's going on, and how the
> different pieces relate.

The Architecture page with a lot diagrams can probably help you too:

       http://www.aidaweb.si/architecture

I added few more diagrams and I propose  that you look then ask
questions. Answers will then go to that page as well to become more
complete.



> Also I would like to know how (and whether) others are providing web
> service APIs in Aida. I understand the new 6.5 Aida coming out soon will
> have more explicit support for REST (which I need, like, yesterday :) ),
> but maybe some other people have rolled their own support and I'm
> curious how you did it and what you learned along the way.
>
> Thanks,
>
> Bob
>
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida Internals and upcoming 6.5

Janko Mivšek


S, Robert Calco piše:
> Hi Janko,
>
> Is the main Aida site down? I keep getting connection reset errors
> trying to access it.

Ups, sorry, it is now up again. I'm namelly chasing one infinite
recursion bug but forgot to include back the chaser.

Maybe you'll find interesting how this chaser looks like. It is a prime
example of power of Smalltalk and its reflective capabilities. In this
case I'm using the Climbing of the Stack "superpower":

WebForm allFieldsIncludingSubforms
  "return all fields (form elements) in down the form hierarchy"

  | set  count stContext |
  count := 0.
  stContext := thisContext sender.   "TEMPORARY, FOR DEBUGGING!"
  [stContext notNil] whileTrue: [
    (stContext receiver isKindOf: WebForm) ifTrue:
        [count := count +1].
        stContext := stContext sender].
     count > 20 ifTrue:
       [self error: 'WebForm allFields infinite recursion!'].

   set := self allFields.
   self subforms do: [:subform |
       set addAll: subform allFieldsIncludingSubforms].
   ^set

So, with pseudo variable thisContext i came to the current execution
context and count if it is in WebForm class. Then i go to the next
context up in the stack etc. After counting 20 occurences of WebForm I
declare an infinite recursion.

This Climbing of the Stack is used quite intesively in Aida, just look
at all Object first*FromTheStack methods. Main advantage is that this
way it is sometime the easiest to find a referecnce to some important
objects like session, request, anApp etc.

Best regards
Janko




>
> - Bob
>
> 2012/2/7 Janko Mivšek <[hidden email]
> <mailto:[hidden email]>>
>
>     Hi Bob,
>
>     S, Robert Calco piše:
>
>     > I want to understand Aida's internal design. Does anyone have a
>     sort of
>     > 30,000 ft view of what happens in the course of multiple HTTP requests
>     > internally to preserve state in the components in Aida? I am trying to
>     > study all the individual objects in each package but I could benefit
>     > from a high-level understanding of what's going on, and how the
>     > different pieces relate.
>
>     The Architecture page with a lot diagrams can probably help you too:
>
>            http://www.aidaweb.si/architecture
>
>     I added few more diagrams and I propose  that you look then ask
>     questions. Answers will then go to that page as well to become more
>     complete.
>
>
>
>     > Also I would like to know how (and whether) others are providing web
>     > service APIs in Aida. I understand the new 6.5 Aida coming out
>     soon will
>     > have more explicit support for REST (which I need, like, yesterday
>     :) ),
>     > but maybe some other people have rolled their own support and I'm
>     > curious how you did it and what you learned along the way.
>     >
>     > Thanks,
>     >
>     > Bob
>     >
>     >
>     >
>     > _______________________________________________
>     > Aida mailing list
>     > [hidden email] <mailto:[hidden email]>
>     > http://lists.aidaweb.si/mailman/listinfo/aida
>
>     --
>     Janko Mivšek
>     Aida/Web
>     Smalltalk Web Application Server
>     http://www.aidaweb.si
>     _______________________________________________
>     Aida mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://lists.aidaweb.si/mailman/listinfo/aida
>
>
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida