Portlets, Tools, AJAX, and more...
GregZ Weblog
Archives
« February 2007 »
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
16
17
18
19
20
21
23
24
25
26
27
28
   
       
Today
XML
Search

Links
 

Today's Page Hits: 4

All | Everything
« Previous month (Dec 2006) | Main | Next month (Feb 2007) »
20070222 Thursday February 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)

posted by gregz Feb 22 2007, 02:02:55 PM MST Permalink Comments [9]

20070215 Thursday February 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.

posted by gregz Feb 15 2007, 01:16:10 PM MST Permalink Comments [0]