The Definitive Guide to Lift (eBook)
200 Seiten
Apress (Verlag)
978-1-4302-2422-8 (ISBN)
The Definitive Guide to Lift will educate you about Lift, a great framework for building compelling web applications. Lift is designed to make powerful techniques easily accessible, while keeping the overall framework simple and flexible. Lift makes it fun to develop because it lets you focus on the interesting parts of coding.
By the end of this book, you'll be able to create and extend any web application you can think of.
Marius Danciu spent the past 6 years architecting, designing, and leading development of highly scalable server-side applications based on J(2)EE platforms. Most applications were based on the data synchronization techniques (which in turn were based on the SyncML OMA standard) and adjacent technologies. For more than a year, Marius has been a committer to the LiftWeb framework, contributing to the design and implementation of various features in the framework.
The Definitive Guide to Lift will educate you about Lift, a great framework for building compelling web applications. Lift is designed to make powerful techniques easily accessible, while keeping the overall framework simple and flexible. Lift makes it fun to develop because it lets you focus on the interesting parts of coding. By the end of this book, you'll be able to create and extend any web application you can think of.
Marius Danciu spent the past 6 years architecting, designing, and leading development of highly scalable server-side applications based on J(2)EE platforms. Most applications were based on the data synchronization techniques (which in turn were based on the SyncML OMA standard) and adjacent technologies. For more than a year, Marius has been a committer to the LiftWeb framework, contributing to the design and implementation of various features in the framework.
Table of Contents 1
The Definitive Guide to Lift: A Scala-Based Web Framework 8
Acknowledgements 9
Chapter 1: Welcome to Lift 10
Lifting Off! 10
Implementing the View-First Pattern with Lift 10
Leveraging the Scala Language 11
Supporting Advanced Features Easily 12
Getting to Know the Lift Community 12
Creating Your First Lift Application 13
Conclusion 18
Chapter 2: PocketChange 19
Keeping Track of Your PocketChange 19
Defining the Model 20
Creating Your First Template 23
Writing Snippets 24
Sprinkling a Little AJAX Spice 27
Conclusion 31
Chapter 3: Lift Fundamentals 32
Entering Lift 32
Making Standard import Assumptions for This Book 33
Bootstrapping in Lift 33
Using LiftRules 33
Resolving Classes 34
Rendering in Lift 34
Rendering with Templates 35
Rendering with Views 36
Getting to Know the Lift Tags 38
snippet 38
surround 39
bind 40
embed 40
comet 40
Merging HTML Headings 41
Providing User Feedback 42
Using Snippets 42
Binding Values in Snippets 43
Choosing Between Stateless and Stateful Snippets 44
Using Eager Evaluation 45
Rewriting URLs 45
Adding Custom Dispatch Functions 48
Using HTTP Redirects 50
Using Cookies 50
Storing Session and Request States 51
Gathering a Few More Useful Objects 53
S object 53
SHtml 53
Conclusion 53
Chapter 4: Forms in Lift 54
Practicing Form Fundamentals 54
checkbox 59
hidden 60
link 60
text and password 61
textarea 62
submit 62
multiselect 62
radio 63
select 64
selectObj 65
untrustedSelect 65
Uploading Files 65
Conclusion 67
Chapter 5: SiteMap 68
Defining SiteMap 68
Creating the Link Class 68
Using ExtLink 69
Creating Menu Entries 69
Using Nested Menus 70
Setting the Global SiteMap 71
Customizing the Display 72
Using the Hidden LocParam 72
Controlling the Menu Text 72
Using Menu 73
Controlling Access with Menus 74
Using If Clauses 74
Using the Unless LocParam 75
Working with the Template LocParam 75
Working with the Snippet and LocSnippets Parameters 76
Setting the Title 77
Testing a Request 77
Categorizing with LocGroup 78
Writing Your Own Loc 78
Knowing the Corresponding Functions 79
Using Type-Safe Parameters 80
Conclusion 84
Chapter 6: Mapper and Record 85
Introducing Mapper and MetaMapper 85
Adding Mapper to Your Project 86
Setting Up the Database Connection 86
Constructing a Mapper-Enabled Class 87
Creating Object Relationships 90
Indexing 93
Mapping Schemas 93
Performing Persistence Operations on an Entity 94
Creating a Mapper Instance 95
Saving a Mapper Instance 96
Deleting a Mapper Instance 96
Querying for Entities 96
Using Comparison QueryParams 97
Using Control QueryParams 99
Making Joins a Little Friendlier 101
Using Utility Functionality 101
Generating a Display 101
Generating Forms 102
Validating Forms 103
Supporting CRUD Operations 104
Using Life Cycle Callbacks 105
Knowing the Base Field Types 105
Defining Custom Field Types 108
Working with ProtoUser and MegaProtoUser 113
Using Advanced Mapper Features 114
Using Multiple Databases 114
Performing SQL-Based Queries 117
Conclusion 119
Chapter 7: Advanced Lift Architecture 120
Understanding Lift Architecture 120
Understanding the Request/Response Life Cycle 121
Transforming a Request into a Response 122
Processing a Stateful Request 123
Mapping Lift Functions 125
Exploring LiftResponse in Detail 127
Basic HTTP Equivalent Responses 127
Redirecting the Client 128
Sending Content to the Client 129
InMemoryResponse 130
StreamingResponse 130
Returning Text to the Client 131
Returning XML to the Client 131
Managing Sessions 132
Using Sticky Sessions 133
Using Lift’s Garbage Collection 134
Wrapping Lift’s Processing Logic 135
Using Additional Snippet Features 137
Passing Parameters to Snippets 137
Using Snippets for Tag Attributes 137
Working with Advanced S Object Features 139
Managing Cookies 139
Managing the Time Zone 140
Setting Session DispatchPF Functions 140
Rewriting Sessions 140
Accessing HTTP Headers 140
Managing the Document Type 141
Performing Other Functions 141
Managing Resources with ResourceServer 141
Obtaining HTTP Authentication 142
Using Basic HTTP Authentication 142
Using HTTP Digest Authentication 145
Conclusion 147
Chapter 8: Lift and JavaScript 148
Using High-Level JavaScript Abstractions 148
Understanding JsCmd and JsExp 149
Exploring JavaScript Abstraction Examples 152
Using jQuery and Other JavaScript Frameworks 153
Using XML and JavaScript 155
Using JSON 158
Using JqSHtml Object 162
Creating a More Complex Lift and JavaScript Example 162
Conclusion 164
Chapter 9: Lift with AJAX and Comet 165
Understanding the Basics of Asynchronous Requests 165
Using AJAX in Lift 168
Considering a More Complex AJAX Example 170
Exploring AJAX Generators in Detail 170
Using Comet in Lift 172
Understanding Actors in Scala 173
Building a Comet-Enabled Application 175
Accessing Comet Actors from Other Code 177
Conclusion 179
Chapter 10: JPA Integration 180
Introducing JPA 180
Using Entity Classes in Scala 182
Using the orm.xml Descriptor 182
Working with Attached and Detached Objects 183
Obtaining a Per-Session EntityManager 185
Handling Transactions 186
Using ScalaEntityManager and ScalaQuery 188
Operating on Entities 188
Persisting, Merging, and Removing Entities 188
Loading an Entity 189
Loading Many Entities 190
Using Queries Wisely 191
Converting Collection Properties 192
Understanding the Importance of the flush Methods and Exceptions 192
Validating Entities 193
Supporting User Types 195
Running the Application 196
Conclusion 197
Chapter 11: Third-Party Integrations 198
Integrating OpenID 198
Integrating AMQP 200
Integrating PayPal 203
Integrating Facebook 204
Integrating XMPP 205
Conclusion 207
Chapter 12: Lift Widgets 208
Getting to Know the Lift Widgets 208
Using the TableSorter Widget 208
Using the Calendar Widgets 209
Using the RSS Feed Widget 214
Using the Gravatar Widget 215
Using the TreeView Widget 215
Using the Sparklines Widget 218
Building a Widget 219
Conclusion 220
Chapter 13: Web Services 221
Choosing to Add an API to Your Web Application 221
Reviewing a Little Bit About HTTP 221
Defining REST 223
Comparing XML-RPC and REST Architectures 223
Creating a Simple API for PocketChange 224
Pattern Matching for the URLs 224
Writing the API Service Code 225
Creating a Helper Method for the Expense Model Object 227
Setting Up the Request/Response Cycles for Our API 228
Extending the API to Return Atom Feeds 229
Conclusion 231
Copyright 232
Erscheint lt. Verlag | 8.9.2010 |
---|---|
Zusatzinfo | 200 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Programmiersprachen / -werkzeuge |
Mathematik / Informatik ► Informatik ► Software Entwicklung | |
Mathematik / Informatik ► Informatik ► Theorie / Studium | |
Schlagworte | Deployment • E-Mail • Framework • Functional Programming • JavaScript • Lift • programming • Programming language • techniques • Web Services |
ISBN-10 | 1-4302-2422-3 / 1430224223 |
ISBN-13 | 978-1-4302-2422-8 / 9781430224228 |
Haben Sie eine Frage zum Produkt? |
![PDF](/img/icon_pdf_big.jpg)
Größe: 1,5 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich