1. Trang chủ
  2. » Công Nghệ Thông Tin

ortlets in Action pptx

644 1,2K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 644
Dung lượng 17,47 MB

Nội dung

MANNING Ashish Sarin Covers Portlet 2.0, Spring 3.0 Portlet MVC, WSRP 2.0, Portlet Bridges, Ajax, Comet, Liferay, GateIn, Spring JDBC and Hibernate IN ACTION www.it-ebooks.info BEST PRACTICES INSIDE THE BOOK Best Practice Page number Section Use user attributes to obtain user information in portals 96 3.2.2 Handle portal server–specific requests using PortalContext 99 3.2.4 Encode URLs to resources 102 3.3.1 Choose appropriate portlet lifecycle phase to process an action 107 3.3.4 Add custom JavaScript and CSS files to a portal page using MARKUP_HEAD element 108 3.3.5 Choose appropriate PortletSession scope for storing objects 116 3.4.4 Evaluate use of container-runtime options 123 3.7.1 Use actionScopedRequestAttributes along with PortletSession 127 3.7.1 Choose wisely when to use servletDefaultSessionScope container-runtime option 128 3.7.2 Consider performance impact of container-runtime options 130 3.7.5 Choose appropriate validation token in validation-based caching strategy 140 4.1.2 Localize portlet content 141 4.2 Use Apache Commons FileUpload for uploading files 156 4.6.1 Override portlet request and response objects’ functionality using wrapper classes 158 4.6.2 Design portable portlets 161 4.7 Simplify portlet URL creation using portlet tag library tags 213 6.3 (Continued on inside back cover) www.it-ebooks.info Portlets in Action www.it-ebooks.info www.it-ebooks.info Portlets in Action ASHISH SARIN MANNING SHELTER ISLAND www.it-ebooks.info For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 261 Shelter Island, NY 11964 Email: orders@manning.com ©2012 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editors: Emily Macel, Jeff Bleiel 20 Baldwin Road Copyeditor: Andy Carroll PO Box 261 Proofreader: Katie Tennant Shelter Island, NY 11964 Typesetter: Dennis Dalinnik Cover designer: Marija Tudor ISBN: 9781935182542 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – MAL – 17 16 15 14 13 12 11 www.it-ebooks.info v brief contents PART 1 GETTING STARTED WITH PORTLET DEVELOPMENT 1 1 ■ Introducing portals and portlets 3 2 ■ The portlet lifecycle 48 3 ■ Portlet 2.0 API—portlet objects and container-runtime options 86 4 ■ Portlet 2.0 API—caching, security, and localization 132 5 ■ Building your own portal 167 6 ■ Using the portlet tag library 207 PART 2 DEVELOPING PORTLETS USING SPRING AND HIBERNATE 231 7 ■ Getting started with Spring Portlet MVC 233 8 ■ Annotation-driven development with Spring 281 9 ■ Integrating portlets with databases 334 www.it-ebooks.info BRIEF CONTENTSvi PART 3 ADVANCED PORTLET DEVELOPMENT 373 10 ■ Personalizing portlets 375 11 ■ Communicating with other portlets 405 12 ■ Ajaxing portlets 437 13 ■ Reusable logic with portlet filters 494 14 ■ Portlet bridges 510 15 ■ Web Services for Remote Portlets (WSRP) 533 www.it-ebooks.info vii contents preface xix acknowledgments xxi about this book xxii about the cover illustration xxvii PART 1 GETTING STARTED WITH PORTLET DEVELOPMENT 1 1 Introducing portals and portlets 3 1.1 What is a portal? 4 1.2 Benefits of web portals 6 Enriched user experience 6 ■ Unified information view 9 1.3 What is a portlet? 10 1.4 Why use portlets? 12 Inter-portlet communication vs. inter-servlet communication 12 ■ Portlets vs. widgets 13 Creating mashups 15 1.5 Portal infrastructure 15 The portlet container 15 ■ The portal server 16 www.it-ebooks.info CONTENTS viii 1.6 Getting started with Liferay Portal 18 Installing Liferay Portal 6.x 18 ■ Registering users with Liferay Portal 20 ■ Creating a public portal page in Liferay Portal 21 ■ Adding portlets to a Liferay Portal page 23 ■ Roles and permissions in Liferay Portal 24 1.7 Setting up the development environment 26 Configuring Eclipse IDE 26 ■ Setting up the project structure 34 1.8 The Hello World portlet example 35 Creating a Hello World portlet 35 ■ Building the Hello World project with Ant 39 ■ Building the Hello World project with Maven 42 ■ Adding the Hello World portlet to a portal page 43 ■ Undeploying a portlet application 46 1.9 Summary 46 2 The portlet lifecycle 48 2.1 Requirements for the User Registration portlet 49 2.2 Portlets vs. servlets—an in-depth look 51 Portlet and servlet containers 51 ■ Portlets—web components with multiple request-processing phases 52 2.3 Portlet URLs 54 Portlet URLs vs. servlet URLs 54 ■ Portlet URL types 56 2.4 Creating portlets 57 Creating portlets with the Portlet interface 57 ■ Creating portlets with the GenericPortlet class 60 2.5 Generating portlet content based on portlet mode 62 Writing content generation methods for each portlet mode 64 Defining support for portlet modes 67 2.6 Portlet development in depth 68 The Portlet API objects 69 ■ Creating JSPs to display portlet content 70 ■ The portlet deployment descriptor 72 Dispatching portlet requests using the PortletRequestDispatcher 73 Internationalization and localization using resource bundles 75 Portlet initialization parameters 76 ■ Creating portlet URLs 76 Container-runtime options 78 www.it-ebooks.info [...]... with Spring Portlet MVC 262 Using PortletModeHandlerMapping 263 Using ParameterHandlerMapping 264 Using PortletModeParameterHandlerMapping 267 Using AbstractHandlerMapping 270 7.9 Using handler interceptors 272 Implementing and configuring a handler interceptor Processing requests using handler interceptors 273 www.it-ebooks.info 272 CONTENTS 7.10 Handling exceptions xiii 276 Request handling with... 288 Dependency injection using @Resource and @Inject 289 Mapping requests to handlers and methods using @RequestMapping 290 Identifying render methods with @RenderMapping 295 Identifying action methods with @ActionMapping 297 Passing request parameters using @RequestParam 299 Identifying model attributes using @ModelAttribute 301 Reusing model attributes using @SessionAttributes 304 Handling exceptions... example 11.3 Inter-portlet communication using portlet sessions 407 409 Defining multiple portlets in the portlet deployment descriptor 410 Storing and retrieving information from PortletSession 411 Inter-portlet communication in action 415 Advantages and disadvantages of using PortletSession 416 ■ ■ ■ 11.4 Inter-portlet communication using public render parameters 417 Setting and retrieving public render... 12.4 Ajax support in Portlet 2.0 450 Serving resources using the ResourceServingPortlet interface 450 Sending a resource request using a resource URL 453 Serving resources the Spring Portlet MVC way 455 12.5 Downloading binary content using portlets 455 12.6 Resource URLs and caching 458 12.7 Creating a rich interface for the Book Catalog portlet 459 12.8 Creating rich user interfaces using Ajax 461 Simplified... AspectJ Transaction management support in Spring Framework 358 Defining a transaction manager 358 Specifying transactional methods 359 Configuring annotation-driven transaction management 360 ■ ■ 9.7 Using Hibernate for database interaction 361 Using the Java Persistence API (JPA) 362 Mapping classes to relational database tables 363 Connecting to a database 365 Using Spring with Hibernate 367 ■ ■ 9.8 Summary... Unit testing with Spring’s TestContext framework 327 ■ ■ 8.8 Localizing content, uploading files, and adding CSS and JavaScript 330 Localizing content 330 Adding external JavaScript and CSS files 331 Uploading files using PortletMultipartResolver 332 ■ ■ 8.9 Summary 333 www.it-ebooks.info CONTENTS xiv 9 Integrating portlets with databases 334 9.1 Combining portlets and databases 9.2 Exploring the Book... table 337 Spring’s JDBC module for database interaction 338 Defining a data source 339 Creating database connections 345 Creating DAOs 346 Creating service interface and implementation classes 349 ■ ■ ■ 9.4 Accessing Spring beans from non-Spring objects 9.5 AOP support in Spring Framework 352 Spring AOP and AspectJ annotations annotations to create aspects 354 9.6 354 ■ 351 Using AspectJ Transaction management... 210 Using in the Book Catalog portlet 212 6.3 Using , , and 213 Using the tag 213 Using the tag 220 Using the tag ■ ■ 6.4 Adding parameters to portlet URLs using Using the tag 221 string concatenation 223 6.5 220 ■ Adding parameters using Creating portlet-specific HTML elements using ... context 249 Naming web application context XML files 249 beans defined in the web application context XML 7.7 Using built -in controllers ■ Scope of 250 252 Using the Controller interface 253 Using the AbstractController 254 Using the ParameterizableViewController 256 Using the PortletModeNameViewController 257 Using the PortletWrappingController 259 7.8 Using built -in handler mappings 260 Developing a Book... Encoding URLs with the encodeURL method 102 Generating content using RenderResponse 103 Responding to an action using ActionResponse 104 Choosing an appropriate phase for an action 107 Adding custom JavaScript and CSS files to a portal page 108 ■ ■ ■ ■ 3.4 Storing user-specific data in a portlet session 112 PortletSession object and methods 112 PortletSession usage in the Book Catalog portlet 113 Obtaining . using portlet tag library tags 213 6.3 (Continued on inside back cover) www.it-ebooks.info Portlets in Action www.it-ebooks.info www.it-ebooks.info Portlets. Action www.it-ebooks.info www.it-ebooks.info Portlets in Action ASHISH SARIN MANNING SHELTER ISLAND www.it-ebooks.info For online information and ordering of this and other Manning books, please

Ngày đăng: 15/03/2014, 20:20

TỪ KHÓA LIÊN QUAN