Showing posts with label bridge. Show all posts
Showing posts with label bridge. Show all posts

Monday, July 7, 2008

JSF in a portlet has never been this easy!

We just released JBoss Portlet Bridge Beta3 along with some good supporting documentation and example projects. See the documentation for full details.

The majority of the code written for this release is internal to the portlet bridge project (refactoring, 301 spec updates and enhancements, bug fixes...). The next release (Beta 4 - early Sept) will be huge for the portlet bridge for the following reasons:
  • The EG is currently discussing a lot of significant clarifications and improvements. For example, working with the JSF 2.0 EG to allow certain needs and working on Portlet 2.0 areas of the spec.
  • There is currently a lot of discussion about navigation between portlet modes. Once this is nailed down in the spec, we will implement it.
  • The Portlet 1.0 version should be getting close to public review.
Other than the spec related reasons for release schedule, we must work in unison with the latest Seam and RichFaces relases, make sure that we squash any bugs concerning the 3 integration points, handle features/improvements/refactorings, and try to test and give feedback to the 301 EG. And, of course we can't forget about JBoss Portal 2.7+!

There are soo many cool things going on right now within the JBoss Portal project, I would like to tell you about all of them but then this post wouldn't be about JBPB anymore. Just stay tuned to this blog...

With that said, here are a few tips for JSF portlet developers that concern this release:
  • Namespacing
    In situations where you need to use the id of an element in your JSF/xhtml markup, you would normally see something like 'form1:myBtn' in the rendered markup. But now with the bridge namespacing you will see something similar to:

    jbpns_2fdefault_2fNews_2fStories_2fStoryTemplateWindow12snpbj:_viewRoot:form1:myBtn

    To overcome this, you can use the following expression in your Facelets page to prepend the namespace to your javascript code:

    document.getElementById('#{facesContext.externalContext.response.namespace}the_rest_of_JSF_ID

    since this uses the portletResponse, once you try to view this page on the servlet application side, you will get an exception. To avoid this, you need to check for the type of response in your backing bean and assign a new "safe" namespace variable for the UI.

  • Excluding Attributes from the Bridge Request Scope
    When your application uses request attributes on a per request basis and you do not want that particular attribute to be managed in the extended bridge request scope, you must use the following configuration in your faces-config.xml. Below you will see that any attribute namespaced as foo.bar or any attribute beginning with foo.baz(wildcard) will be excluded from the bridge request scope and only be used per that application's request.

    <application>
    <application-extension>
    <bridge:excluded-attributes>
    <bridge:excluded-attribute>foo.bar</bridge:excluded-attribute>
    <bridge:excluded-attribute>foo.baz.*</bridge:excluded-attribute>
    </bridge:excluded-attributes>
    </application-extension>
    </application>

    Or you can use the javax.portlet.faces.annotation.ExcludeFromManagedRequestScope annotation to accomplish the same thing.
For more information on this release or to find out more about the project, visit the project page.

Thursday, April 10, 2008

JBoss Portlet Bridge Beta2 Released

Supports:
  • JBoss Portal 2.6.4
  • Seam 2.0.2.CR1
  • RichFaces 3.2.0.GA (with exception of upload component)
  • JSF 1.2
This release of the bridge has quite a few bug fixes and enhancements:
  • Portlet EL Variable support
  • New SeamIdentity Bridge Extension: instant SSO between your Seam application and your JBoss Portal server by a simple dependency in your pom
  • RichFaces Maven Archetype
  • Removal of PortalStateManager configuration
  • More documentation

EL Variable Support

portletConfig: object of type javax.portlet.PortletConfig

sessionPortletScope: mutable Map containing PortletSession attribute/values at PORTLET_SCOPE.

sessionApplicationScope: mutable Map containing PortletSession attribute/values at APPLICATION_SCOPE.

portletPreferenceValue: immutable Map containing the set of portlet preferences where the key is the name of the preference and the value is the first portlet preference value from the (potential) set of values.

portletPreferenceValues: immutable Map containing the set portlet preferences where the key is the name of the preference and the values are the set of this portlet preference's values.


SeamIdentity Bridge ExtensionJust add the following dependency to your JBoss Seam (Maven) project for SSO between JBoss Portal and Seam applications.
<dependency>
<groupid>org.jboss.portletbridge.extension.seam</groupid>
<artifactid>PortalIdentity</artifactid>
<version>1.0.0.B2</version>
</dependency>
RichFaces Maven Archetype
This is the new Beta2 release of the RichFaces archetype - only a few settings are different from the previous snapshot release.
mvn archetype:create
-DarchetypeGroupId=org.jboss.portletbridge.archetypes
-DarchetypeArtifactId=richfaces-basic
-DarchetypeVersion=1.0.0.B2
-DgroupId=org.whatever.project
-DartifactId=myprojectname
-DremoteRepositories=http://repository.jboss.org/maven2/

Removal of PortalStateManager configuration
The following is no longer needed in the faces-config.xml
 <state-manager>
org.jboss.portletbridge.application.PortalStateManager
</state-manager>
Visit the Portlet Bridge project page for more details.

Wednesday, March 12, 2008

RichFaces Portlet Archetype

I just finished creating a Maven archetype for the RichFaces portlet using the JBoss Portlet Bridge. An archetype basically gives you a empty project shell with all of the proper config files and package names that are custom to your project. It comes packaged with a simple demo of the RichFaces ajax repeater code.

From the command line run:
mvn archetype:create -DarchetypeGroupId=org.jboss.portletbridge.archetypes -DarchetypeArtifactId=richfaces-basic
-DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=org.whatever.project -DartifactId=myprojectname
-DremoteRepositories=http://snapshots.jboss.org/maven2/
Navigate to the newly created project folder and run mvn install - now you are ready to deploy the war file located in the target directory.

Thursday, February 14, 2008

JBoss Portlet Bridge 1.0.0 Beta Released!

Thanks to the collaboration of the JBoss RichFaces, Seam and Portal teams, we are happy to announce an initial beta release of JBoss Portlet Bridge.
The JBoss Portlet Bridge is an implementation of the JSR-301 specification to support JSF within a portlet and with added enhancements to support other web frameworks. Currently the bridge supports any combination of JSF, Seam, and RichFaces to run inside a portlet.

The following is supported with JBoss Portlet Bridge 1.0.0.B1 Download
  • You can download the portlet bridge binaries here, which contain the required jars along with a deployable EAR file. The EAR is the Seam Booking Demo which uses both RichFaces and Seam.

Deploy

  • copy the ear file from example/seamEar.ear to JBoss_Home/server/default/deploy and start the server.

Test Drive

  • You should see a SeamBooking tab with the official JBoss Seam Booking Demo.
Setup and Configuration
  • Check out the configuration examples here.
Live Demo
  • The Seam Booking and RichFaces component demos can be viewed here.
All information to get up and running with configuration options for any combination of the frameworks mentioned above can be found on the wiki.