four Altitude questions

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

four Altitude questions

Chris Cunnington
http://www.youtube.com/watch?NR=1&v=FyiYq_rvmzU&feature=endscreen

1. ALRestfulLocator>>paths "Vat does dis do?" I don't see anything
accessing this dictionary.
2. An auth/storage relay example, please.
3. ALNotFound:/favicon.ico now shows up with every click.
4. Why there are random urls?
     - To not be constrained by a fixed url hierarchy when changing the
application?
     - To have a token that links to an instance combining of web page
and state in a shapshot. Sore the 24-char token somewhere and you can
revert to an earlier stage in a process. Perhaps make the back button work?
     - Has some of the benefits of Seaside sessions and continuations in
a simpler way: saved state for a given user?

Thanks,
Chris

Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Colin Putney-3



On Thu, Dec 13, 2012 at 7:51 PM, Chris Cunnington <[hidden email]> wrote:
 
1. ALRestfulLocator>>paths "Vat does dis do?" I don't see anything accessing this dictionary.

It's mainly used in #urlForResource:. It's badly named, though, so I've just committed a fix. It's now called "urls".

The job of a locator is to map URLs to resources and the reverse, resources to URLs. ALRestfulLocator does this in such a way that the urls can be arbitrary, and you'll always get the same URL for semantically equivalent resources. (Consistent urls are required for REST.)

When the locator receives #urlForResource: it calculates a "key" for that resource, by serializing it and hashing the bytes. 
Then it checks to see if a url has already been assigned to that key. If so, great, answer it. If not, it asks its url strategy to create one. Since this is a resource we haven't seen before, we store the url-> mapping. The resources instance variable maps urls to resources, and the urls instance variable (formerly called paths) maps keys to URLs. Once the mapping is stored, #urlForResource: and #resourceForUrl: just do dictionary lookups.

2. An auth/storage relay example, please.

Yeah, working on it. AL-Storage contains ALStorageRelay, which is mostly working now and generates ETag headers for resources based on domain model objects stored in an ALRepository. Auth isn't implemented yet. 
 
3. ALNotFound:/favicon.ico now shows up with every click.

Are you getting 404 responses? If so, you just need to create a resource at that url. If not, it's a bug in Altitude.

Something like in your #initializeLocator method:

locator 
    at: (ALPath / 'favicon.ico') 
    put: (ALFileResource on: (FSLocator imageDirectory / 'favicon.ico'))

4. Why there are random urls?

As I mentioned above, the urls that ALRestfulLocator generates can be anything. This is why we can set up an image a file resource at /favicon.ico, which is hardcoded into browsers. It also means that when we generate urls automatically, we can use whatever scheme we want. This is what ALUrlStategy subclasses are for:

ALSequentialUrlStrategy generates urls in a predicable sequence: /1, /2, /3 etc. This is handy for testing. It might also be good for something like a URL shortening service where the shortest possible URLs are desirable. 

ALRandomUrlStrategy does the opposite. It generates pseudo-random unguessable URLs. That makes a web application more secure.

ALDigestUrlStrategy provides a middle path between predictability and unpredictability. It creates urls that are difficult to guess, but consistent. So, for example, two different images running the same application would generate the same urls for equivalent resources. (This wouldn't be the case with random urls).

Colin


Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Frank Shearar-3
On 14 December 2012 02:15, Colin Putney <[hidden email]> wrote:

>
>
>
> On Thu, Dec 13, 2012 at 7:51 PM, Chris Cunnington
> <[hidden email]> wrote:
>
>>
>> 3. ALNotFound:/favicon.ico now shows up with every click.
>
>
> Are you getting 404 responses? If so, you just need to create a resource at
> that url. If not, it's a bug in Altitude.
>
> Something like in your #initializeLocator method:
>
> locator
>     at: (ALPath / 'favicon.ico')
>     put: (ALFileResource on: (FSLocator imageDirectory / 'favicon.ico'))

I follow the ifPresent:ifAbsent: pattern - if I can't map the request
explicitly, I raise an ALNotFound (I might be misremembering the name)
which causes a 404.

frank

Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Chris Cunnington
In reply to this post by Colin Putney-3
Why are the tokens in Altitude urls called RESTful? This is suggested by the handler of the three strategy patterns listed below, which is called ALRestfulLocator.


On 2012-12-13 9:15 PM, Colin Putney wrote:
ALSequentialUrlStrategy generates urls in a predicable sequence: /1, /2, /3 etc. This is handy for testing. It might also be good for something like a URL shortening service where the shortest possible URLs are desirable. 

ALRandomUrlStrategy does the opposite. It generates pseudo-random unguessable URLs. That makes a web application more secure
This produces a 24-char token (ie http://localhost:8624/9rYxkg6HV_XCSiCbO2Z7tnFC )

ALDigestUrlStrategy provides a middle path between predictability and unpredictability. It creates urls that are difficult to guess, but consistent. So, for example, two different images running the same application would generate the same urls for equivalent resources. (This wouldn't be the case with random urls).

This produces a 24-char token (ie http://localhost:8624/9rYxkg6HV_XCSiCbO2Z7tnFC )


9rYxkg6HV_XCSiCbO2Z7tnFC does not look RESTful to me.

http://www.youtube.com/watch?v=cv157ZIInUk looks RESTful to me.

Andreas Raab criticized Seaside because SqueakSource cannot be indexed by Google. The Altitude url tokens look extremely similar to Seaside's.

1. If they are different, how?

2. Can an Altitude application be indexed by Google? If so, which subclass of ALUrlStrategy would be employed?

Chris


Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Colin Putney-3



On Sat, Dec 15, 2012 at 10:27 AM, Chris Cunnington <[hidden email]> wrote:
Why are the tokens in Altitude urls called RESTful?

This is an important and subtle topic. Grappling with it is what drove the development if Altitude, first as a hacked up version of Seaside, and later as a complete rewrite using Xtreams. 

I'm hardly an expert on this, but I try to understand REST from the original sources. The term is an abbreviation of "representational state transfer" and refers to an architectural style for distributed applications that was described in Roy Fieldings doctoral dissertation. [1] You'll note that "R. Fielding" first is on the list of authors of RFC 2616 [2], which describes HTTP. With a pedigree like that, it's no surprise that REST is the most important buzzword of the web development world. 

For me, the simplest way to think about REST is to imagine an old-school static web site: a directory of files being served by a generic Apache installation, with no fancy plugins, mod_rewrite magic or anything like that. You have a simple convention where the web page corresponding to a directory is found in a file called index.html inside that directory, but otherwise the directory tree in your DOCUMENT_ROOT is mapped directly into the URL space for that server: http://example.com/foo/ will fetch the contents of $DOCUMENT_ROOT/foo/index.html, and http://example/favicon.ico will be found at $DOCUMENT_ROOT/favicon.ico.

There are a couple of important properties of a setup like this:

1. There's a single entry point with a well-known URL: http://example.com/. The client begins by downloading that page, and from there it discovers other urls where related resources can be found—css, images, javascript etc. There might also be hyperlinks to other pages, which the user might click on to navigate to other pages. The important bit is that all URLs are provided by the server. At no point does the client generate a url by following a convention. (ie, something like "the resource I want is of type Person, and has ID #3, and I want the HTML page that describes that person, so the url will be /people/3.html"). The urls may in fact follow such a convention, but that's solely for the convenience of the server, and the client always receives URLs explicitly, though they might be in relative rather than absolute form.

2. The client-server transactions are stateless. Each request is independent, and the server doesn't interpret requests in a client-specific context. As a consequence, the the URLs that link one document to another are the same for all clients. 
 
Now, consider Seaside;

1. A Seaside application follows the same pattern, with a well-known entry point, and all URLs provided by the server. 

2. However, a seaside application don't have stateless transactions. Each url generated by Seaside contains a session identifier and a continuation identifier, which refer to client-specific context stored on the server. Thus each client's view of a particular page is unique. Each page is located at a client-specific URL and has links to other pages at client-specific URLs. This is why Seaside is not RESTful. (For example, open up http://www.squeaksource.com/. Now open the same URL in another tab. The two tabs will have different urls in their location fields. Now mouse-over the link to the "Projects" page. Each tab will have a different URL for that link.)

Now, the reason Seaside is such a good framework is that it provides an abstraction that hides all the details of the way that state is threaded through the client-server transactions in a web app. It generates urls, form field names, session ids etc so that application developers don't have to concern themselves with the details of marshalling and unmarshalling the state of their application into strings on each request. 

Altitude tries to provide that same level of abstraction in a RESTful way. That is, it behaves like an old-school static web site with respect to property #2: it produces consistent urls for the "same" resources, and doesn't store client-specific context on the server.

Andreas Raab criticized Seaside because SqueakSource cannot be indexed by Google. The Altitude url tokens look extremely similar to Seaside's.

1. If they are different, how?

Yes. They are superficially similar, in that they are opaque strings generated by the server. But if you go to http://box3.squeak.org:8624/ and do the same experiment as I described above with regard to SqueakSource, you'll see that the URLs are opaque, but consistent. The home page is always at /, the community page is always at /yqKyLzH7r9ePyzIWOLUBWO9x, for all clients.
 
2. Can an Altitude application be indexed by Google? If so, which subclass of ALUrlStrategy would be employed? 

Yes. Imagine that Google crawls the new site you've created for Squeak. It will index /yqKyLzH7r9ePyzIWOLUBWO9x and then when somebody does a search for "Squeak community" that page will come up (we hope). The user clicks on the link, and arrives at /yqKyLzH7r9ePyzIWOLUBWO9x, and sees the community page. Great! If that were a Seaside web site, the user would get a 404 error, because the page that Google saw has expired from the server.

Any strategy could be used, and the site would still be indexable. The strategies have differences which might make one strategy or another desirable for different purposes, but RESTfulness isn't a property of the structure of the URL so much as the way the server handles them. That's why the locator is named Restful, not the strategies.

Does this make sense?

Colin


[3] Well, actually it does, but only for purposes of ranking, not indexing. 




Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Hannes Hirzel
Colin,

thank you for the detailed explanations. Well written, and they make a
lot of sense!

Taking the example of the new Squeak website

   http://box3.squeak.org:8624/yqKyLzH7r9ePyzIWOLUBWO9x

points to the Squeak community web page (mailing lists etc.).

It  is exciting to see this RESTful behavior in action. This opens up
a lot of new options.

Chris, BTW the blue bar appears double in IE9 whereas in FF17 it is fine.

I did not realize that the new Squeak website has this behavior as the
URL looked very Seaside-like. So I did not even try to look at the url

   http://box3.squeak.org:8624/yqKyLzH7r9ePyzIWOLUBWO9x

in different browsers.

The immediate question which now comes up is

how can we have something like

   http://box3.squeak.org:8624/community

i.e.

     yqKyLzH7r9ePyzIWOLUBWO9x

replaced by

     community

?

--Hannes

On 12/15/12, Colin Putney <[hidden email]> wrote:

> On Sat, Dec 15, 2012 at 10:27 AM, Chris Cunnington <
> [hidden email]> wrote:
>
>>  Why are the tokens in Altitude urls called RESTful?
>>
>
> This is an important and subtle topic. Grappling with it is what drove the
> development if Altitude, first as a hacked up version of Seaside, and later
> as a complete rewrite using Xtreams.
>
> I'm hardly an expert on this, but I try to understand REST from the
> original sources. The term is an abbreviation of "representational state
> transfer" and refers to an architectural style for distributed applications
> that was described in Roy Fieldings doctoral dissertation. [1] You'll note
> that "R. Fielding" first is on the list of authors of RFC 2616 [2], which
> describes HTTP. With a pedigree like that, it's no surprise that REST is
> the most important buzzword of the web development world.
>
> For me, the simplest way to think about REST is to imagine an old-school
> static web site: a directory of files being served by a generic Apache
> installation, with no fancy plugins, mod_rewrite magic or anything like
> that. You have a simple convention where the web page corresponding to a
> directory is found in a file called index.html inside that directory, but
> otherwise the directory tree in your DOCUMENT_ROOT is mapped directly into
> the URL space for that server: http://example.com/foo/ will fetch the
> contents of $DOCUMENT_ROOT/foo/index.html, and
> http://example/favicon.icowill be found at $DOCUMENT_ROOT/favicon.ico.
>
> There are a couple of important properties of a setup like this:
>
> 1. There's a single entry point with a well-known URL: http://example.com/.
> The client begins by downloading that page, and from there it discovers
> other urls where related resources can be found—css, images, javascript
> etc. There might also be hyperlinks to other pages, which the user might
> click on to navigate to other pages. The important bit is that all URLs are
> provided by the server. At no point does the client generate a url by
> following a convention. (ie, something like "the resource I want is of type
> Person, and has ID #3, and I want the HTML page that describes that person,
> so the url will be /people/3.html"). The urls may in fact follow such a
> convention, but that's solely for the convenience of the server, and the
> client always receives URLs explicitly, though they might be in relative
> rather than absolute form.
>
> 2. The client-server transactions are stateless. Each request is
> independent, and the server doesn't interpret requests in a client-specific
> context. As a consequence, the the URLs that link one document to another
> are the same for all clients.
>
> Now, consider Seaside;
>
> 1. A Seaside application follows the same pattern, with a well-known entry
> point, and all URLs provided by the server.
>
> 2. However, a seaside application don't have stateless transactions. Each
> url generated by Seaside contains a session identifier and a continuation
> identifier, which refer to client-specific context stored on the server.
> Thus each client's view of a particular page is unique. Each page is
> located at a client-specific URL and has links to other pages at
> client-specific URLs. This is why Seaside is not RESTful. (For example,
> open up http://www.squeaksource.com/. Now open the same URL in another tab.
> The two tabs will have different urls in their location fields. Now
> mouse-over the link to the "Projects" page. Each tab will have a different
> URL for that link.)
>
> Now, the reason Seaside is such a good framework is that it provides an
> abstraction that hides all the details of the way that state is threaded
> through the client-server transactions in a web app. It generates urls,
> form field names, session ids etc so that application developers don't have
> to concern themselves with the details of marshalling and unmarshalling the
> state of their application into strings on each request.
>
> Altitude tries to provide that same level of abstraction in a RESTful way.
> That is, it behaves like an old-school static web site with respect to
> property #2: it produces consistent urls for the "same" resources, and
> doesn't store client-specific context on the server.
>
> Andreas Raab criticized Seaside because SqueakSource cannot be indexed by
>> Google. The Altitude url tokens look extremely similar to Seaside's.
>>
>> 1. If they are different, how?
>>
>
> Yes. They are superficially similar, in that they are opaque strings
> generated by the server. But if you go to http://box3.squeak.org:8624/ and
> do the same experiment as I described above with regard to SqueakSource,
> you'll see that the URLs are opaque, but consistent. The home page is
> always at /, the community page is always at /yqKyLzH7r9ePyzIWOLUBWO9x, for
> all clients.
>
>
>> 2. Can an Altitude application be indexed by Google? If so, which
>> subclass
>> of ALUrlStrategy would be employed?
>>
>
> Yes. Imagine that Google crawls the new site you've created for Squeak. It
> will index /yqKyLzH7r9ePyzIWOLUBWO9x and then when somebody does a search
> for "Squeak community" that page will come up (we hope). The user clicks on
> the link, and arrives at /yqKyLzH7r9ePyzIWOLUBWO9x, and sees the community
> page. Great! If that were a Seaside web site, the user would get a 404
> error, because the page that Google saw has expired from the server.
>
> Any strategy could be used, and the site would still be indexable. The
> strategies have differences which might make one strategy or another
> desirable for different purposes, but RESTfulness isn't a property of the
> structure of the URL so much as the way the server handles them. That's why
> the locator is named Restful, not the strategies.
>
> Does this make sense?
>
> Colin
>
>
> [1]  https://www.ics.uci.edu/~fielding/pubs/dissertation/top
> [2]  http://tools.ietf.org/html/rfc2616
> [3] Well, actually it does, but only for purposes of ranking, not indexing.
>

Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Frank Shearar-3
On 15 December 2012 20:48, H. Hirzel <[hidden email]> wrote:

> Colin,
>
> thank you for the detailed explanations. Well written, and they make a
> lot of sense!
>
> Taking the example of the new Squeak website
>
>    http://box3.squeak.org:8624/yqKyLzH7r9ePyzIWOLUBWO9x
>
> points to the Squeak community web page (mailing lists etc.).
>
> It  is exciting to see this RESTful behavior in action. This opens up
> a lot of new options.
>
> Chris, BTW the blue bar appears double in IE9 whereas in FF17 it is fine.
>
> I did not realize that the new Squeak website has this behavior as the
> URL looked very Seaside-like. So I did not even try to look at the url
>
>    http://box3.squeak.org:8624/yqKyLzH7r9ePyzIWOLUBWO9x
>
> in different browsers.
>
> The immediate question which now comes up is
>
> how can we have something like
>
>    http://box3.squeak.org:8624/community
>
> i.e.
>
>      yqKyLzH7r9ePyzIWOLUBWO9x
>
> replaced by
>
>      community
>
> ?

You just use a different Locator. Reflect-Core's ParamLocator might be
a completely terrible example of the idea, but my hacking currently
has URLs like http://127.0.0.1:9090/organization/classes-in/Collections-Arrayed
which look pretty readable. Guessable too, but that's the intent
_here_: other applications might not desire guessable URLs.

frank

> --Hannes
>
> On 12/15/12, Colin Putney <[hidden email]> wrote:
>> On Sat, Dec 15, 2012 at 10:27 AM, Chris Cunnington <
>> [hidden email]> wrote:
>>
>>>  Why are the tokens in Altitude urls called RESTful?
>>>
>>
>> This is an important and subtle topic. Grappling with it is what drove the
>> development if Altitude, first as a hacked up version of Seaside, and later
>> as a complete rewrite using Xtreams.
>>
>> I'm hardly an expert on this, but I try to understand REST from the
>> original sources. The term is an abbreviation of "representational state
>> transfer" and refers to an architectural style for distributed applications
>> that was described in Roy Fieldings doctoral dissertation. [1] You'll note
>> that "R. Fielding" first is on the list of authors of RFC 2616 [2], which
>> describes HTTP. With a pedigree like that, it's no surprise that REST is
>> the most important buzzword of the web development world.
>>
>> For me, the simplest way to think about REST is to imagine an old-school
>> static web site: a directory of files being served by a generic Apache
>> installation, with no fancy plugins, mod_rewrite magic or anything like
>> that. You have a simple convention where the web page corresponding to a
>> directory is found in a file called index.html inside that directory, but
>> otherwise the directory tree in your DOCUMENT_ROOT is mapped directly into
>> the URL space for that server: http://example.com/foo/ will fetch the
>> contents of $DOCUMENT_ROOT/foo/index.html, and
>> http://example/favicon.icowill be found at $DOCUMENT_ROOT/favicon.ico.
>>
>> There are a couple of important properties of a setup like this:
>>
>> 1. There's a single entry point with a well-known URL: http://example.com/.
>> The client begins by downloading that page, and from there it discovers
>> other urls where related resources can be found—css, images, javascript
>> etc. There might also be hyperlinks to other pages, which the user might
>> click on to navigate to other pages. The important bit is that all URLs are
>> provided by the server. At no point does the client generate a url by
>> following a convention. (ie, something like "the resource I want is of type
>> Person, and has ID #3, and I want the HTML page that describes that person,
>> so the url will be /people/3.html"). The urls may in fact follow such a
>> convention, but that's solely for the convenience of the server, and the
>> client always receives URLs explicitly, though they might be in relative
>> rather than absolute form.
>>
>> 2. The client-server transactions are stateless. Each request is
>> independent, and the server doesn't interpret requests in a client-specific
>> context. As a consequence, the the URLs that link one document to another
>> are the same for all clients.
>>
>> Now, consider Seaside;
>>
>> 1. A Seaside application follows the same pattern, with a well-known entry
>> point, and all URLs provided by the server.
>>
>> 2. However, a seaside application don't have stateless transactions. Each
>> url generated by Seaside contains a session identifier and a continuation
>> identifier, which refer to client-specific context stored on the server.
>> Thus each client's view of a particular page is unique. Each page is
>> located at a client-specific URL and has links to other pages at
>> client-specific URLs. This is why Seaside is not RESTful. (For example,
>> open up http://www.squeaksource.com/. Now open the same URL in another tab.
>> The two tabs will have different urls in their location fields. Now
>> mouse-over the link to the "Projects" page. Each tab will have a different
>> URL for that link.)
>>
>> Now, the reason Seaside is such a good framework is that it provides an
>> abstraction that hides all the details of the way that state is threaded
>> through the client-server transactions in a web app. It generates urls,
>> form field names, session ids etc so that application developers don't have
>> to concern themselves with the details of marshalling and unmarshalling the
>> state of their application into strings on each request.
>>
>> Altitude tries to provide that same level of abstraction in a RESTful way.
>> That is, it behaves like an old-school static web site with respect to
>> property #2: it produces consistent urls for the "same" resources, and
>> doesn't store client-specific context on the server.
>>
>> Andreas Raab criticized Seaside because SqueakSource cannot be indexed by
>>> Google. The Altitude url tokens look extremely similar to Seaside's.
>>>
>>> 1. If they are different, how?
>>>
>>
>> Yes. They are superficially similar, in that they are opaque strings
>> generated by the server. But if you go to http://box3.squeak.org:8624/ and
>> do the same experiment as I described above with regard to SqueakSource,
>> you'll see that the URLs are opaque, but consistent. The home page is
>> always at /, the community page is always at /yqKyLzH7r9ePyzIWOLUBWO9x, for
>> all clients.
>>
>>
>>> 2. Can an Altitude application be indexed by Google? If so, which
>>> subclass
>>> of ALUrlStrategy would be employed?
>>>
>>
>> Yes. Imagine that Google crawls the new site you've created for Squeak. It
>> will index /yqKyLzH7r9ePyzIWOLUBWO9x and then when somebody does a search
>> for "Squeak community" that page will come up (we hope). The user clicks on
>> the link, and arrives at /yqKyLzH7r9ePyzIWOLUBWO9x, and sees the community
>> page. Great! If that were a Seaside web site, the user would get a 404
>> error, because the page that Google saw has expired from the server.
>>
>> Any strategy could be used, and the site would still be indexable. The
>> strategies have differences which might make one strategy or another
>> desirable for different purposes, but RESTfulness isn't a property of the
>> structure of the URL so much as the way the server handles them. That's why
>> the locator is named Restful, not the strategies.
>>
>> Does this make sense?
>>
>> Colin
>>
>>
>> [1]  https://www.ics.uci.edu/~fielding/pubs/dissertation/top
>> [2]  http://tools.ietf.org/html/rfc2616
>> [3] Well, actually it does, but only for purposes of ranking, not indexing.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

mokurai
In reply to this post by Chris Cunnington
On Sat, December 15, 2012 10:27 am, Chris Cunnington wrote:
> Why are the tokens in Altitude urls called RESTful? This is suggested by
> the handler of the three strategy patterns listed below, which is called
> ALRestfulLocator.

REST (Representational State Transfer) is a protocol for embedding
queries in URLs.

http://en.wikipedia.org/wiki/Representational_state_transfer

I once documented the use of REST for vendors listing their wares on
Shopping.com.


--
Edward Mokurai
(&#40664;&#38647;/&#2344;&#2367;&#2358;&#2348;&#2381;&#2342;&#2327;&#2352;&#2381;&#2332;/&#1606;&#1588;&#1576;&#1583;&#1711;&#1585;&#1580;)
Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks



Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Chris Cunnington
In reply to this post by Hannes Hirzel
On 2012-12-15 3:48 PM, H. Hirzel wrote:

> Colin,
>
> thank you for the detailed explanations. Well written, and they make a
> lot of sense!
>
> Taking the example of the new Squeak website
>
>     http://box3.squeak.org:8624/yqKyLzH7r9ePyzIWOLUBWO9x
>
> points to the Squeak community web page (mailing lists etc.).
>
> It  is exciting to see this RESTful behavior in action. This opens up
> a lot of new options.
>
> Chris, BTW the blue bar appears double in IE9 whereas in FF17 it is fine.
http://lists.squeakfoundation.org/pipermail/squeak-dev/2012-December/166805.html
http://lists.squeakfoundation.org/pipermail/squeak-dev/2012-December/166809.html

> I did not realize that the new Squeak website has this behavior as the
> URL looked very Seaside-like. So I did not even try to look at the url
>
>     http://box3.squeak.org:8624/yqKyLzH7r9ePyzIWOLUBWO9x
>
> in different browsers.
>
> The immediate question which now comes up is
>
> how can we have something like
>
>     http://box3.squeak.org:8624/community
> i.e.
>
>       yqKyLzH7r9ePyzIWOLUBWO9x
>
> replaced by
>
>       community
>
> ?
What for?
>
> --Hannes
>
>


Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Chris Cunnington
In reply to this post by Colin Putney-3
On 2012-12-15 1:28 PM, Colin Putney wrote:



On Sat, Dec 15, 2012 at 10:27 AM, Chris Cunnington <[hidden email]> wrote:
Why are the tokens in Altitude urls called RESTful?

This is an important and subtle topic. Grappling with it is what drove the development if Altitude, first as a hacked up version of Seaside, and later as a complete rewrite using Xtreams. 

I'm hardly an expert on this, but I try to understand REST from the original sources. The term is an abbreviation of "representational state transfer" and refers to an architectural style for distributed applications that was described in Roy Fieldings doctoral dissertation. [1] You'll note that "R. Fielding" first is on the list of authors of RFC 2616 [2], which describes HTTP. With a pedigree like that, it's no surprise that REST is the most important buzzword of the web development world. 

For me, the simplest way to think about REST is to imagine an old-school static web site: a directory of files being served by a generic Apache installation, with no fancy plugins, mod_rewrite magic or anything like that. You have a simple convention where the web page corresponding to a directory is found in a file called index.html inside that directory, but otherwise the directory tree in your DOCUMENT_ROOT is mapped directly into the URL space for that server: http://example.com/foo/ will fetch the contents of $DOCUMENT_ROOT/foo/index.html, and http://example/favicon.ico will be found at $DOCUMENT_ROOT/favicon.ico.

There are a couple of important properties of a setup like this:

1. There's a single entry point with a well-known URL: http://example.com/. The client begins by downloading that page, and from there it discovers other urls where related resources can be found—css, images, javascript etc. There might also be hyperlinks to other pages, which the user might click on to navigate to other pages. The important bit is that all URLs are provided by the server. At no point does the client generate a url by following a convention. (ie, something like "the resource I want is of type Person, and has ID #3, and I want the HTML page that describes that person, so the url will be /people/3.html"). The urls may in fact follow such a convention, but that's solely for the convenience of the server, and the client always receives URLs explicitly, though they might be in relative rather than absolute form.

2. The client-server transactions are stateless. Each request is independent, and the server doesn't interpret requests in a client-specific context. As a consequence, the the URLs that link one document to another are the same for all clients. 
 
Now, consider Seaside;

1. A Seaside application follows the same pattern, with a well-known entry point, and all URLs provided by the server. 

2. However, a seaside application don't have stateless transactions. Each url generated by Seaside contains a session identifier and a continuation identifier, which refer to client-specific context stored on the server. Thus each client's view of a particular page is unique. Each page is located at a client-specific URL and has links to other pages at client-specific URLs. This is why Seaside is not RESTful. (For example, open up http://www.squeaksource.com/. Now open the same URL in another tab. The two tabs will have different urls in their location fields. Now mouse-over the link to the "Projects" page. Each tab will have a different URL for that link.)

Now, the reason Seaside is such a good framework is that it provides an abstraction that hides all the details of the way that state is threaded through the client-server transactions in a web app. It generates urls, form field names, session ids etc so that application developers don't have to concern themselves with the details of marshalling and unmarshalling the state of their application into strings on each request. 

Altitude tries to provide that same level of abstraction in a RESTful way. That is, it behaves like an old-school static web site with respect to property #2: it produces consistent urls for the "same" resources, and doesn't store client-specific context on the server.

Andreas Raab criticized Seaside because SqueakSource cannot be indexed by Google. The Altitude url tokens look extremely similar to Seaside's.

1. If they are different, how?

Yes. They are superficially similar, in that they are opaque strings generated by the server. But if you go to http://box3.squeak.org:8624/ and do the same experiment as I described above with regard to SqueakSource, you'll see that the URLs are opaque, but consistent. The home page is always at /, the community page is always at /yqKyLzH7r9ePyzIWOLUBWO9x, for all clients.
 
2. Can an Altitude application be indexed by Google? If so, which subclass of ALUrlStrategy would be employed? 

Yes. Imagine that Google crawls the new site you've created for Squeak. It will index /yqKyLzH7r9ePyzIWOLUBWO9x and then when somebody does a search for "Squeak community" that page will come up (we hope). The user clicks on the link, and arrives at /yqKyLzH7r9ePyzIWOLUBWO9x, and sees the community page. Great! If that were a Seaside web site, the user would get a 404 error, because the page that Google saw has expired from the server.

Any strategy could be used, and the site would still be indexable. The strategies have differences which might make one strategy or another desirable for different purposes, but RESTfulness isn't a property of the structure of the URL so much as the way the server handles them. That's why the locator is named Restful, not the strategies.

Does this make sense?

Yup. I just pulled out my copy of RESTful Web Services (O'Reilly, 2007) and reviewed the stuff I highlighted four years ago. I get it. I understand why you serialize and hash things. I see Etags in the bigger picture. To review this stuff is to be pulled back into a large topic. It would seem that Altitude is an extremely RESTful framework. That opens a door for Smalltalk to participate in a larger world.

Chris

Colin


[3] Well, actually it does, but only for purposes of ranking, not indexing. 







Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Bert Freudenberg
In reply to this post by Colin Putney-3
On 2012-12-15, at 19:28, Colin Putney <[hidden email]> wrote:

> The home page is always at /, the community page is always at /yqKyLzH7r9ePyzIWOLUBWO9x, for all clients.

I'd very much like the community page to live at /community.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: four Altitude questions

Colin Putney-3



On Mon, Dec 17, 2012 at 5:52 AM, Bert Freudenberg <[hidden email]> wrote:
On 2012-12-15, at 19:28, Colin Putney <[hidden email]> wrote:

> The home page is always at /, the community page is always at /yqKyLzH7r9ePyzIWOLUBWO9x, for all clients.

I'd very much like the community page to live at /community.

Agreed. 

It's handy to use auto-generated URLs during development, then switch to pretty ones after the structure has stabilized. We'll get there.

Colin