List of Listings

Chapter 1. Introducing portals and portlets

Listing 1.1. The HelloWorldPortlet class

Listing 1.2. The portlet.xml file

Listing 1.3. The build.xml file for Hello World

Chapter 2. The portlet lifecycle

Listing 2.1. Portlet class implements Portlet interface

Listing 2.2. The UserRegistrationPortlet class extends GenericPortlet

Listing 2.3. A portlet.xml file

Listing 2.4. The UserRegistrationPortlet class’s render method

Listing 2.5. Render methods in HELP and EDIT modes

Listing 2.6. The UserRegistrationPortlet class’s registerUser method

Listing 2.7. The registrationForm.jsp page

Chapter 3. Portlet 2.0 API—portlet objects and container-runtime options

Listing 3.1. Defining user attributes in the Book Catalog’s portlet.xml file

Listing 3.2. Using PortalContext to customize request-handling logic

Listing 3.3. Using encodeURL in the BookCatalogPortlet class

Listing 3.4. Dynamically setting the portlet title in the BookCatalogPortlet class

Listing 3.5. Setting render parameter in the Book Catalog portlet

Listing 3.6. Adding a <link> element to the head section

Listing 3.7. Sharing session data using PortletSession's APPLICATION_SCOPE

Listing 3.8. An example of using PortletSessionUtil

Listing 3.9. Container-runtime options in the portlet.xml file

Chapter 4. Portlet 2.0 API—caching, security, and localization

Listing 4.1. The BookCatalogPortlet class’s isMarkupValid method

Listing 4.2. The BookCatalogPortlet class’s showBooks render method

Listing 4.3. Uploading files using Apache Commons FileUpload

Listing 4.4. PortletURLGenerationListener example

Chapter 6. Using the portlet tag library

Listing 6.1. The debug.jsp page uses variables introduced by <defineObjects>.

Listing 6.2. Using <actionURL> to create dynamic links

Listing 6.3. The uploadForm.jsp file

Chapter 7. Getting started with Spring Portlet MVC

Listing 7.1. Defining dependencies in application objects

Listing 7.2. Spring’s application context XML file

Listing 7.3. The HelloWorldController class

Listing 7.4. The portlet.xml file

Listing 7.5. The helloWorld-portlet.xml file

Listing 7.6. The web.xml file

Listing 7.7. An AbstractController example

Listing 7.8. A ParameterizableViewController example

Listing 7.9. A PortletModeNameViewController example

Listing 7.10. A PortletWrappingController example

Listing 7.11. A PortletModeHandlerMapping example

Listing 7.12. A PortletModeHandlerMapping example

Listing 7.13. A ParameterHandlerMapping example

Listing 7.14. A PortletModeParameterHandlerMapping example

Listing 7.15. A handler mapping chain example

Listing 7.16. A handler interceptor example

Listing 7.17. afterRenderCompletion methodpostRenderHandle methodpreRenderHandle methodA handler interceptor example

Chapter 8. Annotation-driven development with Spring

Listing 8.1. An @Controller annotation

Listing 8.2. A type-level @RequestMapping annotation

Listing 8.3. A type-level @RequestMapping annotation using the params element

Listing 8.4. Correct and incorrect method-level @RequestMapping annotations

Listing 8.5. Correct and incorrect method-level @RequestMapping annotations

Listing 8.6. Method-level @RequestMapping annotations

Listing 8.7. An @RenderMapping annotation

Listing 8.8. An @RenderMapping annotation

Listing 8.9. An @RenderMapping annotation

Listing 8.10. An @ActionMapping annotation

Listing 8.11. An @ActionMapping annotation with a value element

Listing 8.12. An @RequestParam annotation

Listing 8.13. A method-level @ModelAttribute annotation

Listing 8.14. A method-level @ModelAttribute annotation for creating command object

Listing 8.15. An @ModelAttribute annotation

Listing 8.16. An @SessionAttributes annotation

Listing 8.17. The WebDataBinder initialization

Listing 8.18. Configuring a handler interceptor

Listing 8.19. A Spring Validation API example

Listing 8.20. The SomeController handler using the @Valid annotation

Listing 8.21. The WebDataBinder configuration in the web application context XML

Listing 8.22. Setting the validator in the @InitBinder method

Listing 8.23. Validating Book domain object using Spring Validation API

Listing 8.24. Using JSR 303 with the Book domain object

Listing 8.25. Configuring LocalValidatorFactoryBean in application context XML

Listing 8.26. Using the @Valid annotation in the AddBookController

Listing 8.27. Programmatic validation using the JSR 303 Validator

Listing 8.28. Programmatic validation using the Spring Validator

Listing 8.29. Defining the @Unique constraint annotation

Listing 8.30. The MyUniqueConstraintValidator validator

Listing 8.31. The addBookForm.jsp page

Listing 8.32. The build.xml JUnit ant task

Listing 8.33. The AddBookController handler to be tested

Listing 8.34. A JUnit test for AddBookController

Listing 8.35. A JUnit test for AddBookController using the TestContext framework

Listing 8.36. The bookCatalogTest-portlet.xml application context XML file

Listing 8.37. The SomeController handler using the MessageSourceAware interface

Chapter 9. Integrating portlets with databases

Listing 9.1. Defining a DataSource bean in the application context XML file

Listing 9.2. The jdbc.properties data source properties file

Listing 9.3. The Tomcat server.xml file

Listing 9.4. The jee schema’s <jndi-lookup> element

Listing 9.5. A JdbcTemplate bean

Listing 9.6. The BookDao interface

Listing 9.7. The JdbcBookDao class

Listing 9.8. Using the PreparedStatementSetter callback interface

Listing 9.9. The BookServiceImpl implementation class

Listing 9.10. Retrieving beans from root WebApplicationContext object

Listing 9.11. AspectJ annotations in the AuditAspect class

Listing 9.12. The LoggingAspect aspect with an @Around advice

Listing 9.13. Defining aspects in the applicationContext.xml file

Listing 9.14. Configuring DataSourceTransactionManager in applicationContext.xml

Listing 9.15. Using the @Transactional annotation

Listing 9.16. Activating transaction management using <annotation-driven> element

Listing 9.17. Annotation-driven object-relational mapping for the Book class

Listing 9.18. AuditFields superclass of Book entity

Listing 9.19. Configuring Hibernate

Listing 9.20. Saving a Book entity instance

Listing 9.21. Defining the AnnotationSessionFactoryBean bean

Listing 9.22. A DAO implementation using Hibernate’s SessionFactory

Listing 9.23. Configuring Spring-managed transactions

Chapter 10. Personalizing portlets

Listing 10.1. The preferences.jsp page

Listing 10.2. Retrieving user preferences from request in savePreferences method

Listing 10.3. Saving the user’s preferences in the savePreferences method

Listing 10.4. Setting preferences after invoking the store method

Listing 10.5. Removing a preference using the reset and setValue methods

Listing 10.6. Validating preferences before calling the store method

Listing 10.7. BookCatalogPrefsValidator validation logic for preferences

Listing 10.8. The BookCatalogPrefsValidator configuration

Listing 10.9. The BookCatalogPortlet's savePreferences method

Listing 10.10. BookCatalogPrefsValidator checking if ISBN was entered

Listing 10.11. The BookCatalogPortlet class’s savePreferences method

Listing 10.12. The preferences.jsp page, modified to show saved preferences

Listing 10.13. The showBooks method personalizes content by category.

Listing 10.14. The BookCatalogPortlet class’s searchBooks method

Listing 10.15. Portlet preferences defined in portlet.xml

Chapter 11. Communicating with other portlets

Listing 11.1. Defining multiple portlets in the portlet deployment descriptor

Listing 11.2. The BookCatalogPortlet class’s addBook method

Listing 11.3. The RecentlyAddedBookPortlet class

Listing 11.4. The Book Catalog portlet’s portlet.xml file

Listing 11.5. The Recently Added Book portlet’s portlet.xml file

Listing 11.6. A portlet.xml using the default-namespace element

Listing 11.7. The addBook method of the BookCatalogPortlet class

Listing 11.8. The BookAddedEvent event payload

Listing 11.9. Defining an event in the Book Catalog portlet’s portlet.xml file

Listing 11.10. Defining support for processing an event in the portlet.xml file

Listing 11.11. The process event in the RecentlyAddedBookPortlet class

Chapter 12. Ajaxing portlets

Listing 12.1. The DateTimePortlet class

Listing 12.2. Sending an Ajax request with the XMLHttpRequest object

Listing 12.3. Ajax request handling in the DateTimeServlet

Listing 12.4. Displaying the server date and time on the home.jsp page

Listing 12.5. Storing user roles in PortletSession

Listing 12.6. Role-based programmatic security in DateTimeServlet

Listing 12.7. Creating a resource URL in the DateTimePortlet class

Listing 12.8. The DateTimePortlet’s serveResource method

Listing 12.9. Serving TOC files with the serveResource method

Listing 12.10. JavaScript and CSS files for using Dijit widgets in liferay-portlet.xml

Listing 12.11. Adding widgets to the home.jsp JSP page

Listing 12.12. JavaScript in home.jsp that parses HTML and creates user interface

Listing 12.13. Displaying catalog data with the getBooks JavaScript function

Listing 12.14. Serving catalog data with the serveResource method

Listing 12.15. Removing a book with the home.jsp page’s removeBook function

Listing 12.16. Displaying a message with the showBookUpdateMsg JavaScript function

Listing 12.17. Invoking methods in a simple Java object—BookCatalogAjaxBean

Listing 12.18. The DWR configuration file—dwr.xml

Listing 12.19. DwrServlet configuration in the web.xml file

Listing 12.20. The Message class

Listing 12.21. addBook JavaScript function in home.jsp page

Listing 12.22. The home.jsp page’s uploadToCFile function

Listing 12.23. JavaScript in home.jsp that begins Reverse Ajax

Listing 12.24. The BookCatalogAjaxBean class’s startBookUpdateThread method

Listing 12.25. The UpdateSender class

Chapter 13. Reusable logic with portlet filters

Listing 13.1. PortletTitleFilter dynamically sets the portlet window title.

Listing 13.2. PortletTitleFilter configuration in the portlet.xml file

Listing 13.3. UtilityFilter checks the action request.

Listing 13.4. The CharResponseWrapper class

Listing 13.5. HyperlinkFilter configuration in the portlet.xml file

Listing 13.6. The HyperlinkFilter class

Chapter 14. Portlet bridges

Listing 14.1. The BookCatalogBean class

Listing 14.2. The home.xhtml file

Listing 14.3. The addBookForm.xhtml file

Listing 14.4. The Book Catalog portlet application’s portlet.xml file

Listing 14.5. The Home.html page

Listing 14.6. The Home class

Listing 14.7. The BookCatalogApp class

Listing 14.8. The web.xml file

Listing 14.9. The Book Catalog portlet application’s portlet.xml file

Appendix A. Getting started with GateIn Portal

Listing A.1. The BookCatalogPortlet class’s removeBook method

Listing A.2. The organization-configuration.xml file

Appendix B. Configuring Liferay Portal with MySQL database

Listing B.1. Overriding database properties in the portal-ext.properties file

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.184.102