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

Cấu trúc

  • Front cover

  • brief contents

  • contents

  • preface

  • acknowledgments

  • about this book

    • Roadmap

    • How to use this book

    • Who should read this book?

    • Source code conventions

    • Software requirements

    • Source code downloads

    • Author Online

  • about the cover illustration

  • Part 1 – Getting started with portlet development

    • Introducing portals and portlets

      • 1.1 What is a portal?

      • 1.2 Benefits of web portals

        • 1.2.1 Enriched user experience

        • 1.2.2 Unified information view

      • 1.3 What is a portlet?

      • 1.4 Why use portlets?

        • 1.4.1 Inter-portlet communication vs. inter-servlet communication

        • 1.4.2 Portlets vs. widgets

        • 1.4.3 Creating mashups

      • 1.5 Portal infrastructure

        • 1.5.1 The portlet container

        • 1.5.2 The portal server

      • 1.6 Getting started with Liferay Portal

        • 1.6.1 Installing Liferay Portal 6.x

        • 1.6.2 Registering users with Liferay Portal

        • 1.6.3 Creating a public portal page in Liferay Portal

        • 1.6.4 Adding portlets to a Liferay Portal page

        • 1.6.5 Roles and permissions in Liferay Portal

      • 1.7 Setting up the development environment

        • 1.7.1 Configuring Eclipse IDE

        • 1.7.2 Setting up the project structure

      • 1.8 The Hello World portlet example

        • 1.8.1 Creating a Hello World portlet

        • 1.8.2 Building the Hello World project with Ant

        • 1.8.3 Building the Hello World project with Maven

        • 1.8.4 Adding the Hello World portlet to a portal page

        • 1.8.5 Undeploying a portlet application

      • 1.9 Summary

    • The portlet lifecycle

      • 2.1 Requirements for the User Registration portlet

      • 2.2 Portlets vs. servlets-an in-depth look

        • 2.2.1 Portlet and servlet containers

        • 2.2.2 Portlets-web components with multiple request-processing phases

      • 2.3 Portlet URLs

        • 2.3.1 Portlet URLs vs. servlet URLs

        • 2.3.2 Portlet URL types

      • 2.4 Creating portlets

        • 2.4.1 Creating portlets with the Portlet interface

        • 2.4.2 Creating portlets with the GenericPortlet class

      • 2.5 Generating portlet content based on portlet mode

        • 2.5.1 Writing content generation methods for each portlet mode

        • 2.5.2 Defining support for portlet modes

      • 2.6 Portlet development in depth

        • 2.6.1 The Portlet API objects

        • 2.6.2 Creating JSPs to display portlet content

        • 2.6.3 The portlet deployment descriptor

        • 2.6.4 Dispatching portlet requests using the PortletRequestDispatcher

        • 2.6.5 Internationalization and localization using resource bundles

        • 2.6.6 Portlet initialization parameters

        • 2.6.7 Creating portlet URLs

        • 2.6.8 Container-runtime options

      • 2.7 Implementing the User Registration portlet

        • 2.7.1 The UserRegistrationPortlet class

        • 2.7.2 JSP pages

      • 2.8 Summary

    • Portlet 2.0 API- portlet objects and container-runtime options

      • 3.1 Requirements for the Book Catalog portlet

      • 3.2 Portlet request objects

        • 3.2.1 Portlet request objects and lifecycle interfaces

        • 3.2.2 PortletRequest constants

        • 3.2.3 PortletRequest methods

        • 3.2.4 Handling portal server-specific requests using PortalContext

      • 3.3 Portlet response objects

        • 3.3.1 Encoding URLs with the encodeURL method

        • 3.3.2 Generating content using RenderResponse

        • 3.3.3 Responding to an action using ActionResponse

        • 3.3.4 Choosing an appropriate phase for an action

        • 3.3.5 Adding custom JavaScript and CSS files to a portal page

      • 3.4 Storing user-specific data in a portlet session

        • 3.4.1 PortletSession object and methods

        • 3.4.2 PortletSession usage in the Book Catalog portlet

        • 3.4.3 Obtaining session attributes using PortletSessionUtil

        • 3.4.4 An in-depth look at portlet session scopes

        • 3.4.5 Portlet session and content caching

        • 3.4.6 Similarities between HttpSession and PortletSession

        • 3.4.7 Sharing session data across portlet applications

      • 3.5 Discovering the portlet environment using PortletContext

      • 3.6 Retrieving portlet configuration using PortletConfig

      • 3.7 Container-runtime options

        • 3.7.1 Using actionScopedRequestAttributes

        • 3.7.2 Using servletDefaultSessionScope

        • 3.7.3 Using escapeXml

        • 3.7.4 Using renderHeaders

        • 3.7.5 Specifying Portlet and Portlet application container-runtime options

      • 3.8 Summary

    • Portlet 2.0 API- caching, security, and localization

      • 4.1 Caching generated content

        • 4.1.1 Expiration-based content caching

        • 4.1.2 Validation-based content caching

      • 4.2 Localizing portlet content

        • 4.2.1 Implementing portlets to support localization

        • 4.2.2 Changing locales using built-in portlets

      • 4.3 Portlet modes in depth

        • 4.3.1 Custom portlet modes

        • 4.3.2 Portal-managed and portlet-managed portlet modes

        • 4.3.3 Portlet modes and markup types

      • 4.4 Portlet window states in depth

        • 4.4.1 Custom window states

        • 4.4.2 Portlet window states and markup types

      • 4.5 Programmatic security

      • 4.6 Uploading files, wrapping requests and responses, and creating portlet URL generation listeners

        • 4.6.1 Uploading files

        • 4.6.2 Using wrapper classes

        • 4.6.3 Using the PortletURLGenerationListener interface

      • 4.7 Designing portable portlets

        • 4.7.1 Portal server features and limitations

        • 4.7.2 Designing for change

      • 4.8 Summary

    • Building your own portal

      • 5.1 Requirements for Book Portal

      • 5.2 Getting started developing Book Portal

        • 5.2.1 Creating an organization for Book Portal

        • 5.2.2 Creating roles for Book Portal users

        • 5.2.3 Mapping roles to the Book Portal organization

        • 5.2.4 Creating Book Portal users and assigning them to the organization

        • 5.2.5 Mapping users to roles

      • 5.3 Creating portal pages and adding portlets

        • 5.3.1 Creating a Home portal page

        • 5.3.2 Adding an Announcements portlet

        • 5.3.3 Adding an RSS feed portlet

        • 5.3.4 Setting permissions for portal pages and portlets

        • 5.3.5 Using the built-in Document Library and Book Catalog portlets together

        • 5.3.6 Setting permissions for displaying the book catalog

        • 5.3.7 Setting permissions for displaying discussion forums

      • 5.4 Configuring Liferay Portal server settings

        • 5.4.1 Setting the authentication mechanism

        • 5.4.2 Specifying the default user associations

      • 5.5 Developing with the Liferay Plugins SDK

        • 5.5.1 Configuring the Plugins SDK

        • 5.5.2 Developing portal themes

        • 5.5.3 Developing page layout templates

      • 5.6 Summary

    • Using the portlet tag library

      • 6.1 Using the tag library to build a Book Catalog portlet

      • 6.2 Accessing portlet-specific objects using <defineObjects>

        • 6.2.1 Making portlet objects available with <defineObjects>

        • 6.2.2 Using <defineObjects> in the Book Catalog portlet

      • 6.3 Using <actionURL>, <renderURL>, and <resourceURL>

        • 6.3.1 Using the <actionURL> tag

        • 6.3.2 Using the <renderURL> tag

        • 6.3.3 Using the <resourceURL> tag

      • 6.4 Adding parameters to portlet URLs using <param>

        • 6.4.1 Using the <param> tag

        • 6.4.2 Adding parameters using string concatenation

      • 6.5 Creating portlet-specific HTML elements using <namespace>

        • 6.5.1 When to use the <namespace> tag

        • 6.5.2 Obtaining form field values in the portlet class

      • 6.6 Adding properties to URLs using <property>

      • 6.7 Summary

  • Part 2 – Developing portlets using Spring and Hibernate

    • Getting started with Spring Portlet MVC

      • 7.1 Why use Spring Portlet MVC?

      • 7.2 Dependency injection and the application context

        • 7.2.1 An e-commerce example

        • 7.2.2 Dependency injection and application contexts

        • 7.2.3 Web application contexts

      • 7.3 A Hello World portlet, the Spring way

        • 7.3.1 The Hello World portlet’s controller class

        • 7.3.2 The Hello World portlet’s JSP page

        • 7.3.3 The Hello World portlet’s portlet deployment descriptor

        • 7.3.4 The Hello World portlet’s web application context

        • 7.3.5 The Hello World portlet’s web application deployment descriptor

      • 7.4 How Spring Portlet MVC works

      • 7.5 Using DispatcherPortlet

      • 7.6 Using the web application context

        • 7.6.1 Naming web application context XML files

        • 7.6.2 Scope of beans defined in the web application context XML

      • 7.7 Using built-in controllers

        • 7.7.1 Using the Controller interface

        • 7.7.2 Using the AbstractController

        • 7.7.3 Using the ParameterizableViewController

        • 7.7.4 Using the PortletModeNameViewController

        • 7.7.5 Using the PortletWrappingController

      • 7.8 Using built-in handler mappings

        • 7.8.1 Developing a Book Catalog portlet with Spring Portlet MVC

        • 7.8.2 Using PortletModeHandlerMapping

        • 7.8.3 Using ParameterHandlerMapping

        • 7.8.4 Using PortletModeParameterHandlerMapping

        • 7.8.5 Using AbstractHandlerMapping

      • 7.9 Using handler interceptors

        • 7.9.1 Implementing and configuring a handler interceptor

        • 7.9.2 Processing requests using handler interceptors

      • 7.10 Handling exceptions

        • 7.10.1 Request handling with exceptions

        • 7.10.2 Mapping exceptions to a view based on the exception class

      • 7.11 Summary

    • Annotation-driven development with Spring

      • 8.1 An overview of annotations

      • 8.2 Developing the Book Catalog portlet using annotations

      • 8.3 Spring Portlet MVC annotations

        • 8.3.1 Identifying controllers with @Controller

        • 8.3.2 Classpath scanning and autoregistration

        • 8.3.3 Dependency injection using @Autowired and @Qualifier

        • 8.3.4 Dependency injection using @Resource and @Inject

        • 8.3.5 Mapping requests to handlers and methods using @RequestMapping

        • 8.3.6 Identifying render methods with @RenderMapping

        • 8.3.7 Identifying action methods with @ActionMapping

        • 8.3.8 Passing request parameters using @RequestParam

        • 8.3.9 Identifying model attributes using @ModelAttribute

        • 8.3.10 Reusing model attributes using @SessionAttributes

        • 8.3.11 Handling exceptions with @ExceptionHandler

        • 8.3.12 Initializing WebDataBinder using @InitBinder

      • 8.4 Configuring beans that provide annotation support

      • 8.5 Validating forms using Spring and JSR 303

        • 8.5.1 The Spring Validation API

        • 8.5.2 Validating beans with JSR 303

      • 8.6 Spring’s form tag library

      • 8.7 Unit testing with mock objects and TestContext

        • 8.7.1 Ant buildfile to run unit tests

        • 8.7.2 Unit testing with mock objects

        • 8.7.3 Unit testing with Spring’s TestContext framework

      • 8.8 Localizing content, uploading files, and adding CSS and JavaScript

        • 8.8.1 Localizing content

        • 8.8.2 Adding external JavaScript and CSS files

        • 8.8.3 Uploading files using PortletMultipartResolver

      • 8.9 Summary

    • Integrating portlets with databases

      • 9.1 Combining portlets and databases

      • 9.2 Exploring the Book Catalog portlet’s database tables

        • 9.2.1 The BOOK_TBL table

        • 9.2.2 The TOC_TBL table

      • 9.3 Spring’s JDBC module for database interaction

        • 9.3.1 Defining a data source

        • 9.3.2 Creating database connections

        • 9.3.3 Creating DAOs

        • 9.3.4 Creating service interface and implementation classes

      • 9.4 Accessing Spring beans from non-Spring objects

      • 9.5 AOP support in Spring Framework

        • 9.5.1 Spring AOP and AspectJ annotations

        • 9.5.2 Using AspectJ annotations to create aspects

      • 9.6 Transaction management support in Spring Framework

        • 9.6.1 Defining a transaction manager

        • 9.6.2 Specifying transactional methods

        • 9.6.3 Configuring annotation-driven transaction management

      • 9.7 Using Hibernate for database interaction

        • 9.7.1 Using the Java Persistence API (JPA)

        • 9.7.2 Mapping classes to relational database tables

        • 9.7.3 Connecting to a database

        • 9.7.4 Using Spring with Hibernate

      • 9.8 Summary

  • Part 3 – Advanced portlet development

    • Personalizing portlets

      • 10.1 Introducing portlet personalization

      • 10.2 Personalization requirements for the Book Catalog portlet

      • 10.3 Showing personalization options in EDIT mode

        • 10.3.1 Adding support for EDIT portlet mode

        • 10.3.2 Writing a render method for EDIT portlet mode

      • 10.4 Saving user preferences

        • 10.4.1 Retrieving user preferences from the portlet request

        • 10.4.2 Saving portlet preferences to the persistent store

      • 10.5 Saving preferences with PortletPreferences

        • 10.5.1 Atomicity in saving preferences

        • 10.5.2 Concurrency issues in saving preferences

        • 10.5.3 Resetting preferences

      • 10.6 Validating preferences

        • 10.6.1 Validating preferences before setting them in PortletPreferences

        • 10.6.2 Validating preferences using PreferencesValidator

        • 10.6.3 Configuring PreferencesValidator in the portlet deployment descriptor

        • 10.6.4 Handling ValidatorException

      • 10.7 Retrieving portlet preferences and personalizing the portlet

        • 10.7.1 Obtaining preferences in the portlet class and JSP pages

        • 10.7.2 Personalizing content and behavior

        • 10.7.3 Defining portlet preferences in portlet.xml

      • 10.8 Summary

    • Communicating with other portlets

      • 11.1 Why do you need inter-portlet communication?

      • 11.2 An inter-portlet communication example

      • 11.3 Inter-portlet communication using portlet sessions

        • 11.3.1 Defining multiple portlets in the portlet deployment descriptor

        • 11.3.2 Storing and retrieving information from PortletSession

        • 11.3.3 Inter-portlet communication in action

        • 11.3.4 Advantages and disadvantages of using PortletSession

      • 11.4 Inter-portlet communication using public render parameters

        • 11.4.1 Setting and retrieving public render parameters

        • 11.4.2 Methods related to public render parameters

        • 11.4.3 Advantages and disadvantages of using public render parameters

        • 11.4.4 Putting public render parameters to work

      • 11.5 Inter-portlet communication using portlet events

        • 11.5.1 Sending portlet events

        • 11.5.2 Receiving portlet events

        • 11.5.3 Advantages and disadvantages of using portlet events

        • 11.5.4 Event support in Spring Portlet MVC

      • 11.6 Summary

    • Ajaxing portlets

      • 12.1 Ajax basics

      • 12.2 Your first Ajax portlet

        • 12.2.1 Creating a portlet that displays date and time

        • 12.2.2 Sending Ajax requests using the XMLHttpRequest object

        • 12.2.3 Handling Ajax requests using portlet or servlet components

        • 12.2.4 Retrieving the servlet response to update portlet content

      • 12.3 Securing Ajax requests

        • 12.3.1 Date/Time portlet’s security requirements and possible solutions

        • 12.3.2 Implementing security using portal server-specific APIs

      • 12.4 Ajax support in Portlet 2.0

        • 12.4.1 Serving resources using the ResourceServingPortlet interface

        • 12.4.2 Sending a resource request using a resource URL

        • 12.4.3 Serving resources the Spring Portlet MVC way

      • 12.5 Downloading binary content using portlets

      • 12.6 Resource URLs and caching

      • 12.7 Creating a rich interface for the Book Catalog portlet

      • 12.8 Creating rich user interfaces using Ajax

        • 12.8.1 Simplified Ajax with Dojo

        • 12.8.2 Simplified Ajax with jQuery

        • 12.8.3 Simplified Ajax with DWR

      • 12.9 Creating real-time portlets using Polling and Comet

        • 12.9.1 Polling-pulling data at regular intervals

        • 12.9.2 Comet or Reverse Ajax-pushing data when it’s available

        • 12.9.3 Comet support in DWR

        • 12.9.4 DWR integration with other frameworks

      • 12.10 Cross-domain Ajax

      • 12.11 Ajax and inter-portlet communication

        • 12.11.1 Inter-portlet communication using Comet

        • 12.11.2 Inter-portlet communication using a JavaScript function

      • 12.12 Summary

    • Reusable logic with portlet filters

      • 13.1 Types of portlet filters

      • 13.2 Portlet filter interface methods and lifecycle

        • 13.2.1 Portlet filter interface methods

        • 13.2.2 Portlet filter lifecycle

      • 13.3 Using portlet filters with the Book Catalog portlet

      • 13.4 Setting the portlet title with the portlet filter

      • 13.5 Validating requests with portlet filters

      • 13.6 Converting text to hyperlinks with portlet filters

      • 13.7 Filter chaining

      • 13.8 Summary

    • Portlet bridges

      • 14.1 What is a portlet bridge?

      • 14.2 iFrame portlets

      • 14.3 JSF portlets

        • 14.3.1 Book Catalog JSF web application requirements

        • 14.3.2 JSF web application project structure

        • 14.3.3 Developing the Book Catalog web application using JSF

        • 14.3.4 Developing the Book Catalog portlet using a JSF portlet bridge

      • 14.4 Wicket portlets

        • 14.4.1 Book Catalog Wicket web application requirements

        • 14.4.2 Wicket web application project structure

        • 14.4.3 Developing the Book Catalog web application using Wicket

        • 14.4.4 Developing the Book Catalog portlet using a Wicket portlet bridge

      • 14.5 Summary

    • Web Services for Remote Portlets (WSRP)

      • 15.1 What makes remote portlets a reality?

      • 15.2 Getting started with WSRP using Liferay Portal

      • 15.3 Creating a WSRP producer and adding portlets to it

      • 15.4 Creating a WSRP consumer

      • 15.5 Locally registering remote portlets

      • 15.6 Registering WSRP consumers with WSRP producers

        • 15.6.1 Out-of-band registration

        • 15.6.2 In-band registration

        • 15.6.3 In-band and out-of-band registration examples

        • 15.6.4 Leasing

      • 15.7 Summary

    • Getting started with GateIn Portal

      • A.1 Installing GateIn Portal

      • A.2 Getting familiar with the GateIn Portal user interface

      • A.3 Creating the Book Portal web portal

        • A.3.1 Setting up a new web portal

        • A.3.2 Creating a web portal user

        • A.3.3 Creating a custom user group

        • A.3.4 Associating users to groups

        • A.3.5 Removing the portal’s default home page

        • A.3.6 Creating portal pages and adding portlets

        • A.3.7 Programmatically securing a custom portlet

        • A.3.8 Importing custom portlets into GateIn Portal

        • A.3.9 Defining default groups and memberships for registered users

    • Configuring Liferay Portal with MySQL database

      • B.1 Installing MySQL database and HeidiSQL client

      • B.2 Getting started with your own portal database

        • B.2.1 Configuring Liferay Portal with MySQL

        • B.2.2 Exploring the Liferay Portal database tables

  • index

    • Symbols

    • Numerics

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X

    • Z

  • Back cover

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