Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 12. Ajaxing portlets > Downloading binary content using portlets

12.5. Downloading binary content using portlets

You’ll seldom come across real-world portlets that don’t need to serve binary content. For instance, the Book Catalog portlet needs to serve the Table of Contents (TOC) of each book in the catalog, which could be in PDF or MS Word format. Similarly, a picture viewer portlet needs to serve images; an announcement portlet needs to provide announcement-related details in PDF or MS Word format.

To download binary content, you can either use a direct link to the resource or a resource URL pointing to the resource. Direct links are created by the portlet and encoded using the encodeURL method of the PortletResponse object. If the resource is located within the portlet application, you can access the resource using a direct link. In previous chapters, you used direct links to add portlet application resources, like CSS and JavaScript files, to the portal page. In the Book Catalog portlet, if the TOCs of all the books are located within the portlet application, direct links can be used to download them.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial