peter laird. | 1 building dynamic google gadgets in java peter laird managing architect weblogic...
TRANSCRIPT
![Page 1: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/1.jpg)
Peter Laird. | 1
Building Dynamic Google Gadgets in Java
Peter LairdManaging ArchitectWebLogic PortalBEA Systems
![Page 2: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/2.jpg)
BEA Confidential
About the Speaker
Has 10 years of server side Java development experience
Leads the architecture team for BEA WebLogic Portal, a leading Java enterprise portal product
Has worked on WebLogic Portal for 7 years as a developer and architect
Holds the following certifications Oracle DBA Cisco CCNA
Regular contributor to BEA’s developer website http://dev2dev.bea.com
![Page 3: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/3.jpg)
BEA Confidential
Agenda
Introduction to iGoogle and Google Gadgets
Google Gadgets, Why Should You Care?
Inside a Google Gadget
Building a Gadget in Java
![Page 4: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/4.jpg)
BEA Confidential
Housekeeping
This is a 30 Minute Presentation A lot to cover, will move very fast Will focus more on Gadgets, less on Java web development
No network connectivity in this building Google Gadgets necessarily require internet access for live demos Will show movies of demos instead
![Page 5: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/5.jpg)
BEA Confidential
Agenda
Introduction to iGoogle and Google Gadgets
Google Gadget: Why Should You Care?
Inside a Google Gadget
Building a Gadget in Java
![Page 6: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/6.jpg)
BEA Confidential
Introduction to iGoogle (demo)
![Page 7: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/7.jpg)
BEA Confidential
iGoogle
iGoogle portal is a free Google service
Is a customizable web portal
Users can add “Gadgets” to the page
Customizations are saved to the user’s account and retrieved when logging in again
![Page 8: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/8.jpg)
BEA Confidential
Google Gadgets
Gadgets are small user interface components Could also be called portlets or widgets
Example: eBay Search Plus Gadget
![Page 9: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/9.jpg)
BEA Confidential
Gadgets are Dynamic Web Applications
Gadgets can be static, but then are of limited use
Dynamic Gadgets are more common
Three general approaches when making a dynamic gadget: Time dynamic – the content changes over time, e.g. a news gadget User input dynamic – the content changes via a user interacting with the
gadget (forms, links, etc) User preference dynamic – the user sets preferences that persist
across user sessions (eBay example)
![Page 10: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/10.jpg)
BEA Confidential
Gadgets are Dynamic Web Applications
Gadgets support user preferences for dynamic behavior
![Page 11: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/11.jpg)
BEA Confidential
Gadgets live on a web page
Gadgets need not include a page header/footer, they focus on the specific application they surface
iGoogle provides services to the Gadgets Page layout Preferences Minimize capability
Gadgets can also live on pages other than iGoogle Called Google Gadgets For Your Webpage
![Page 12: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/12.jpg)
BEA Confidential
Gadgets are NOT hosted by Google
Google Gadgets can be created by anyone
Gadget must be deployed on a public web server
Once deployed, anyone can use the Gadget
iGoogle supports a Gadget library to help users find Gadgets they may want to use It is optional to submit the Gadget for inclusion in the directory
![Page 13: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/13.jpg)
BEA Confidential
Agenda
Introduction to iGoogle and Google Gadgets
Google Gadgets: Why Should You Care?
Inside a Google Gadget
Building a Gadget in Java
![Page 14: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/14.jpg)
BEA Confidential
Gadgets, Why Should You Care?
Google Gadgets were the fastest growing product offered by Google in 2006 and had strong growth again in 2007 “The star performer for [2007] was Google’s personalized start page
service iGoogle which increased traffic in the 12 months to November by 267.64%.” (TechCrunch)
Useful Gadgets get heavily used “The Google gadget ecosystem received 960 million pageviews last
week” (Niall Kennedy)
Consider how your enterprise can benefit from deploying Google Gadgets A new channel to your customers
![Page 15: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/15.jpg)
BEA Confidential
Agenda
Introduction to iGoogle and Google Gadgets
Google Gadget: Why Should You Care?
Inside a Google Gadget
Building a Gadget in Java
![Page 16: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/16.jpg)
BEA Confidential
Inside Google Gadgets
We have just covered: What is iGoogle What are Google Gadgets Features of Google Gadgets Popularity of Google Gadgets
Now we will get technical Technical details of a Google Gadget Implementing a static Hello World Gadget Implementing a dynamic Java Gadget
![Page 17: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/17.jpg)
BEA Confidential
Two Types of Google Gadgets
URL Implementation is hosted on the web and is addressed via a URL Content is usually dynamic
HTML Implementation is contained wholly within the gadget descriptor Content is static, though may have JavaScript
We will focus on URL gadgets
![Page 18: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/18.jpg)
BEA Confidential
Google Gadget Descriptor
XML file that describes the attributes of the Gadget
For URL Gadget, identifies the Gadget implementation URL URL can be any web page URL should return HTML that can render in a small area
Descriptor also provides metadata about the Gadget
Must exist somewhere on a public web server on the internet
![Page 19: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/19.jpg)
BEA Confidential
Google Gadget Descriptor
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs
title="Simplest Gadget"
directory_title="Simplest Gadget"
title_url="http://wlp.bea.com"
description="Very very simple gadget."
height="120"
author="Peter Laird"
/>
<Content href="http://wlp.bea.com/blogs/simplest.html"
type="url" />
</Module>
![Page 20: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/20.jpg)
BEA Confidential
Add a Custom Google Gadget to iGoogle
Click on “Add Stuff”
Click on “Add gadget”
Enter the URL to the Gadget Descriptor
Done!
You have created your first Google Gadget
![Page 21: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/21.jpg)
BEA Confidential
Adding Preferences to your Gadget
Google provides preference support to allow users to customize your Gadget
Preference editing user interface provided by Google
User’s preferences passed by Google to your Gadget via request parameters
Assume your gadget has a “color” preference: http://myhost/mywebapp/gadgetimpl.jsp?up_color=blue
![Page 22: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/22.jpg)
BEA Confidential
Adding Preferences to your Gadget
<UserPref name="color"
datatype="enum"
default_value="blue"
display_name="Background Color"
>
<EnumValue value="blue" display_value="blue" />
<EnumValue value="green" display_value="green" />
<EnumValue value="orange" display_value="orange” />
<EnumValue value="yellow" display_value="yellow" />
</UserPref>
![Page 23: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/23.jpg)
BEA Confidential
Agenda
Introduction to iGoogle and Google Gadgets
Google Gadget: Why Should You Care?
Inside a Google Gadget
Building a Gadget in Java
![Page 24: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/24.jpg)
BEA Confidential
Google Gadgets are Web Pages
Google Gadgets are implemented behind public URLs
Any public server that speaks HTTP and returns HTML can be a Gadget host Apache web server PHP Ruby on Rails ASP .NET Java Application Servers (Servlet Containers)
![Page 25: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/25.jpg)
BEA Confidential
Java Servlets
Apache Tomcat, BEA WebLogic Server, and many others
Each provides an implementation of an HttpServlet Container
HttpServlets are Java classes that emit dynamic markup (usually HTML) over HTTP
Servlets can therefore be used to implement Google Gadgets
A programmer can implement a Servlet directly
![Page 26: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/26.jpg)
BEA Confidential
Related Java Servlet Technologies
Programming a Servlet can be tedious
Higher level rendering technologies are built on Servlets
They make this easier Java Server Pages (JSP) Velocity Templates Java Server Faces (JSF)
We will use JSP Intermixes dynamic capabilities into HTML files
![Page 27: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/27.jpg)
BEA Confidential
Helloworld.jsp<%@ page import="java.util.*" %>
<html>
<body>
<h1>Hello World JSP</h1>
<%
// Java code here
String color = “Red”;
%>
<p>My color: <%= color %> </p>
</body>
</html>
![Page 28: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/28.jpg)
BEA Confidential
Hello World Gadget
<Module>
<ModulePrefs title=“Hello World" />
<Content href=“http://host/helloworld.jsp” type="url" />
</Module>
![Page 29: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/29.jpg)
BEA Confidential
Helloworld.jsp using a preference<%@ page import="java.util.*" %>
<html>
<body>
<h1>Hello World JSP</h1>
<%
// Pick up the Google Gadget preference
String color = request.getParameter(“up_color”);
%>
<p>My color: <%= color %> </p>
</body>
</html>
![Page 30: Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems](https://reader035.vdocuments.net/reader035/viewer/2022062422/56649ee15503460f94bf261e/html5/thumbnails/30.jpg)
BEA Confidential
Conclusion
Google Gadgets are popular
Gadgets are easy to implement
Gadgets can be placed on any page
Pick your favorite web technology
Java Servlet technology is a quick way to build dynamic Gadgets in Java