Your SlideShare is downloading. ×
Building Dynamic Google Gadgets in Java
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Building Dynamic Google Gadgets in Java

2,786
views

Published on


0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,786
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
17
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems
  • 2. 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
  • 3. Agenda
    • Introduction to iGoogle and Google Gadgets
    • Google Gadgets, Why Should You Care?
    • Inside a Google Gadget
    • Building a Gadget in Java
  • 4. 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
  • 5. Agenda
    • Introduction to iGoogle and Google Gadgets
    • Google Gadget: Why Should You Care?
    • Inside a Google Gadget
    • Building a Gadget in Java
  • 6. Introduction to iGoogle (demo)
    • DEMO
  • 7. 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
  • 8. Google Gadgets
    • Gadgets are small user interface components
      • Could also be called portlets or widgets
    • Example: eBay Search Plus Gadget
  • 9. 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)
  • 10. Gadgets are Dynamic Web Applications
    • Gadgets support user preferences for dynamic behavior
  • 11. 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
  • 12. 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
  • 13. Agenda
    • Introduction to iGoogle and Google Gadgets
    • Google Gadgets: Why Should You Care?
    • Inside a Google Gadget
    • Building a Gadget in Java
  • 14. 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
  • 15. Agenda
    • Introduction to iGoogle and Google Gadgets
    • Google Gadget: Why Should You Care?
    • Inside a Google Gadget
    • Building a Gadget in Java
  • 16. 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
  • 17. 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)
    • Important: Your server must be exposed to the internet!
  • 18. 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
  • 19. Google Gadget Descriptor
    • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>
    • <Module>
    • <ModulePrefs
    • title=&quot;Simplest Gadget&quot;
    • directory_title=&quot;Simplest Gadget&quot;
    • title_url=&quot;http://wlp.bea.com&quot;
    • description=&quot;Very very simple gadget.&quot;
    • height=&quot;120&quot;
    • author=&quot;Peter Laird&quot;
    • />
    • <Content href=&quot; http://wlp.bea.com/blogs/simplest.html &quot;
    • type=&quot;url&quot; />
    • </Module>
  • 20. 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
    • DEMO2
  • 21. Agenda
    • Introduction to iGoogle and Google Gadgets
    • Google Gadget: Why Should You Care?
    • Inside a Google Gadget
    • Building a Gadget in Java
  • 22. 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
  • 23. 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
  • 24. Helloworld.jsp
    • <%@ page import=&quot;java.util.*&quot; %>
    • <html>
    • <body>
    • <h1>Hello World JSP</h1>
    • <%
    • // Java code here
    • String color = “Red”;
    • %>
    • <p>My color: <%= color %> </p>
    • </body>
    • </html>
  • 25. Hello World Gadget
    • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>
    • <Module>
    • <ModulePrefs title=“ Hello World &quot; />
    • <Content href=“ http://host/ helloworld.jsp ” type=&quot;url&quot; />
    • </Module>
    • DEMO5
  • 26. Helloworld.jsp using a preference
    • <%@ page import=&quot;java.util.*&quot; %>
    • <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>
  • 27. Hello World Gadget with Pref
    • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>
    • <Module>
    • <ModulePrefs title=“ Hello World &quot; />
    • < UserPref name=&quot;color&quot;
    • datatype=&quot;enum&quot;
    • default_value=&quot; blue &quot;
    • display_name=&quot;Background Color&quot; >
    • <EnumValue value=&quot; blue &quot; display_value=&quot;blue&quot; />
    • <EnumValue value=&quot; green &quot; display_value=&quot;green&quot; />
    • <EnumValue value=&quot; orange &quot; display_value=&quot;orange&quot; />
    • <EnumValue value=&quot; yellow &quot; display_value=&quot;yellow&quot; />
    • </UserPref>
    • <Content href=“ http://host/ helloworld.jsp ” type=&quot;url&quot; />
    • </Module>
  • 28. 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