An introduction to Struts 2 and RESTful applications

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

2 comments

Comments 1 - 2 of 2 previous next Post a comment

  • + guest8736eb guest8736eb 7 months ago
    This is just waste of time
  • + ellenfeaheny Ellen Feaheny 11 months ago
    Great pres Don - Slide 3 hurts me looking at it. Ouch! Seriously - Great content too!
Post a comment
Embed Video
Edit your comment Cancel

3 Favorites & 1 Event

An introduction to Struts 2 and RESTful applications - Presentation Transcript

  1. An introduction to Struts 2 and RESTful applications Don Brown Atlassian mrdon@twdata.org
  2. What’s wrong with my web application?  Modern web framework  Presentation and business logic separation  Code not tied to HTTP
  3. Problem: Confusing URIs GET http://localhost/spaces/addspacenotification.action? key=AJOBS GET http://localhost/spaces/addspacenotification.action? key=AJOBS GET http://localhost/spaces/addspacenotification.action? key=AJOBS GET http://localhost/spaces/addspacenotification.action? key=AJOBS
  4. Problem: Poor caching HTTP traffic laws broken:  GET - Could be anything, including deletes and updates  POST - Also could be anything, even regular page views  PUT - Not used  DELETE - Not used
  5. Problem: People can’t get at their data
  6. REST is the Way of the Web
  7. Not just for Web Services http://www.flickr.com/photos/psd/2217422218/
  8. Solution: Humane URIs GET http://localhost/spaces/addspacenotification.action? key=AJOBS POST http://localhost/spaces/AJOBS/notifications GET http://localhost/spaces/AJOBS/notifications/3 PUT http://localhost/spaces/AJOBS/notifications/3 DELETE http://localhost/spaces/AJOBS/notifications/3
  9. Solution: Scalable caching Follow HTTP traffic laws:  GET - No side-effects, can repeat  POST - Changes state, cannot repeat  PUT - Changes state, can repeat  DELETE - Changes state, can repeat
  10. Solution: One API for all
  11. REST in action
  12. Detour: Struts 2
  13. Struts 2 History
  14. Struts 2 plugins
  15. Struts 2 Codebehind Plugin http://example.com/myapp/public/profile.xhtml Calls: com.example.myapp.actions.public.ProfileAction Forwards to: /WEB-INF/jsp/public/profile.jsp
  16. Struts 2 REST Plugin URI HTTP Method Action Method /orders GET index() /orders/3 GET show() /orders POST create() /orders/3 PUT update() /orders/3 DELETE destroy() /orders/new GET editNew() /orders/3/edit GET edit()
  17. A RESTful example: orders . . . Let’s see some code!
  18. REST in the real world
  19. Not everything is a resource Account: • GET . . . Yep • POST . . . Yep • PUT . . . Yep • DELETE . . . Yep • Renew?
  20. Account Renewal: resource or operation? Renew as a Resource POST: http://localhost/accounts/3/renewals Renew as an Operation POST http://localhost/accounts/3/renew
  21. REST is training friendly
  22. WS-* REST XML HTTP WSDL XML * XML Schema SOAP AXIS/CXF V.S. JAXB WS-Security* UDDI*
  23. Clients are and aren’t free But not
  24. REST: the silver bullet?
  25. The takeaway: apply REST to your app
  26. Questions? http://struts.apache.org/2.x/docs/rest-plugin.html

+ mrdonmrdon, 11 months ago

custom

3124 views, 3 favs, 0 embeds more stats

Presentation given by Don Brown at OSDC Sydney 2008 more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 3124
    • 3124 on SlideShare
    • 0 from embeds
  • Comments 2
  • Favorites 3
  • Downloads 134
Most viewed embeds

more

All embeds

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories

Groups / Events