myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r491825 - in /myfaces/tomahawk/trunk/sandbox: core/src/main/java/org/apache/myfaces/custom/conversation/ examples/ examples/src/main/java/org/apache/myfaces/examples/conversation/ examples/src/main/webapp/ examples/src/main/webapp/WEB-INF/ ...
Date Tue, 02 Jan 2007 16:07:14 GMT
Author: imario
Date: Tue Jan  2 08:07:13 2007
New Revision: 491825

URL: http://svn.apache.org/viewvc?view=rev&rev=491825
Log:
conversation scope samples using spring

Added:
    myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java
  (with props)
Removed:
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/pageConversation.jsp
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/pageConversationEndAction.jsp
Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/Conversation.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SpringConversationScope.java
    myfaces/tomahawk/trunk/sandbox/examples/pom.xml
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-springConfig.xml
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/home.jsp
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardFinish.jsp
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage1.jsp
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage2.jsp
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage3.jsp

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/Conversation.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/Conversation.java?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/Conversation.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/Conversation.java
Tue Jan  2 08:07:13 2007
@@ -65,6 +65,7 @@
 		{
 			throw new IllegalArgumentException("you cant put a property under conversation control.
name: " + name);
 		}
+
 		if (beans.containsKey(name))
 		{
 			// already there
@@ -120,7 +121,7 @@
 			{
 				getPersistenceManager().rollback();
 			}
-			
+
 			getPersistenceManager().purge();
 		}
 	}

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SpringConversationScope.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SpringConversationScope.java?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SpringConversationScope.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SpringConversationScope.java
Tue Jan  2 08:07:13 2007
@@ -51,6 +51,8 @@
 	 */
 	public Object get(String name, ObjectFactory objectFactory)
 	{
+		name = buildBeanName(name);
+
 		FacesContext facesContext = FacesContext.getCurrentInstance();
 
 		ConversationManager manager = ConversationManager.getInstance(facesContext);
@@ -87,6 +89,26 @@
 
 		// get the bean
 		return conversation.getBean(name);
+	}
+
+	/**
+	 * strip off any spring namespace.
+	 * TODO: Is this valid?
+	 */
+	protected String buildBeanName(String name)
+	{
+		if (name == null)
+		{
+			return null;
+		}
+
+		int pos = name.lastIndexOf('.');
+		if (pos < 0)
+		{
+			return name;
+		}
+
+		return name.substring(pos+1);
 	}
 
 	/**

Modified: myfaces/tomahawk/trunk/sandbox/examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/pom.xml?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/pom.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/pom.xml Tue Jan  2 08:07:13 2007
@@ -214,6 +214,12 @@
             <version>1.0.4</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib</artifactId>
+            <version>2.1</version>
+            <scope>runtime</scope>
+        </dependency>
     </dependencies>
 
     <build>

Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java?view=auto&rev=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java
(added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java
Tue Jan  2 08:07:13 2007
@@ -0,0 +1,30 @@
+package org.apache.myfaces.examples.conversation;
+
+import javax.faces.context.FacesContext;
+import javax.faces.application.FacesMessage;
+
+public class SpringWizardController
+{
+	private WizardData wizardData;
+
+	public WizardData getWizardData()
+	{
+		return wizardData;
+	}
+
+	public void setWizardData(WizardData wizardData)
+	{
+		this.wizardData = wizardData;
+	}
+
+	public String ensureConversationAction()
+	{
+		return "springWizardPage1";
+	}
+
+	public String save()
+	{
+		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("data saved"));
+		return "success";
+	}
+}

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/conversation/SpringWizardController.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml Tue
Jan  2 08:07:13 2007
@@ -569,6 +569,32 @@
 			<to-view-id>/conversation/wizardFinish.jsp</to-view-id>
 			<redirect/>
 		</navigation-case>
+		<navigation-case>
+			<from-action>#{springWizardController.save}</from-action>
+			<from-outcome>success</from-outcome>
+			<to-view-id>/springConversation/wizardPage1.jsp</to-view-id>
+			<redirect/>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>springWizardPage1</from-outcome>
+			<to-view-id>/springConversation/wizardPage1.jsp</to-view-id>
+			<redirect/>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>springWizardPage2</from-outcome>
+			<to-view-id>/springConversation/wizardPage2.jsp</to-view-id>
+			<redirect/>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>springWizardPage3</from-outcome>
+			<to-view-id>/springConversation/wizardPage3.jsp</to-view-id>
+			<redirect/>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>springWizardFinish</from-outcome>
+			<to-view-id>/springConversation/wizardFinish.jsp</to-view-id>
+			<redirect/>
+		</navigation-case>
 	</navigation-rule>
 
     <!-- navigational rules for the wizard -->

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-springConfig.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-springConfig.xml?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-springConfig.xml
(original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-springConfig.xml
Tue Jan  2 08:07:13 2007
@@ -2,9 +2,11 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
 	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	   xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:aop="http://www.springframework.org/schema/aop"
 	   xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
+       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
 
 	<!-- register our custom spring scope -->
 	<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
@@ -19,21 +21,17 @@
 
 	<!-- our beans -->
 	<bean
-		name="springConvData"
-		class="org.apache.myfaces.examples.conversation.ConvData"
-		scope="conversation">
-	</bean>
-
-	<bean
 		name="springWizardData"
 		class="org.apache.myfaces.examples.conversation.WizardData"
 		scope="conversation">
+		<aop:scoped-proxy />
 	</bean>
 
 	<bean
 		name="springWizardController"
-		class="org.apache.myfaces.examples.conversation.WizardController"
+		class="org.apache.myfaces.examples.conversation.SpringWizardController"
 		scope="request">
+		<property name="wizardData" ref="springWizardData" />
 	</bean>
 
 </beans>

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml Tue Jan  2 08:07:13
2007
@@ -4,6 +4,9 @@
   <listener>
     <listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
+  <listener>
+    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
+  </listener>
 
   <description>debug web.xml</description>
   <display-name>

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp Tue Jan  2 08:07:13 2007
@@ -120,6 +120,7 @@
             <h:outputText value="Conversation"/>
             <h:panelGrid style="padding-left:25px">
            		<h:outputLink value="conversation/index.jsf" ><f:verbatim>Conversation
Tag examples</f:verbatim></h:outputLink>
+				<h:outputLink value="springConversation/index.jsf" ><f:verbatim>A new Spring
"conversation" scope</f:verbatim></h:outputLink>
             </h:panelGrid>
 
 			<h:outputText value="Redirect Tracker"/>

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/home.jsp?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/home.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/home.jsp Tue
Jan  2 08:07:13 2007
@@ -16,8 +16,6 @@
 
             <h:outputText value="Conversation"/>
             <h:panelGrid style="padding-left:25px">
-           		<h:outputLink value="pageConversation.jsf" ><f:verbatim>Single page
conversation</f:verbatim></h:outputLink>
-				<h:outputLink value="startConversation.jsf" ><f:verbatim>Start a conversation
"on command"</f:verbatim></h:outputLink>
            		<h:outputLink value="wizardPage1.jsf" ><f:verbatim>Wizard</f:verbatim></h:outputLink>
             </h:panelGrid>
 

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardFinish.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardFinish.jsp?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardFinish.jsp
(original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardFinish.jsp
Tue Jan  2 08:07:13 2007
@@ -33,7 +33,7 @@
 <body>
 <f:view>
 
-<s:ensureConversation name="wizard" redirectTo="/conversation/wizardPage1.jsp" />
+<s:ensureConversation name="springWizardData" redirectTo="/conversation/wizardPage1.jsp"
/>
 
 <t:htmlTag value="h1">Registration Wizard</t:htmlTag>
 
@@ -50,55 +50,55 @@
 	</f:facet>
 	<f:facet name="footer">
 		<h:panelGroup>
-			<h:commandButton value="Save" action="#{wizardController.save}">
-				<s:endConversation name="wizard" onOutcome="success"/>
+			<h:commandButton value="Save" action="#{springWizardController.save}" >
+				<s:endConversation name="springWizardData" onOutcome="success"/>
 			</h:commandButton>
 
-			<h:commandButton value="End conversation and jump into the mid of a new one" action="wizardPage2">
-				<s:endConversation name="wizard" />
+			<h:commandButton value="End conversation and jump into the mid of a new one" action="springWizardPage2">
+				<s:endConversation name="springWizardData" />
 			</h:commandButton>
 
 		</h:panelGroup>
 	</f:facet>
 
     <h:outputText value="Edit data on" />
-	<h:commandButton value="Page1" action="wizardPage1" />
+	<h:commandButton value="Page1" action="springWizardPage1" />
 
     <h:outputText value="Salutation: " />
-    <h:outputText value="#{wizardData.salutation}" />
+    <h:outputText value="#{springWizardData.salutation}" />
 
     <h:outputText value="Title: " />
-    <h:outputText value="#{wizardData.title}" />
+    <h:outputText value="#{springWizardData.title}" />
 
     <h:outputText value="Name: " />
-    <h:outputText value="#{wizardData.name}" />
+    <h:outputText value="#{springWizardData.name}" />
 
     <h:outputText value="Surename: " />
-    <h:outputText value="#{wizardData.surename}" />
+    <h:outputText value="#{springWizardData.surename}" />
 
     <h:outputText value="Edit data on" />
-	<h:commandButton value="Page2" action="wizardPage2" />
+	<h:commandButton value="Page2" action="springWizardPage2" />
 
     <h:outputText value="Street: " />
-    <h:outputText value="#{wizardData.street}" />
+    <h:outputText value="#{springWizardData.street}" />
 
     <h:outputText value="City: " />
-    <h:outputText value="#{wizardData.city}" />
+    <h:outputText value="#{springWizardData.city}" />
 
     <h:outputText value="State: " />
-    <h:outputText value="#{wizardData.state}" />
+    <h:outputText value="#{springWizardData.state}" />
 
     <h:outputText value="Province: " />
-    <h:outputText value="#{wizardData.province}" />
+    <h:outputText value="#{springWizardData.province}" />
 
     <h:outputText value="Postal: " />
-    <h:outputText value="#{wizardData.postal}" />
+    <h:outputText value="#{springWizardData.postal}" />
 
     <h:outputText value="Edit data on" />
-	<h:commandButton value="Page3" action="wizardPage3" />
+	<h:commandButton value="Page3" action="springWizardPage3" />
 
     <h:outputText value="Info: " />
-    <t:outputText value="#{wizardData.info}" escape="false" />
+    <t:outputText value="#{springWizardData.info}" escape="false" />
 
 </h:panelGrid>
 <h:messages showDetail="true"/>

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage1.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage1.jsp?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage1.jsp
(original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage1.jsp
Tue Jan  2 08:07:13 2007
@@ -48,7 +48,7 @@
 	</f:facet>
 	<f:facet name="footer">
 		<h:panelGroup>
-			<h:commandButton value="Next >>" action="wizardPage2" />
+			<h:commandButton value="Next >>" action="springWizardPage2" />
 		</h:panelGroup>
 	</f:facet>
 

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage2.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage2.jsp?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage2.jsp
(original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage2.jsp
Tue Jan  2 08:07:13 2007
@@ -33,7 +33,7 @@
 <body>
 <f:view>
 
-<s:ensureConversation name="springConvData" action="wizardPage1" />
+<s:ensureConversation name="springWizardData" action="springWizardPage1" />
 
 <t:htmlTag value="h1">Registration Wizard</t:htmlTag>
 
@@ -50,25 +50,25 @@
 	</f:facet>
 	<f:facet name="footer">
 		<h:panelGroup>
-			<h:commandButton value="<< Prev" action="wizardPage1" immediate="true"/>
-			<h:commandButton value="Next >>" action="wizardPage3" />
+			<h:commandButton value="<< Prev" action="springWizardPage1" immediate="true"/>
+			<h:commandButton value="Next >>" action="springWizardPage3" />
 		</h:panelGroup>
 	</f:facet>
 
     <h:outputText value="Street: " />
-    <h:inputText id="street" value="#{wizardData.street}" required="true"/>
+    <h:inputText id="street" value="#{springWizardData.street}" required="true"/>
 
     <h:outputText value="City: " />
-    <h:inputText id="city" value="#{wizardData.city}" required="true"/>
+    <h:inputText id="city" value="#{springWizardData.city}" required="true"/>
 
     <h:outputText value="State: " />
-    <h:inputText id="state" value="#{wizardData.state}" required="true"/>
+    <h:inputText id="state" value="#{springWizardData.state}" required="true"/>
 
     <h:outputText value="Province: " />
-    <h:inputText id="province" value="#{wizardData.province}" />
+    <h:inputText id="province" value="#{springWizardData.province}" />
 
     <h:outputText value="Postal: " />
-    <h:inputText id="postal" value="#{wizardData.postal}" required="true"/>
+    <h:inputText id="postal" value="#{springWizardData.postal}" required="true"/>
 </h:panelGrid>
 <h:messages showDetail="true"/>
 </h:form>

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage3.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage3.jsp?view=diff&rev=491825&r1=491824&r2=491825
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage3.jsp
(original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/springConversation/wizardPage3.jsp
Tue Jan  2 08:07:13 2007
@@ -33,7 +33,7 @@
 <body>
 <f:view>
 
-<s:ensureConversation name="springConvData" action="#{wizardController.ensureConversationAction}"
/>
+<s:ensureConversation name="springWizardData" action="#{springWizardController.ensureConversationAction}"
/>
 
 <t:htmlTag value="h1">Registration Wizard</t:htmlTag>
 
@@ -50,15 +50,15 @@
 	</f:facet>
 	<f:facet name="footer">
 		<h:panelGroup>
-			<h:commandButton value="<< Prev" action="wizardPage2" immediate="true"/>
-			<h:commandButton value="Finish" action="wizardFinish" />
+			<h:commandButton value="<< Prev" action="springWizardPage2" immediate="true"/>
+			<h:commandButton value="Finish" action="springWizardFinish" />
 		</h:panelGroup>
 	</f:facet>
 
     <h:outputText value="Info: " />
     <t:inputHtml
     		id="info"
-    		value="#{wizardData.info}"
+    		value="#{springWizardData.info}"
     		allowEditSource="false"
     		allowExternalLinks="false"/>
 



Mime
View raw message