Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

At Begin, URL Handling and REST

3,455 views

Published on

A presenter at the Lasso Developer Conference 2009, Brian Loomis is the developer of the SingleTrack framework for Lasso.

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

At Begin, URL Handling and REST

  1. 1. atBegin URL Routing and REST Mapping URLs to Models, Views and Controllers
  2. 2. URL vs. URI • URl is a resource, that asks for action • URL is a file or a single item that is stateless
  3. 3. URL vs. URI • URl is a resource, that asks for action http://www.lassosoft.com/home/ • URL is a file or a single item that is stateless
  4. 4. URL vs. URI • URl is a resource, that asks for action http://www.lassosoft.com/home/ • URL is a file or a single item that is stateless http://www.lassosoft.com/ LassoSoft_Logo.png
  5. 5. URL vs. URI • URl is a resource, that asks for action • URL is a file or a single item that is stateless
  6. 6. Handling vs. Rewriting vs. Redirecting • Handling is conceptually parsing a URI to see what application components to call to provide a resource. • •
  7. 7. Handling vs. Rewriting vs. Redirecting • Handling is conceptually parsing a URI to see what application components to call to provide a resource. • Rewriting is altering a URL to another one before it even hits the application stack.
  8. 8. Handling vs. Rewriting vs. Redirecting • Handling is conceptually parsing a URI to see what application components to call to provide a resource. • Rewriting is altering a URL to another one before it even hits the application stack. • Redirecting is capturing a request for a URI or URL and sending a different one in lieu.
  9. 9. atBegin • atBegin.lasso placed in Lasso Startup
  10. 10. atBegin.lasso
  11. 11. Apache • Apache conf send files to Lasso • Done using the Apache site config, not the .htaccess
  12. 12. Apache Configuration
  13. 13. REST • Really, what it's about is using the true potential of HTTP. • In a RESTful application you'll never modify data using a GET request. • resources being manipulated using a common set of verbs • the actual representation retrieved for a resource is dependent on the request and not the identifier
  14. 14. SOAP RPC • SOAP RPC over HTTP, on the other hand, encourages each application designer to define a new and arbitrary vocabulary of nouns and verbs • getUsers(), savePurchaseOrder(...)
  15. 15. YUCK • There’s a better way, writing RESTful apps. • Think of each page as a service that responds to requests instead of as a web page.
  16. 16. http verbs in REST • Get • Remember Fielding http://roy.gbiv.com/ • Post Co-founder VP Apache project. • Put • Delete
  17. 17. Developng RESTful URIs • In truly restful apps there are only seven functions.
  18. 18. http verbs in REST • show (Get) • create (Post) • update (Put) • destroy (Delete) • index (Get) • new (Get) • edit (Get)
  19. 19. RESTful URIs • http://www.widgets.co.uk/widgets/edit/2 • http://www.widgets.co.uk/widgets/edit/a76b8fe687c6d1f34d • http://www.widgets.co.uk/customers/create/234 • http://www.widgets.co.uk/customers/list.xml • http://www.widgets.co.uk/clients/destroy/bd76ea87c • http://www.widgets.co.uk/articles/destroy/why-you-should- user-our-widgets_bd76ea87c
  20. 20. How do we handle these? • Routing File or an application controller • /app/controllers/application.inc • map the requests to models, views and controllers
  21. 21. Routing File
  22. 22. Routing File
  23. 23. Routing File
  24. 24. Routing File
  25. 25. Application Structure

×