You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2009/04/19 22:32:32 UTC

svn commit: r766512 - in /incubator/openwebbeans/trunk/webbeans-jsf: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/webbeans/ src/main/java/org/apache/webbeans/jsf/ src/main/java/org/apache/webbea...

Author: struberg
Date: Sun Apr 19 20:32:31 2009
New Revision: 766512

URL: http://svn.apache.org/viewvc?rev=766512&view=rev
Log:
OWB-88 move JSF specific code into an own plugin

Added:
    incubator/openwebbeans/trunk/webbeans-jsf/
    incubator/openwebbeans/trunk/webbeans-jsf/pom.xml
    incubator/openwebbeans/trunk/webbeans-jsf/src/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansJSFFilter.java
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/conversation/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/conversation/jsf/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/conversation/jsf/JSFConversationServiceImpl.java
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/util/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/util/JSFUtil.java
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/services/
    incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.plugins.OpenWebBeansPlugin

Added: incubator/openwebbeans/trunk/webbeans-jsf/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jsf/pom.xml?rev=766512&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jsf/pom.xml (added)
+++ incubator/openwebbeans/trunk/webbeans-jsf/pom.xml Sun Apr 19 20:32:31 2009
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.openwebbeans</groupId>
+		<artifactId>openwebbeans</artifactId>
+		<version>1.0.0-incubating-SNAPSHOT</version>
+	</parent>
+    
+	<artifactId>openwebbeans-jsf</artifactId>
+	<name>OpenWebBeans :: JSF integration</name>
+	<packaging>jar</packaging>
+	<version>1.0.0-incubating-SNAPSHOT</version>
+	<description>JSF integration for the  OpenWebBeans Implementation</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.openwebbeans</groupId>
+            <artifactId>openwebbeans-impl</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-el_1.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+      
+    </dependencies>
+</project>

Added: incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansJSFFilter.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansJSFFilter.java?rev=766512&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansJSFFilter.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansJSFFilter.java Sun Apr 19 20:32:31 2009
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.webbeans.jsf;
+
+import java.io.IOException;
+
+import javax.context.Conversation;
+import javax.inject.manager.Bean;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+import org.apache.webbeans.annotation.CurrentLiteral;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.util.JSFUtil;
+
+public class WebBeansJSFFilter implements Filter
+{
+
+    public void destroy()
+    {
+
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
+    {
+        HttpServletResponse servletResponse = (HttpServletResponse) response;
+        HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper(servletResponse)
+        {
+
+            /*
+             * (non-Javadoc)
+             * @see
+             * javax.servlet.http.HttpServletResponseWrapper#sendRedirect(java
+             * .lang.String)
+             */
+            @Override
+            public void sendRedirect(String location) throws IOException
+            {
+                Bean<Conversation> bean = ManagerImpl.getManager().resolveByType(Conversation.class, new CurrentLiteral()).iterator().next();
+                Conversation conversation = ManagerImpl.getManager().getInstance(bean);
+
+                String path = location;
+
+                if (conversation != null)
+                {
+
+                    if (conversation.isLongRunning())
+                    {
+                        // Find JSFish view od of the redirection
+                        path = JSFUtil.getRedirectViewId(location);
+                        path = JSFUtil.getViewHandler().getActionURL(JSFUtil.getCurrentFacesContext(), path);
+                        path = JSFUtil.getExternalContext().encodeActionURL(path + "?cid=" + conversation.getId());
+                    }
+                }
+
+                super.sendRedirect(path);
+
+            }
+
+        };
+
+        chain.doFilter(request, responseWrapper);
+    }
+
+    public void init(FilterConfig config) throws ServletException
+    {
+
+    }
+
+}

Added: incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java?rev=766512&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java Sun Apr 19 20:32:31 2009
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.webbeans.jsf;
+
+import javax.context.ConversationScoped;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlInputHidden;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.conversation.ConversationImpl;
+import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.logger.WebBeansLogger;
+import org.apache.webbeans.util.JSFUtil;
+
+public class WebBeansPhaseListener implements PhaseListener
+{
+    private static final long serialVersionUID = -8131516076829979596L;
+
+    private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansPhaseListener.class);
+
+    private static ConversationManager conversationManager = ConversationManager.getInstance();
+
+    private ConversationImpl conversation = null;
+
+    public void afterPhase(PhaseEvent phaseEvent)
+    {
+        if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW))
+        {
+            if (!JSFUtil.isPostBack())
+            {
+                String cid = JSFUtil.getExternalContext().getRequestParameterMap().get("cid");
+
+                // non-faces get request
+                if (cid == null)
+                {
+                    logger.info("Create new transitional conversation for non-faces request with view id : " + JSFUtil.getViewId());
+                    conversation = (ConversationImpl) conversationManager.createNewConversation();
+
+                    ContextFactory.initConversationContext(null);
+
+                }
+                else
+                {
+                    logger.info("Propogation of the conversation with id : " + cid + " for view : " + JSFUtil.getViewId());
+                    conversation = (ConversationImpl) conversationManager.getConversation(cid);
+
+                    // can not restore conversation, create new transitional
+                    if (conversation == null)
+                    {
+                        logger.info("Propogated conversation can not be restored for view id : " + JSFUtil.getViewId() + ". Creates new transitional conversation");
+                        conversation = (ConversationImpl) conversationManager.createNewConversation();
+
+                        ContextFactory.initConversationContext(null);
+                    }
+                    else
+                    {
+                        ContextFactory.initConversationContext(conversationManager.getConversationContext(conversation));
+                    }
+                }
+            }
+            else
+            {
+                logger.info("Postback JSF Request for view id : " + JSFUtil.getViewId());
+
+                UIViewRoot viewRoot = JSFUtil.getViewRoot();
+                HtmlInputHidden conversationId = (HtmlInputHidden) viewRoot.findComponent("javax_webbeans_ConversationId");
+
+                if (conversationId != null)
+                {
+                    // look long running conversation if exist
+                    conversation = (ConversationImpl) conversationManager.getConversation(conversationId.getValue().toString());
+                    ContextFactory.initConversationContext(conversationManager.getConversationContext(conversation));
+
+                }
+
+                // no long running conversation, create one transitional
+                else
+                {
+                    logger.info("Create new transient conversation for JSF postback view id : " + JSFUtil.getViewId());
+                    conversation = (ConversationImpl) conversationManager.createNewConversation();
+
+                    ContextFactory.initConversationContext(null);
+                }
+            }
+        }
+
+        else if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+        {
+            ConversationContext context = (ConversationContext) ManagerImpl.getManager().getContext(ConversationScoped.class);
+
+            // if long running, saves it
+            if (conversation.isLongRunning())
+            {
+                logger.info("Conversation with id : " + conversation.getId() + " is marked as long running conversation");
+                context.setActive(false);
+            }
+
+            // else destroy conversation context
+            else
+            {
+                logger.info("Destroying the conversation context for view id : " + JSFUtil.getViewId());
+                context.destroy();                                    
+            }
+
+        }
+
+    }
+
+    public void beforePhase(PhaseEvent phaseEvent)
+    {
+        if (phaseEvent.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES))
+        {
+            ConversationContext context = (ConversationContext) ManagerImpl.getManager().getContext(ConversationScoped.class);
+
+            if (JSFUtil.isPostBack())
+            {
+                logger.info("Activating the conversation context for view id : " + JSFUtil.getViewId());
+                context.setActive(true);
+
+                conversation.updateTimeOut();
+            }
+        }
+
+        else if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+        {
+            ConversationContext context = (ConversationContext) ManagerImpl.getManager().getContext(ConversationScoped.class);
+
+            if (!JSFUtil.isPostBack())
+            {
+                logger.info("Activating the conversation context for view id : " + JSFUtil.getViewId());
+                context.setActive(true);
+
+                conversation.updateTimeOut();
+            }
+
+            if (conversation.isLongRunning())
+            {
+                UIViewRoot viewRoot = JSFUtil.getViewRoot();
+
+                HtmlInputHidden hidden = (HtmlInputHidden) viewRoot.findComponent("javax_webbeans_ConversationId");
+
+                if (hidden != null)
+                {
+                    viewRoot.getChildren().remove(hidden);
+                }
+
+                hidden = (HtmlInputHidden) JSFUtil.getApplication().createComponent(HtmlInputHidden.COMPONENT_TYPE);
+                hidden.setValue(conversation.getId());
+                hidden.setId("javax_webbeans_ConversationId");
+
+                viewRoot.getChildren().add(hidden);
+            }
+            else
+            {
+                //Remove the hidden component
+                UIViewRoot viewRoot = JSFUtil.getViewRoot();
+
+                HtmlInputHidden hidden = (HtmlInputHidden) viewRoot.findComponent("javax_webbeans_ConversationId");
+
+                if (hidden != null)
+                {
+                    viewRoot.getChildren().remove(hidden);
+                }
+                
+            }
+        }
+
+    }
+
+    public PhaseId getPhaseId()
+    {
+        return PhaseId.ANY_PHASE;
+    }
+
+}

Added: incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java?rev=766512&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java Sun Apr 19 20:32:31 2009
@@ -0,0 +1,55 @@
+package org.apache.webbeans.jsf.plugin;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.faces.component.UIComponent;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.plugins.OpenWebBeansPlugin;
+import org.apache.webbeans.util.ClassUtil;
+
+public class OpenWebBeansJsfPlugin implements OpenWebBeansPlugin 
+{
+
+    /** {@inheritDoc} */
+    public void startUp() throws WebBeansConfigurationException 
+    {
+        // nothing to do 
+    }
+
+    /** {@inheritDoc} */
+    public void shutDown() throws WebBeansConfigurationException 
+    {
+        // nothing to do
+    }
+
+    /** {@inheritDoc} */
+    public void isSimpleBeanClass( Class<?> clazz ) throws WebBeansConfigurationException 
+    {
+        if (ClassUtil.isAssignable(UIComponent.class, clazz))
+        {
+            throw new WebBeansConfigurationException("Web Beans component implementation class : " + clazz.getName() 
+                                                     + " can not implement JSF UIComponent");
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void checkForValidResources(Type type, Class<?> clazz, String name, Annotation[] annotations)
+    {
+        // nothing to do
+    }
+
+    /** {@inheritDoc} */
+    public Object injectResource(Type type, Annotation[] annotations)
+    {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public boolean isResourceAnnotation(Class<? extends Annotation> annotationClass)
+    {
+        return false;
+    }
+
+}

Added: incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/conversation/jsf/JSFConversationServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/conversation/jsf/JSFConversationServiceImpl.java?rev=766512&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/conversation/jsf/JSFConversationServiceImpl.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/spi/conversation/jsf/JSFConversationServiceImpl.java Sun Apr 19 20:32:31 2009
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.spi.conversation.jsf;
+
+import org.apache.webbeans.spi.conversation.ConversationService;
+import org.apache.webbeans.util.JSFUtil;
+
+public class JSFConversationServiceImpl implements ConversationService
+{
+
+    public String getConversationId()
+    {
+        return JSFUtil.getConversationId();
+    }
+
+    public String getConversationSessionId()
+    {
+        return JSFUtil.getSession().getId();
+    }
+
+}

Added: incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/util/JSFUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/util/JSFUtil.java?rev=766512&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/util/JSFUtil.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/util/JSFUtil.java Sun Apr 19 20:32:31 2009
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.webbeans.util;
+
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlInputHidden;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+public final class JSFUtil
+{
+    private JSFUtil()
+    {
+
+    }
+
+    public static FacesContext getCurrentFacesContext()
+    {
+        return FacesContext.getCurrentInstance();
+    }
+
+    public static ExternalContext getExternalContext()
+    {
+        return getCurrentFacesContext().getExternalContext();
+    }
+
+    public static HttpSession getSession()
+    {
+        return (HttpSession) getExternalContext().getSession(true);
+    }
+
+    public static boolean isPostBack()
+    {
+        return getCurrentFacesContext().getRenderKit().getResponseStateManager().isPostback(getCurrentFacesContext());
+    }
+
+    public static String getViewId()
+    {
+        return getCurrentFacesContext().getViewRoot().getViewId();
+    }
+
+    public static ViewHandler getViewHandler()
+    {
+        return getCurrentFacesContext().getApplication().getViewHandler();
+    }
+
+    public static Application getApplication()
+    {
+        return getCurrentFacesContext().getApplication();
+    }
+    
+    public static void addInfoMessage(String message)
+    {
+        FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_INFO,message,"");
+        getCurrentFacesContext().addMessage(null, fm);
+    }
+
+    public static String getRedirectViewId(String redirectId)
+    {
+        Asserts.assertNotNull(redirectId, "redirectId parameter can not be null");
+        String path = getExternalContext().getRequestContextPath();
+
+        int index = redirectId.indexOf(path);
+
+        return redirectId.substring(index + path.length(), redirectId.length());
+    }
+
+    public static UIViewRoot getViewRoot()
+    {
+        return getCurrentFacesContext().getViewRoot();
+    }
+
+    public static String getConversationId()
+    {
+        UIViewRoot viewRoot = JSFUtil.getViewRoot();
+        HtmlInputHidden conversationId = (HtmlInputHidden) viewRoot.findComponent("javax_webbeans_ConversationId");
+
+        if (conversationId != null)
+        {
+            return conversationId.getValue().toString();
+        }
+
+        return null;
+    }
+}

Added: incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.plugins.OpenWebBeansPlugin
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.plugins.OpenWebBeansPlugin?rev=766512&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.plugins.OpenWebBeansPlugin (added)
+++ incubator/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.plugins.OpenWebBeansPlugin Sun Apr 19 20:32:31 2009
@@ -0,0 +1,4 @@
+# this file contains the service implementation for the 
+# JSF integration into OpenWebBeans
+# this file contains information for java.util.ServiceLoader
+org.apache.webbeans.jsf.plugin.OpenWebBeansJsfPlugin
\ No newline at end of file