Thursday May 31, 2007

OpenPortal source

As promised in a previous entry, the source for the next release (7.2) of OpenPortal is now being hosted from the portal.dev.java.net project.  Development is actively underway.  Specifically, I am working on improvements to the AJAX portal container used in our samples.  There is more information on the glassfish wiki on building and installing (and release notes on Build 3).  Scheduling for milestone builds is still being determined.

Saturday May 12, 2007

JavaOne Wrap-up

Wanted to post a quick wrap-up of my take-aways from JavaOne 2007.  We had a good turnout for the "Dynamic Portals" BOF and had some good discussion.  I was able to attend a number of good sessions, here are my favorites.  Eventually, the sessions will be downloadable, so if you missed them or weren't able to attend, you can check them out online.

  • TS-9516: Using jMaki in a Visual Development Environment (Craig McClanahan; Gregory Murray; Ludovic Champenois) - This was a good overview of jMaki and how it can be used easily to add ajax widgets to your web apps.  I didn't learn a lot new because I've been using jMaki for a while now, but it was good to meet Greg and see the presentation.  They were kind enough to plug the "Dynamic Portals" BOF...thanks!
  • TS-6410: Hands-on DWR (Geert Bevin; Joe Walker) - I had wanted to learn more about how to use DWR.  They gave a fun demo building a web app that played battleship in the browser.  DWR lets you remotely interact with your server-side java from javascript.  Something to consider regarding portals, maybe using DWR in the portlet container to enable seamless JS access to portlets.
  • TS-6029: Beyond Blogging: Feeds in Action (Dave Johnson) - Dave wrote the Roller blogging server and recently joined Sun.  I'm reading Dave's book, so mostly this was good for me because it was like a quick training session on the topics covered in his book.
  • TS-6836: Creating Amazing Web Interfaces with Ajax (Ben Galbraith; Dion Almaer) - These guys are apparent "rock stars".  This session was jammed, even thought it was in the afternoon on the last day.  You can read this JavaOne feature on them.  They even played Guitar Hero on stage.  Nice! :)  Actually, they were definitely probably the best speakers I saw.  Lots of good ajax information:
    • SoundManager2 - Add sound to your ajax web apps.  It uses the flash player and javascript to play.  Read about it at Ajaxian.  Also, a sound widget has been included in jMaki that uses SoundManager2.  Could be applied to dynamic portals for portlet window changes (min/max could have a "window shade" sound) and portlet addition ("pop") and removal ("zip").
    • sIFR - Allows fancy typography (beyond the limits of browser fonts) that is inline and selectable without having to create static images (that are not crawled by search-bots).  Again, it leverages flash to do it's magic.  No real specific portal implications, but cool none-the-less.
    • Canvas - I have never looked closely at Yahoo Pipes.  I assumed it was implemented with flash.  It's not.  It uses <canvas>. Canvas is an HTML extension available from Firefox 1.5+ (originally introduced by Apple for Dashboard) that can be used with scripting on the browser to build and draw compelling graphics.  It is not implemented for IE (I didn't know Yahoo Pipes was not supported on IE), but Google has built a project that uses VML to implement canvas on IE.
    • New Dojo stuff - Dojo is developing a fully-featured offline toolkit for taking ajax offline.  And new declarative data binding.  They demoed binding a data service to a dojo table, quick and easy.
    • Ext JS - And they touted Ext JS which leverage Yahoo UI library for slick widgets, specifically mentioned were drag-and-drop and data binding.
  • TS-6807: Real-World Comet-Based Applications (Jean-Fran├žois Arcand; Alex Russell; Greg Wilkin) - Another good group of presenters.  Was particularly interested to hear Alex talk since he runs Dojo and Comet was another one of those technologies I've been intending to learn more about.  They covered Bayeux, which is the early implementation of a proposed common API for comet.  An API that would make comet pluggable into your app.  Problems still persist with server support for comet, though.  To be specific, ideally comet would be implemented with a server-side that supported asynchronous servlets to handle comet requests, but we have to wait for that to be put into the servlet spec.  Until then, you can use Continuations (available in Jetty 6) or Java NIO API in Grizzly (with Glassfish).  But this limits the servers where you can deploy comet applications.  The specs need to catch up with the technology here.

Wednesday May 09, 2007

JavaScript Namespacing in Portlets

One of the topics that has come up a couple times while here at JavaOne is JavaScript namespacing.  There was a JavaScript "Best Practices" BOF last night where it was discussed and during our "Dynamic Portals" BOF it was again discussed.  In particular, the problem is that if you have multiple portlets on the same page trying to load the same JavaScript namespace (for a particular JS library, for instance dojo.\*) there will be a conflict because the namespace may already be taken (by a portlet that has already loaded it).  The polite way to handle this in your portlets is to check first to see if the namespace for your library is already defined.  If so, use it.  If not, then dynamically load the library.

Namespacing in JavaScript is simply achieved by specifying a named object and defining all your functions relative to that object.  In the case of DOJO, the object is dojo.  As you see in the below code sample from the AJAX Portlet, you simple check for the existence of the dojo object.  If it does not exist, we define a <script> element with the reference to the DOJO library and insert it dynamically into the DOM.  The AJAX Portlet war is here and the source is here.
<div id="<portlet:namespace/>_scripts">
<script type="text/javascript">

/\* Load Dojo library, if it hasn't already \*/
if (typeof dojo == "undefined") {
/\* build script tag \*/
var script = document.createElement("script");
script.src = "<%=renderResponse.encodeURL(renderRequest.getContextPath() %>" + "/js/dojo.js";
script.type= "text/javascript";
/\* dynamically insert with other scripts \*/
var <portlet:namespace/>_scripts = document.getElementById("<portlet:namespace/>_scripts");
<portlet:namespace/>_scripts.appendChild(script);
}
</script>
</div>

JavaOne BOF: "Dynamic Portals and AJAX in Portlets"

Thanks goes out to all that were able to attend last night's JavaOne BOF, "Dynamic Portals and Ajax in Portlets".  There was lots of good open discussion about the challenges and successes of implementing new dynamic portals with AJAX.  The slides are available here.  Below is a list of resources URLs for some of the topics we discussed.  Check back here for new developments regarding AJAX in portals and portlets.

Wednesday May 02, 2007

Announcing OpenPortal

We in the portal java.net community have released the source code (under CDDL) for Portal Server 7.1.  As I've mentioned before, the Portal Server binaries are available with the Java ES downloads here, and now the source code is available too.  As development is completed on our upcoming releases, all the code will go into a repository here...stay tuned for that.

Tuesday May 01, 2007

JavaOne BOF: "Dynamic Portals and AJAX in Portlets"

JavaOne 2007 is only a week away.  This year, I will be presenting the Birds Of a Feather (BOF) talk "Dynamic Portals and AJAX in Portlets". If you are interested in learning more and want to meet others with similar interests, please consider attending. We will be discussing:
  • the impact of Web 2.0 technologies on portals
  • AJAX and JSR-168
  • jMaki
  • JSR-286
  • dynamic inter-portlet communication
  • microformats, COMET, mashups, and more...
Hope to see you there.

Thursday Apr 19, 2007

jMaki Map Widgets in Portlets

So you are thinking of using one of the jMaki map widgets in your portlets.  A couple of things to keep in mind:
  1. The map div may not display the way that you would like inside the portlet.  It appeared squooshed when I tried it.  But if you add another div like so, you'll get better results.

    <div style="width:100%;height:400px">
        <a:widget  name="yahoo.map"
                args="{ centerLat : 37.4041960114344,
                centerLon : -122.008194923401 }" />
    </div>
    <hr/>
    <a:widget name="yahoo.geocoder" />


    The width:100% tells the map to take up the entire width of the portlet, and the height:400px tells it to be fixed at 400 pixels high.

  2. If you use the Yahoo Geocoder widget, you will need to use the allowXDomain context parameter as I mentioned in my previous entry.
  3. Google Maps requires an API key specific to the domain that will host the portlet.  This can get hairy because of some peculiarities with jMaki and portlets.  The API key must be specified in the widget.json file for the Google Map widget (see resources/google/map).  The url in widget.json should be specified as http://host:port/context-root because jMaki will be looking up the key based on the portlet app context root.  However, the site url you specify to Google should read http://host:port/portletdriver because the map content will be served up by the portlet container.
In the end, it's probably easier to just use the Yahoo map.  You can use the Yahoo geocoder with the Google Map, but the shared API keys are already in place for the Yahoo widgets, so you don't have to do any of the key registration when you use the Yahoo map.

Thursday Feb 22, 2007

jMaki in portlets


The latest version of jMaki 1.0 beta (v.8.3.1) fixes a problem that was preventing jMaki widgets from working in portlets.  jMaki is a powerful, lightweight AJAX web application framework.  jMaki wraps other UI libraries providing an extensive library of widgets from Dojo, Flickr, Google, Mochikit, Scriptaculous, Spry, and Yahoo.  Now you can use all these widgets in your portlet applications.

I would highly recommend using the jMaki Netbeans plugin (1.6.9+), paired with the Portal Pack plugin.  You can watch Greg and Ludo's screencast.  And use the following different steps to get it working with your portlet application:
  1. Create a new portlet application project.
  2. Open project properties (right-click on project, Properties)
  3. Choose Frameworks, Add, jMaki Ajax Framework (CSS Layout does not apply here as the view.jsp for the portlet will not use it.)
  4. While in properties, check that the Run (under categories) lists Open Source Portlet Container as the server.
  5. Open Web Pages->WEB-INF->jsp->view.jsp
  6. Now you can drag-n-drop jMaki widgets and use the properties editor just like you saw in the screencast.
  7. Build, deploy, and test.  Repeat. (The portlet container will require the portlet application be redeployed, unlike web app in the screencast.)
There is one limitation.  jMaki widgets that use the XmlHttpProxy (service bundled with the framework) need to be specially configured to work within a portlet.  These widgets include flickr.search, google.mappopup, yahoo.geocoder, and any other custom widgets that use the XmlHttpProxy.   Due to a limitation in the portlet spec (JSR-168), the session-based restriction to the XmlHttpProxy fails.  This will present itself only by the Ajax request failing and the portlet showing no response.  (Firebug users will see the HTTP 403 error "Access to the specified resource () has been forbidden." in the Ajax response.)

In order to work around this, you will need to set the allowXDomain requireSession context parameter in the web.xml for the portlet application.
<context-param>
  <param-name>requireSession</param-name>
  <param-value>false</param-value>
</context-param>
However, it is important that you understand the security implications of allowing unrestricted access to these services.  This means that you are opening up the defined XmlHttpProxy services to any other applications that know the appropriate URL for your portlet application.  Please read Greg Murray's blog on Restricting Access to your Ajax Services.

The jMaki widgets may seem like so many bells and whistles (Sudoku portlet anyone :) ), but Patrice Goutin shows how to use the Dojo table widget for easily creating the UI for a SAP name search portlet.

Update (20070508): Notice the change to the requireSession context parameter.  This is effective from jMaki 0.9.2 (bundled with Netbeans module 1.6.9.6)

Thursday Feb 15, 2007

Debugging Portlets in Netbeans

Satya has put together a how-to on using the debugger in Netbeans with the portlet container for debugging portlets.  Check it out here.

Wednesday Jan 24, 2007

Making the switch to Netbeans

Up until recently, I was still using vi and Pluto to do my portlet development.  Others had recommended switching and I needed to work with the portlet repository at java.net and I realized it was time to make the switch.  The release of the new Java Application Platform SDK really helped.  Here is what I did.

  1. Download Java Application Platform SDK Update 2 with Tools
  2. Run the installer
    • Netbeans is installed with Glassfish (officially named Sun Java System Application Server Platform Edition 9.0) and the new portlet container already deployed.
  3. Install Maven plugin
    • The portlet repository uses maven for building. This plugin integrates maven into Netbeans to make it easy.
  4. Install Portal Pack plugin
    • This plugin allows you to deploy directly to the portlet container from Netbeans.
    • Start Glassfish (Runtime tab ->Servers->(right-click) Start
    • Follow these configuration steps in Netbeans.  However, the steps are backwards.  First configure the Glassfish instance, then the portlet container.
  5. Download portlet repository source in Netbeans
  6. Open the project
    • Netbeans will prompt after the cvs checkout and ask if you want to open the project.  Select portlet-repository.
  7. Build the project
    • In Netbeans, Build->Build Main Project
    • Maven downloads all the dependency libraries automatically
    • Look for the BUILD SUCCESSFUL message in the Output window
    • To see the individual portlet projects, right-click on the portlet repository project and choose Open Required Projects
    • Projects List
  8. Deploy
  9. View

Honestly.  It's that simple.  Then from there you can use the steps to create a new portlet application and build and test your own portlets in Netbeans.

AJAX Portlet at java.net

This is something I've been meaning to do for a long time.  The source for the sample from my paper on AJAX and portlets is now in the portlet repository at java.net. This portlet is instructional and shows how AJAX (using DOJO) can be used with a JSR-168 portlet.

Monday Jan 22, 2007

Sun Open Source Registry

If you're like me, you can find it hard to keep track of all the open source projects Sun is involved in.  I was glad to find this new page at sun.com that lists a pretty comprehensive registrySome interesting entriesAnd some omissions.  But overall a good resource.

Tuesday Nov 21, 2006

Portlet logging

If you are wondering where your calls to PortletContext.log() are landing while using Sun Portal Server, check out Deepak's entry on the topic.

Monday Nov 13, 2006

Java goes GPL

OpenJDKI honestly have not been paying much attention to the progress of the open-sourcing of Java since Sun announced their intentions do it a while back.  But I have to admit being pretty surprised to hear they chose the GPL.  This is a significant boost to the Free Software Foundation and other GPL software, most notably Linux.  Lots of big implications of taking such a sizable code-base open.  The most successful programming platform available today.  On a more practical note, I have recently switched to Ubuntu on my desktop and will be glad to see a real, working JRE bundled with their distribution.

My other question/observation is how this impacts the JCP.  I guess that infrastructure for guiding Java will be fully leveraged with the "new" open-source Java.  But will JCP play with the GPL community (and vice versa)?

You can read more at here at Slashdot or Sun (check the thorough FAQ).

Tuesday Sep 05, 2006

Best Practices for AJAX and JSR 168 Portlets

The new technical article "Best Practices for AJAX and JSR 168 Portlets" has just been published at developer.sun.com.  Check out this article for the latest ideas on how to best implement AJAX with JSR 168 portlets, and how to use JavaScript libraries like Dojo to add dynamic content to your portlets.
About

gregz

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today