Seam SVN: r12336 - in modules/security/trunk/examples/seamspace: src/main/java/org/jboss/seam/security/examples/seamspace/action and 3 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-03-30 22:58:12 -0400 (Tue, 30 Mar 2010)
New Revision: 12336
Added:
modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/MemberSearch.java
Modified:
modules/security/trunk/examples/seamspace/pom.xml
modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ContentAction.java
modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/PictureSearch.java
modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ProfileAction.java
modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/AuthenticationEvents.java
modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java
modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/web.xml
modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml
modules/security/trunk/examples/seamspace/src/main/webapp/profile.xhtml
modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml
Log:
fix jsf tags, links, fix new member search, fix content servlet, temporarily disable security for content servlet, other misc
Modified: modules/security/trunk/examples/seamspace/pom.xml
===================================================================
--- modules/security/trunk/examples/seamspace/pom.xml 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/pom.xml 2010-03-31 02:58:12 UTC (rev 12336)
@@ -98,27 +98,27 @@
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.0</version>
- <configuration>
- <warName>${pom.artifactId}</warName>
- </configuration>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <warName>seam-space</warName>
+ </configuration>
+ </plugin>
- </plugins>
+ </plugins>
</build>
</project>
Modified: modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ContentAction.java
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ContentAction.java 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ContentAction.java 2010-03-31 02:58:12 UTC (rev 12336)
@@ -1,5 +1,6 @@
package org.jboss.seam.security.examples.seamspace.action;
+import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
@@ -7,7 +8,7 @@
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.examples.seamspace.model.MemberImage;
-@Named
+@Dependent @Named
public class ContentAction
{
@Inject EntityManager entityManager;
@@ -17,9 +18,9 @@
{
MemberImage img = entityManager.find(MemberImage.class, imageId);
- if (img == null || !identity.hasPermission(img, "view"))
+ /* if (img == null || !identity.hasPermission(img, "view"))
return null;
- else
+ else*/
return img;
}
}
Added: modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/MemberSearch.java
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/MemberSearch.java (rev 0)
+++ modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/MemberSearch.java 2010-03-31 02:58:12 UTC (rev 12336)
@@ -0,0 +1,43 @@
+package org.jboss.seam.security.examples.seamspace.action;
+
+import java.util.List;
+import java.util.Random;
+
+import javax.enterprise.inject.Model;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.security.examples.seamspace.model.Member;
+
+@Model
+public class MemberSearch
+{
+ @Inject EntityManager entityManager;
+
+ private List<Member> newMembers;
+
+ /**
+ * Returns a random selection of 3 members out of the latest 10 new members
+ *
+ * @return A List<Member> containing 3 random members
+ */
+ @SuppressWarnings("unchecked")
+ public List<Member> getNewMembers()
+ {
+ if (newMembers == null)
+ {
+ newMembers = entityManager.createQuery(
+ "from Member order by memberSince desc")
+ .setMaxResults(10)
+ .getResultList();
+
+ // Randomly select 3 of the latest 10 members
+ Random rnd = new Random(System.currentTimeMillis());
+ while (newMembers.size() > 3)
+ {
+ newMembers.remove(rnd.nextInt(newMembers.size()));
+ }
+ }
+ return newMembers;
+ }
+}
Modified: modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/PictureSearch.java
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/PictureSearch.java 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/PictureSearch.java 2010-03-31 02:58:12 UTC (rev 12336)
@@ -7,7 +7,6 @@
import javax.enterprise.inject.Model;
import javax.inject.Inject;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.annotations.Delete;
@@ -20,7 +19,7 @@
private String memberName;
- /*@PersistenceContext */EntityManager entityManager;
+ @Inject EntityManager entityManager;
@Inject Identity identity;
Modified: modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ProfileAction.java
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ProfileAction.java 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/action/ProfileAction.java 2010-03-31 02:58:12 UTC (rev 12336)
@@ -86,24 +86,7 @@
.setParameter("memberName", name)
.getResultList();
}
-
- @SuppressWarnings("unchecked")
- //@Factory("newMembers")
- public void newMembers()
- {
- newMembers = entityManager.createQuery(
- "from Member order by memberSince desc")
- .setMaxResults(10)
- .getResultList();
- // Randomly select 3 of the latest 10 members
- Random rnd = new Random(System.currentTimeMillis());
- while (newMembers.size() > 3)
- {
- newMembers.remove(rnd.nextInt(newMembers.size()));
- }
- }
-
@SuppressWarnings("unchecked")
public List<Member> getFriends()
{
Modified: modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/AuthenticationEvents.java
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/AuthenticationEvents.java 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/AuthenticationEvents.java 2010-03-31 02:58:12 UTC (rev 12336)
@@ -10,7 +10,7 @@
import org.jboss.seam.security.examples.seamspace.model.MemberAccount;
@SessionScoped
-public class AuthenticationEvents implements Serializable
+class AuthenticationEvents implements Serializable
{
private static final long serialVersionUID = -2747242953250092889L;
Modified: modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java 2010-03-31 02:58:12 UTC (rev 12336)
@@ -2,19 +2,18 @@
import java.io.Serializable;
-import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-@ConversationScoped
public class EntityManagerProducer implements Serializable
{
private static final long serialVersionUID = 8654896806568473010L;
@PersistenceContext EntityManager entityManager;
- public @Produces EntityManager getEntityManager()
+ public @Produces @Dependent EntityManager getEntityManager()
{
return entityManager;
}
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/web.xml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/web.xml 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/web.xml 2010-03-31 02:58:12 UTC (rev 12336)
@@ -22,7 +22,7 @@
<!-- Content Servlet -->
- <!--servlet>
+ <servlet>
<servlet-name>Content Servlet</servlet-name>
<servlet-class>org.jboss.seam.security.examples.seamspace.util.ContentServlet</servlet-class>
</servlet>
@@ -30,6 +30,6 @@
<servlet-mapping>
<servlet-name>Content Servlet</servlet-name>
<url-pattern>/content/*</url-pattern>
- </servlet-mapping-->
+ </servlet-mapping>
</web-app>
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml 2010-03-31 02:58:12 UTC (rev 12336)
@@ -17,7 +17,7 @@
been put together to demonstrate the various features of the Seam Security API.
</p>
- <p><b>New!</b> You can now use the <h:link view="/hashgen.xhtml" value="Password Hash Generator"/>
+ <p><b>New!</b> You can now use the <h:link outcome="/hashgen.xhtml" value="Password Hash Generator"/>
page to generate password hashes for your own application.
</p>
@@ -73,7 +73,7 @@
<div class="newMembers">
<div class="newMembersHeader">Cool new members</div>
- <ui:repeat value="#{newMembers}" var="newMember">
+ <ui:repeat value="#{memberSearch.newMembers}" var="newMember">
<div class="newMember">
<h:link view="/profile.seam" propagation="none">
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/profile.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/profile.xhtml 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/profile.xhtml 2010-03-31 02:58:12 UTC (rev 12336)
@@ -2,26 +2,26 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib">
+ xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="template.xhtml">
<ui:define name="content">
<div class="errors"><h:messages globalOnly="true"/></div>
- <s:div rendered="#{selectedMember == null}">
- Sorry, but this member does not exist.
- </s:div>
+ <ui:fragment rendered="#{selectedMember == null}">
+ <div>Sorry, but this member does not exist.</div>
+ </ui:fragment>
- <s:div rendered="#{selectedMember != null}">
-
- <s:div id="memberCard">
+ <ui:fragment rendered="#{selectedMember != null}">
+ <div id="memberCard">
<h1>#{selectedMember.memberName}'s profile</h1>
-
- <s:div id="memberCardPicture" rendered="#{selectedMember.picture ne null}">
- <h:graphicImage value="/content/images?id=#{selectedMember.picture.imageId}&width=170"/>
- </s:div>
+
+ <ui:fragment rendered="#{selectedMember.picture ne null}">
+ <div id="memberCardPicture">
+ <h:graphicImage value="/content/images?id=#{selectedMember.picture.imageId}&width=170"/>
+ </div>
+ </ui:fragment>
<div id="memberCardText">
<span class="tagline">"#{selectedMember.tagline}"</span><br/><br/>
@@ -33,83 +33,89 @@
<br style="clear:both"/>
View My:
- <s:link view="/pictures.xhtml" value="Pics">
+ <h:link outcome="/pictures.xhtml" value="Pics">
<f:param name="name" value="#{selectedMember.memberName}"/>
- </s:link>
-
- </s:div>
-
- <s:div id="memberBlog">
+ </h:link>
+ </div>
+
+ <div id="memberBlog">
<div class="sectionHeader">#{selectedMember.memberName}'s latest blog entries</div>
<ui:repeat value="#{profile.latestBlogs}" var="latestBlog">
<div class="blogSummary">#{latestBlog.title}
- (<s:link view="/blogentry.xhtml" value="view more">
+ (<h:link outcome="/blogentry.xhtml" value="view more">
<f:param name="name" value="#{selectedMember.memberName}"/>
<f:param name="blogId" value="#{latestBlog.blogId}"/>
- </s:link>)
+ </h:link>)
</div>
</ui:repeat>
- [<s:link id="viewBlog" view="/blog.xhtml" value="View all blog entries" propagation="none">
+ [<h:link id="viewBlog" outcome="/blog.xhtml" value="View all blog entries" propagation="none">
<f:param name="name" value="#{selectedMember.memberName}"/>
- </s:link>]
+ </h:link>]
- <s:span rendered="#{s:hasPermission(selectedMember, 'createBlog')}">
- [<s:link id="createBlog" action="#{blog.createEntry}" value="Create new blog entry" propagation="none"/>]
- </s:span>
- </s:div>
+ <ui:fragment rendered="#{identity.hasPermission(selectedMember, 'createBlog')}">
+ <span>
+ [<h:link id="createBlog" action="#{blog.createEntry}" value="Create new blog entry"/>]
+ </span>
+ </ui:fragment>
+ </div>
- <s:div id="memberFriends">
+ <div id="memberFriends">
<div class="sectionHeader">#{selectedMember.memberName}'s friends</div>
<ui:repeat value="#{profile.friends}" var="f">
<div class="friend">
- <s:link view="/profile.xhtml" propagation="none">
+ <h:link outcome="/profile.xhtml">
<f:param name="name" value="#{f.memberName}"/>
#{f.memberName}<br/>
<h:graphicImage value="/content/images?id=#{f.picture.imageId}&width=90"/>
- </s:link>
+ </h:link>
</div>
</ui:repeat>
<br class="clear"/>
- <s:span rendered="#{selectedMember.memberId != authenticatedMember.memberId and s:hasPermission(selectedMember, 'createFriendRequest')}">
- [<s:link view="/friendrequest.xhtml" action="#{friendAction.createRequest}" value="Send a friend request"/>]
- </s:span>
+ <ui:fragment rendered="#{selectedMember.memberId != authenticatedMember.memberId and identity.hasPermission(selectedMember, 'createFriendRequest')}">
+ <span>
+ [<h:link outcome="/friendrequest.xhtml" action="#{friendAction.createRequest}" value="Send a friend request"/>]
+ </span>
+ </ui:fragment>
- </s:div>
+ </div>
- <s:div id="friendComments">
+ <div id="friendComments">
<div class="sectionHeader">#{selectedMember.memberName}'s friend's comments</div>
<ui:repeat value="#{profile.friendComments}" var="c">
<table class="friendComments">
<tr>
<td class="friendCommentor">
- <s:link view="/profile.xhtml">
+ <h:link outcome="/profile.xhtml">
<f:param name="name" value="#{c.friend.memberName}"/>
#{c.friend.memberName}<br/>
<h:graphicImage value="/content/images?id=#{c.friend.picture.imageId}&width=90"/>
- </s:link>
+ </h:link>
</td>
<td style="text-align: left">
<b>#{c.formattedCommentDate}</b><br/>
- <p><s:formattedText value="#{c.comment}"/></p>
+ <p><h:outputText value="#{c.comment}"/></p>
</td>
</tr>
</table>
</ui:repeat>
- <s:span rendered="#{s:hasPermission(selectedMember, 'createFriendComment')}">
- [<s:link view="/friendcomment.xhtml" value="Add Comment"/>]
- </s:span>
- </s:div>
- </s:div>
+ <ui:fragment rendered="#{identity.hasPermission(selectedMember, 'createFriendComment')}">
+ <span>
+ [<h:link outcome="/friendcomment.xhtml" value="Add Comment"/>]
+ </span>
+ </ui:fragment>
+ </div>
+
+ </ui:fragment>
</ui:define>
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml 2010-03-31 01:35:01 UTC (rev 12335)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml 2010-03-31 02:58:12 UTC (rev 12336)
@@ -19,7 +19,7 @@
<div class="headerMenu">
<ui:fragment rendered="#{identity.loggedIn}">
- <h:link id="profile" view="/profile.xhtml" value="My Profile" propagation="none">
+ <h:link id="profile" outcome="/profile.xhtml" value="My Profile" propagation="none">
<f:param name="name" value="#{authenticatedMember.memberName}"/>
</h:link>
<h:outputText styleClass="divider" value=" | "/>
@@ -50,7 +50,7 @@
</div>
<div id="menubar">
- <h:link view="/home.xhtml" value="Home" propagation="none"/><h:outputText styleClass="divider" value=" | "/>
+ <h:link outcome="/home.xhtml" value="Home"/><h:outputText styleClass="divider" value=" | "/>
<h:link value="Browse" onclick="javascript:alert('This feature coming soon!');return false"/><h:outputText styleClass="divider" value=" | "/>
<h:link value="Blog" onclick="javascript:alert('This feature coming soon!');return false"/><h:outputText styleClass="divider" value=" | "/>
<h:link value="Music" onclick="javascript:alert('This feature coming soon!');return false"/>
14 years, 6 months
Seam SVN: r12335 - modules/xml/trunk/core.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-03-30 21:35:01 -0400 (Tue, 30 Mar 2010)
New Revision: 12335
Modified:
modules/xml/trunk/core/pom.xml
Log:
update name
Modified: modules/xml/trunk/core/pom.xml
===================================================================
--- modules/xml/trunk/core/pom.xml 2010-03-31 01:32:25 UTC (rev 12334)
+++ modules/xml/trunk/core/pom.xml 2010-03-31 01:35:01 UTC (rev 12335)
@@ -11,7 +11,7 @@
<groupId>org.jboss.seam.xml</groupId>
<artifactId>seam-xml-bean-config</artifactId>
<packaging>jar</packaging>
- <name>Seam XML Bean Config</name>
+ <name>Seam XML Bean Config Module</name>
<repositories>
<repository>
14 years, 6 months
Seam SVN: r12334 - in modules/xml/trunk: docs and 1 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-03-30 21:32:25 -0400 (Tue, 30 Mar 2010)
New Revision: 12334
Modified:
modules/xml/trunk/docs/pom.xml
modules/xml/trunk/examples/princess-rescue/pom.xml
modules/xml/trunk/pom.xml
Log:
update project name
Modified: modules/xml/trunk/docs/pom.xml
===================================================================
--- modules/xml/trunk/docs/pom.xml 2010-03-30 22:44:07 UTC (rev 12333)
+++ modules/xml/trunk/docs/pom.xml 2010-03-31 01:32:25 UTC (rev 12334)
@@ -11,7 +11,7 @@
<artifactId>seam-xml-bean-config-reference-guide</artifactId>
<version>3.0.0-SNAPSHOT</version>
<packaging>jdocbook</packaging>
- <name>Seam XML Reference Guide</name>
+ <name>Seam XML Bean Config Reference Guide</name>
<pluginRepositories>
<pluginRepository>
Modified: modules/xml/trunk/examples/princess-rescue/pom.xml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/pom.xml 2010-03-30 22:44:07 UTC (rev 12333)
+++ modules/xml/trunk/examples/princess-rescue/pom.xml 2010-03-31 01:32:25 UTC (rev 12334)
@@ -8,12 +8,11 @@
<relativePath>../../pom.xml</relativePath>
</parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.xml</groupId>
<artifactId>princess-rescue</artifactId>
<packaging>war</packaging>
- <name>Seam XML Example Princess Rescue</name>
+ <name>Seam XML Bean Config Example: Princess Rescue</name>
<version>3.0.0-SNAPSHOT</version>
<properties>
Modified: modules/xml/trunk/pom.xml
===================================================================
--- modules/xml/trunk/pom.xml 2010-03-30 22:44:07 UTC (rev 12333)
+++ modules/xml/trunk/pom.xml 2010-03-31 01:32:25 UTC (rev 12334)
@@ -11,7 +11,7 @@
<artifactId>seam-xml-bean-config-parent</artifactId>
<packaging>pom</packaging>
<version>3.0.0-SNAPSHOT</version>
- <name>Seam XML Bean Configuration Parent</name>
+ <name>Seam XML Bean Config Parent</name>
<modules>
<module>core</module>
14 years, 6 months
Seam SVN: r12333 - in modules/faces/trunk/src: main/java/org/jboss/seam/faces/context/conversation and 5 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-03-30 18:44:07 -0400 (Tue, 30 Mar 2010)
New Revision: 12333
Added:
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtension.java
modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java
modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java
Removed:
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/RetainsConversation.java
Modified:
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java
modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java
modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java
modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java
modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java
Log:
* Major updates for @Begin(permit={...}) and @End(permit={...})
* Added the FacesAnnotationAdapterExtension to help ease migration from legacy (DOA) JSF2 bean annotations.
* Added the Annotations utility class and Tests
* Tests tests tests!
Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtension.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtension.java (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtension.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -0,0 +1,152 @@
+package org.jboss.seam.faces.context;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+
+/**
+ * Alias the JSF scope annotations to the CDI scope annotations. If a JSF scope
+ * annotation is detected, advise the developer to update the code to use the
+ * equivalent CDI scope annotation. Forbid the developer from using the JSF
+ * managed bean annotation.
+ *
+ * @author Dan Allen
+ */
+public class FacesAnnotationsAdapterExtension implements Extension
+{
+ private final Map<Class<? extends Annotation>, Class<? extends Annotation>> scopeAliasMapping;
+
+ /*
+ * For unit testing
+ */
+ static final Map<Class<?>, Class<? extends Annotation>> aliasedBeans = new HashMap<Class<?>, Class<? extends Annotation>>();
+
+ public FacesAnnotationsAdapterExtension()
+ {
+ scopeAliasMapping = new HashMap<Class<? extends Annotation>, Class<? extends Annotation>>(3);
+ scopeAliasMapping.put(javax.faces.bean.RequestScoped.class, javax.enterprise.context.RequestScoped.class);
+ scopeAliasMapping.put(javax.faces.bean.SessionScoped.class, javax.enterprise.context.SessionScoped.class);
+ scopeAliasMapping.put(javax.faces.bean.ApplicationScoped.class, javax.enterprise.context.ApplicationScoped.class);
+ }
+
+ public void aliasJsfScopeIfDetected(@Observes final ProcessAnnotatedType<Object> annotatedType)
+ {
+ for (Class<? extends Annotation> scope : scopeAliasMapping.keySet())
+ {
+ if (annotatedType.getAnnotatedType().isAnnotationPresent(scope))
+ {
+ System.out.println("WARNING: Please annotate class " + annotatedType.getAnnotatedType().getJavaClass() + " with @" + scopeAliasMapping.get(scope).getName() + " instead of @" + scope.getName());
+ aliasedBeans.put(annotatedType.getAnnotatedType().getJavaClass(), scope);
+ annotatedType.setAnnotatedType(decorateType(annotatedType.getAnnotatedType(), scope));
+ break;
+ }
+ }
+ }
+
+ public void failIfJsfManagedBeanAnnotationPresent(@Observes final ProcessBean<?> bean)
+ {
+ if (bean.getAnnotated().isAnnotationPresent(javax.faces.bean.ManagedBean.class))
+ {
+ bean.addDefinitionError(new RuntimeException("Use of @javax.faces.bean.ManagedBean is forbidden. Please use @javax.inject.Named instead."));
+ }
+ }
+
+ private Class<? extends Annotation> getCdiScopeFor(final Class<? extends Annotation> jsfScope)
+ {
+ return scopeAliasMapping.get(jsfScope);
+ }
+
+ private AnnotatedType<Object> decorateType(final AnnotatedType<Object> type, final Class<? extends Annotation> jsfScope)
+ {
+ final Class<? extends Annotation> cdiScope = getCdiScopeFor(jsfScope);
+ final Annotation cdiScopeAnnotation = new Annotation()
+ {
+ public Class<? extends Annotation> annotationType()
+ {
+ return cdiScope;
+ }
+ };
+
+ final Set<Annotation> maskedAnnotations = new HashSet<Annotation>(type.getAnnotations());
+ maskedAnnotations.remove(type.getAnnotation(jsfScope));
+ maskedAnnotations.add(cdiScopeAnnotation);
+
+ return new AnnotatedType<Object>()
+ {
+ public Class<Object> getJavaClass()
+ {
+ return type.getJavaClass();
+ }
+
+ public Set<AnnotatedConstructor<Object>> getConstructors()
+ {
+ return type.getConstructors();
+ }
+
+ public Set<AnnotatedMethod<? super Object>> getMethods()
+ {
+ return type.getMethods();
+ }
+
+ public Set<AnnotatedField<? super Object>> getFields()
+ {
+ return type.getFields();
+ }
+
+ public Type getBaseType()
+ {
+ return type.getBaseType();
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return type.getTypeClosure();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends Annotation> T getAnnotation(final Class<T> annotationType)
+ {
+ if (annotationType == jsfScope)
+ {
+ return null;
+ }
+ else if (annotationType == cdiScope)
+ {
+ return (T) cdiScopeAnnotation;
+ }
+
+ return type.getAnnotation(annotationType);
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return maskedAnnotations;
+ }
+
+ public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType)
+ {
+ if (annotationType == jsfScope)
+ {
+ return false;
+ }
+ else if (annotationType == cdiScope)
+ {
+ return true;
+ }
+ return type.isAnnotationPresent(annotationType);
+ }
+ };
+ }
+}
\ No newline at end of file
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -8,15 +8,15 @@
import java.lang.annotation.Target;
import javax.enterprise.context.Conversation;
+import javax.enterprise.util.Nonbinding;
import javax.interceptor.InterceptorBinding;
/**
- * Marks the beginning of a persistent {@link Conversation}.
+ * Begins a persistent {@link Conversation}.
*
*<p>
- * <b>Note:</b> If this method throws an exception, the conversation will be
- * discarded, unless the exception is annotated with @
- * {@link RetainsConversation}
+ * <b>Note:</b> Unless the exception is of a permitted type, if this method
+ * throws an exception, the conversation will not begin.
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
@@ -27,9 +27,34 @@
public @interface Begin
{
/**
- * The new conversation ID. Seam will Generate a conversation ID if left
- * blank. If a conversation with the ID already exists, TODO what should we
- * do?
+ * Sets the new {@link Conversation} ID. Seam will Generate a conversation ID
+ * if left blank.
+ * <p>
+ * If a conversation with the ID already exists... TODO what should we do?
+ * <p>
+ * TODO test default conversation ID functionality
*/
+ @Nonbinding
String id() default "";
+
+ /**
+ * Sets the {@link Conversation} timeout period, in milliseconds (E.g.: 5000
+ * = 5 seconds.)
+ * <p>
+ * TODO implement timeout support on @Begin
+ */
+ @Nonbinding
+ long timeout() default -1;
+
+ /**
+ * Sets the exception types for which, when encountered during a method
+ * invocation, the {@link Conversation} will still begin. (In other words:
+ * Permitted exceptions do not abort @{@link Begin})
+ * <p>
+ * <b>By default:</b> { empty array } - all encountered exceptions will
+ * prevent the {@link Conversation} from beginning.
+ */
+ @Nonbinding
+ Class<? extends Exception>[] permit() default {};
+
}
\ No newline at end of file
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -12,6 +12,11 @@
/**
* Parent annotation for @{@link Begin} and @{@link End}
+ * <p>
+ * <b>Note:</b> This should never be used.
+ * <p>
+ * TODO: Should we warn at startup if @{@link Begin} and @{@link End} are used
+ * together on the same method?
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -4,8 +4,9 @@
package org.jboss.seam.faces.context.conversation;
import java.io.Serializable;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
import javax.enterprise.context.Conversation;
import javax.inject.Inject;
@@ -17,10 +18,10 @@
import org.slf4j.Logger;
/**
- * Intercepts methods annotated as Conversational entry points.
+ * Intercepts methods annotated as Conversational entry points: @{@link Begin}
+ * and @{@link End}
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
- *
*/
@ConversationBoundary
@Interceptor
@@ -35,26 +36,76 @@
Conversation conversation;
@AroundInvoke
- public Object before(final InvocationContext ctx) throws Exception
+ public Object around(final InvocationContext ctx) throws Exception
{
Object result = null;
+
+ try
+ {
+ if (Annotations.hasAnnotation(ctx.getMethod(), Begin.class))
+ {
+ beginConversation(ctx);
+ }
+
+ result = ctx.proceed();
+
+ if (Annotations.hasAnnotation(ctx.getMethod(), End.class))
+ {
+ endConversation(ctx);
+ }
+ }
+ catch (Exception e)
+ {
+ handleExceptionBegin(ctx, e);
+ handleExceptionEnd(ctx, e);
+ throw e;
+ }
+
+ return result;
+ }
+
+ private void handleExceptionBegin(final InvocationContext ctx, final Exception e)
+ {
if (Annotations.hasAnnotation(ctx.getMethod(), Begin.class))
{
- result = beginConversation(ctx);
+ List<? extends Class<? extends Exception>> typesPermittedByBegin = getPermittedExceptionTypesBegin(ctx.getMethod());
+ for (Class<? extends Exception> type : typesPermittedByBegin)
+ {
+ if (type.isInstance(e) == false)
+ {
+ log.debug("Aborting conversation: (#0) for method: (#1.#2(...)) - Encountered Exception of type (#4), which is not in the list of exceptions permitted by @Begin.", new Object[] { conversation.getId(), ctx.getMethod().getDeclaringClass().getName(), ctx.getMethod().getName(), e.getClass().getName() });
+ conversation.end();
+ }
+ }
}
+ }
+
+ private void handleExceptionEnd(final InvocationContext ctx, final Exception e)
+ {
if (Annotations.hasAnnotation(ctx.getMethod(), End.class))
{
- endConversation(ctx);
+ List<? extends Class<? extends Exception>> typesPermittedByEnd = getPermittedExceptionTypesEnd(ctx.getMethod());
+ boolean permitted = false;
+ for (Class<? extends Exception> type : typesPermittedByEnd)
+ {
+ if (type.isInstance(e))
+ {
+ permitted = true;
+ conversation.end();
+ }
+ }
+ if (!permitted)
+ {
+ log.debug("Conversation will remain open: (#0) for method: (#1.#2(...)) - Encountered Exception of type (#4), which is not in the list of exceptions permitted by @End.", new Object[] { conversation.getId(), ctx.getMethod().getDeclaringClass().getName(), ctx.getMethod().getName(), e.getClass().getName() });
+ }
}
-
- return result;
}
- private Object beginConversation(final InvocationContext ctx) throws Exception
+ private void beginConversation(final InvocationContext ctx) throws Exception
{
String cid = getConversationId(ctx.getMethod());
- if (cid != null)
+ if ((cid != null) && !"".equals(cid))
{
conversation.begin(cid);
}
@@ -62,47 +113,27 @@
{
conversation.begin();
}
-
- log.debug("Began conversation: (#0) on method: (#1.#2(...))", new Object[] { conversation.getId(), ctx.getMethod().getDeclaringClass().getName(), ctx.getMethod().getName() });
-
- try
- {
- Object result = ctx.proceed();
- return result;
- }
- catch (Exception e)
- {
- conversation.end();
- throw e;
- }
+ log.debug("Began conversation: (#0) before method: (#1.#2(...))", new Object[] { conversation.getId(), ctx.getMethod().getDeclaringClass().getName(), ctx.getMethod().getName() });
}
private void endConversation(final InvocationContext ctx)
{
+ log.debug("Ending conversation: (#0) after method: (#1.#2(...))", new Object[] { conversation.getId(), ctx.getMethod().getDeclaringClass().getName(), ctx.getMethod().getName() });
conversation.end();
}
private String getConversationId(final Method m)
{
- String result = null;
- for (Annotation a : m.getAnnotations())
- {
- if (a.annotationType().isAnnotationPresent(Begin.class))
- {
- result = a.annotationType().getAnnotation(Begin.class).id();
- }
- }
+ return Annotations.getAnnotation(m, Begin.class).id();
+ }
- if (result == null)
- {
- for (Annotation a : m.getDeclaringClass().getAnnotations())
- {
- if (a.annotationType().isAnnotationPresent(Begin.class))
- {
- result = a.annotationType().getAnnotation(Begin.class).id();
- }
- }
- }
- return result;
+ private List<? extends Class<? extends Exception>> getPermittedExceptionTypesBegin(final Method m)
+ {
+ return Arrays.asList(Annotations.getAnnotation(m, Begin.class).permit());
}
+
+ private List<? extends Class<? extends Exception>> getPermittedExceptionTypesEnd(final Method m)
+ {
+ return Arrays.asList(Annotations.getAnnotation(m, End.class).permit());
+ }
}
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -8,15 +8,15 @@
import java.lang.annotation.Target;
import javax.enterprise.context.Conversation;
+import javax.enterprise.util.Nonbinding;
import javax.interceptor.InterceptorBinding;
/**
- * Marks the beginning of a persistent {@link Conversation}.
+ * Ends a persistent {@link Conversation}.
*
*<p>
- * <b>Note:</b> If this method throws an exception, the conversation will be
- * discarded, unless the exception is annotated with @
- * {@link RetainsConversation}
+ * <b>Note:</b> Unless the exception is of a permitted type, if this method
+ * throws an exception, the conversation will not be ended.
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
@@ -27,9 +27,14 @@
public @interface End
{
/**
- * The new conversation ID. Seam will Generate a conversation ID if left
- * blank. If a conversation with the ID already exists, TODO what should we
- * do?
+ * Sets the exception types for which, when encountered during a method
+ * invocation, the {@link Conversation} will still end. (In other words:
+ * These exceptions do not abort @{@link End})
+ * <p>
+ * <b>By default:</b> { empty array } - all encountered exceptions will cause
+ * the {@link Conversation} to remain open.
*/
- String id() default "";
+ @Nonbinding
+ Class<? extends Exception>[] permit() default {};
+
}
\ No newline at end of file
Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/RetainsConversation.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/RetainsConversation.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/RetainsConversation.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -1,35 +0,0 @@
-package org.jboss.seam.faces.context.conversation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.context.Conversation;
-import javax.inject.Qualifier;
-
-/**
- * Marks the beginning of a persistent {@link Conversation}.
- *
- *<p>
- * <b>Note:</b> If this method throws an exception, the conversation will be
- * discarded, unless the exception is annotated with {@link RetainsConversation}
- *
- * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
- */
-@Qualifier
-@Target( { FIELD, PARAMETER })
-@Retention(RUNTIME)
-@Documented
-public @interface RetainsConversation
-{
- /**
- * The new conversation ID. Seam will Generate a conversation ID if left
- * blank. If a conversation with the ID already exists, TODO what should we
- * do?
- */
- String id() default "";
-}
\ No newline at end of file
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -20,6 +20,9 @@
* Discover if a Method <b>m</b> has been annotated with <b>type</b>. This
* also discovers annotations defined through a @{@link Stereotype}.
*
+ * @param m The method to inspect.
+ * @param type The targeted annotation class
+ *
* @return True if annotation is present either on the method itself, or on
* the declaring class of the method. Returns false if the annotation
* is not present.
@@ -53,6 +56,9 @@
* Discover if a Class <b>c</b> has been annotated with <b>type</b>. This
* also discovers annotations defined through a @{@link Stereotype}.
*
+ * @param c The class to inspect.
+ * @param type The targeted annotation class
+ *
* @return True if annotation is present either on class, false if the
* annotation is not present.
*/
@@ -75,4 +81,60 @@
}
return result;
}
+
+ /**
+ * Inspect method <b>m</b> for a specific <b>type</b> of annotation. This
+ * also discovers annotations defined through a @ {@link Stereotype}.
+ *
+ * @param m The method to inspect.
+ * @param type The targeted annotation class
+ *
+ * @return The annotation instance found on this method or enclosing class,
+ * or null if no matching annotation was found.
+ */
+ public static <A extends Annotation> A getAnnotation(final Method m, final Class<A> type)
+ {
+ A result = m.getAnnotation(type);
+ if (result == null)
+ {
+ for (Annotation a : m.getAnnotations())
+ {
+ if (a.annotationType().isAnnotationPresent(type))
+ {
+ result = a.annotationType().getAnnotation(type);
+ }
+ }
+ }
+ if (result == null)
+ {
+ result = getAnnotation(m.getDeclaringClass(), type);
+ }
+ return result;
+ }
+
+ /**
+ * Inspect class <b>c</b> for a specific <b>type</b> of annotation. This also
+ * discovers annotations defined through a @ {@link Stereotype}.
+ *
+ * @param c The class to inspect.
+ * @param type The targeted annotation class
+ *
+ * @return The annotation instance found on this class, or null if no
+ * matching annotation was found.
+ */
+ public static <A extends Annotation> A getAnnotation(final Class<?> c, final Class<A> type)
+ {
+ A result = c.getAnnotation(type);
+ if (result == null)
+ {
+ for (Annotation a : c.getAnnotations())
+ {
+ if (a.annotationType().isAnnotationPresent(type))
+ {
+ result = a.annotationType().getAnnotation(type);
+ }
+ }
+ }
+ return result;
+ }
}
Modified: modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
===================================================================
--- modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2010-03-30 22:44:07 UTC (rev 12333)
@@ -1,2 +1,3 @@
org.jboss.seam.faces.context.ViewScopedExtension
-org.jboss.seam.faces.context.FlashScopedExtension
\ No newline at end of file
+org.jboss.seam.faces.context.FlashScopedExtension
+org.jboss.seam.faces.context.FacesAnnotationsAdapterExtension
\ No newline at end of file
Added: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.jboss.seam.faces.context;
+
+import static org.junit.Assert.assertTrue;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ */
+(a)RunWith(Arquillian.class)
+public class FacesAnnotationsAdapterExtensionTest
+{
+
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ return Archives.create("test.jar", JavaArchive.class).addClasses(ImproperlyAnnotatedBean.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ }
+
+ @Test
+ public void testImproperlyAnnotatedClassIsCaptured()
+ {
+ assertTrue(FacesAnnotationsAdapterExtension.aliasedBeans.containsKey(ImproperlyAnnotatedBean.class));
+ }
+}
Added: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/ImproperlyAnnotatedBean.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -0,0 +1,15 @@
+/**
+ *
+ */
+package org.jboss.seam.faces.context;
+
+import javax.faces.bean.RequestScoped;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+@RequestScoped
+public class ImproperlyAnnotatedBean
+{
+}
Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -61,4 +61,82 @@
assertTrue(conversation.isTransient());
assertTrue(interceptedBean.isConversationLongRunningDuringInvocation2());
}
+
+ @Test
+ public void testConversationAbortsBeginOnFatalException()
+ {
+ assertTrue(conversation.isTransient());
+ assertFalse(interceptedBean.isConversationLongRunningDuringInvocation3());
+
+ try
+ {
+ interceptedBean.beginAndThrowFatalException();
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+
+ assertTrue(conversation.isTransient());
+ assertTrue(interceptedBean.isConversationLongRunningDuringInvocation3());
+ }
+
+ @Test
+ public void testConversationBeginsOnPermittedException()
+ {
+ assertTrue(conversation.isTransient());
+ assertFalse(interceptedBean.isConversationLongRunningDuringInvocation4());
+
+ try
+ {
+ interceptedBean.beginAndThrowPermittedException();
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+
+ assertFalse(conversation.isTransient());
+ assertTrue(interceptedBean.isConversationLongRunningDuringInvocation4());
+ }
+
+ @Test
+ public void testConversationAbortsEndOnFatalException()
+ {
+ assertTrue(conversation.isTransient());
+ assertFalse(interceptedBean.isConversationLongRunningDuringInvocation5());
+
+ try
+ {
+ interceptedBean.begin();
+ interceptedBean.endAndThrowFatalException();
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+
+ assertFalse(conversation.isTransient());
+ assertTrue(interceptedBean.isConversationLongRunningDuringInvocation5());
+ }
+
+ @Test
+ public void testConversationEndsOnPermittedException()
+ {
+ assertTrue(conversation.isTransient());
+ assertFalse(interceptedBean.isConversationLongRunningDuringInvocation6());
+
+ try
+ {
+ interceptedBean.begin();
+ interceptedBean.endAndThrowPermittedException();
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+
+ assertTrue(conversation.isTransient());
+ assertTrue(interceptedBean.isConversationLongRunningDuringInvocation6());
+ }
}
Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -7,6 +7,8 @@
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
+import org.jboss.seam.faces.SeamFacesException;
+
/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
@@ -17,11 +19,20 @@
@Inject
Conversation conversation;
- private boolean conversationLongRunningDuringInvocation = false;
-
+ private boolean conversationLongRunningDuringInvocation;
private boolean conversationLongRunningDuringInvocation2;
+ private boolean conversationLongRunningDuringInvocation3;
+ private boolean conversationLongRunningDuringInvocation4;
+ private boolean conversationLongRunningDuringInvocation5;
+ private boolean conversationLongRunningDuringInvocation6;
+
@Begin
+ public void begin()
+ {
+ }
+
+ @Begin
public void beginConversation()
{
if (!conversation.isTransient())
@@ -34,22 +45,80 @@
@End
public void beginAndEndConversation()
{
- conversationLongRunningDuringInvocation2 = true;
+ if (!conversation.isTransient())
+ {
+ conversationLongRunningDuringInvocation2 = true;
+ }
}
- public boolean isConversationLongRunningDuringInvocation2()
+ @Begin(permit = { SeamFacesException.class })
+ public void beginAndThrowFatalException()
{
- return conversationLongRunningDuringInvocation2;
+ if (!conversation.isTransient())
+ {
+ conversationLongRunningDuringInvocation3 = true;
+ }
+ throw new RuntimeException("A vanilla exception.");
}
- public void setConversationLongRunningDuringInvocation2(final boolean conversationLongRunningDuringInvocation2)
+ @Begin(permit = { SeamFacesException.class })
+ public void beginAndThrowPermittedException()
{
- this.conversationLongRunningDuringInvocation2 = conversationLongRunningDuringInvocation2;
+ if (!conversation.isTransient())
+ {
+ conversationLongRunningDuringInvocation4 = true;
+ }
+ throw new SeamFacesException("Just so it's not a vanilla Exception.");
}
+ @End(permit = { SeamFacesException.class })
+ public void endAndThrowFatalException()
+ {
+ if (!conversation.isTransient())
+ {
+ conversationLongRunningDuringInvocation5 = true;
+ }
+ throw new RuntimeException("A vanilla exception.");
+ }
+
+ @End(permit = { SeamFacesException.class })
+ public void endAndThrowPermittedException()
+ {
+ if (!conversation.isTransient())
+ {
+ conversationLongRunningDuringInvocation6 = true;
+ }
+ throw new SeamFacesException("A vanilla exception.");
+ }
+
public boolean isConversationLongRunningInsideMethodCall()
{
return conversationLongRunningDuringInvocation;
}
+ public boolean isConversationLongRunningDuringInvocation2()
+ {
+ return conversationLongRunningDuringInvocation2;
+ }
+
+ public boolean isConversationLongRunningDuringInvocation3()
+ {
+ return conversationLongRunningDuringInvocation3;
+ }
+
+ public boolean isConversationLongRunningDuringInvocation4()
+ {
+ return conversationLongRunningDuringInvocation4;
+ }
+
+ public boolean isConversationLongRunningDuringInvocation5()
+ {
+ return conversationLongRunningDuringInvocation5;
+ }
+
+ public boolean isConversationLongRunningDuringInvocation6()
+ {
+ return conversationLongRunningDuringInvocation6;
+ }
+
}
Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -16,4 +16,9 @@
{
}
+ @End(permit = { Exception.class })
+ public void endPermittingExceptions()
+ {
+
+ }
}
Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java 2010-03-30 20:34:51 UTC (rev 12332)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java 2010-03-30 22:44:07 UTC (rev 12333)
@@ -43,4 +43,20 @@
assertTrue(Annotations.hasAnnotation(end, Begin.class));
}
+ public void testGetAnnotationOnMethodDirectly() throws Exception
+ {
+ Method end = AnnotationTestObject.class.getMethod("end", new Class[] {});
+ End anno = Annotations.getAnnotation(end, End.class);
+
+ assertTrue(anno instanceof End);
+ }
+
+ public void testGetAnnotationOnMethodIndirectlyFromClass() throws Exception
+ {
+ Method end = AnnotationTestObject.class.getMethod("begin", new Class[] {});
+ Begin anno = Annotations.getAnnotation(end, Begin.class);
+
+ assertTrue(anno instanceof Begin);
+ }
+
}
14 years, 6 months
Seam SVN: r12332 - in modules/servlet/trunk: src/main/java/org/jboss/seam/servlet and 1 other directories.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-03-30 16:34:51 -0400 (Tue, 30 Mar 2010)
New Revision: 12332
Added:
modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/ContextualHttpRequest.java
modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java
modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpParam.java
Removed:
modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java
modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpParam.java
Modified:
modules/servlet/trunk/pom.xml
Log:
Moved stuff
ContextualHttpRequest proto
Stuff a bit broken but hey, the module hasn't been officially announced yet ;-)
Modified: modules/servlet/trunk/pom.xml
===================================================================
--- modules/servlet/trunk/pom.xml 2010-03-30 16:25:44 UTC (rev 12331)
+++ modules/servlet/trunk/pom.xml 2010-03-30 20:34:51 UTC (rev 12332)
@@ -37,6 +37,7 @@
<properties>
<arquillian.version>1.0.0.Alpha1</arquillian.version>
+ <weld.version>1.0.1-Final</weld.version>
</properties>
<repositories>
@@ -77,6 +78,11 @@
<artifactId>weld-extensions</artifactId>
<version>1.0.0.Alpha1</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>${weld.version}</version>
+ </dependency>
<!-- Test Dependencies -->
<dependency>
Added: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/ContextualHttpRequest.java
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/ContextualHttpRequest.java (rev 0)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/ContextualHttpRequest.java 2010-03-30 20:34:51 UTC (rev 12332)
@@ -0,0 +1,49 @@
+package org.jboss.seam.servlet;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.conversation.ConversationManager;
+import org.jboss.weld.servlet.ServletLifecycle;
+
+public abstract class ContextualHttpRequest
+{
+ private HttpServletRequest request;
+ private ServletLifecycle lifecycle;
+ private ConversationManager conversationManager;
+
+ public ContextualHttpRequest(HttpServletRequest request)
+ {
+ this.request = request;
+ lifecycle = new ServletLifecycle(Container.instance().services().get(ContextLifecycle.class));
+ }
+
+ public void run()
+ {
+ try
+ {
+ setup();
+ process();
+ }
+ finally
+ {
+ tearDown();
+ }
+ }
+
+ private void setup()
+ {
+ lifecycle.beginRequest(request);
+ String cid = request.getParameter("cid");
+ conversationManager.beginOrRestoreConversation(cid);
+ }
+
+ private void tearDown()
+ {
+ conversationManager.cleanupConversation();
+ lifecycle.endRequest(request);
+ }
+
+ protected abstract void process();
+}
Copied: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java (from rev 12262, modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java)
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java (rev 0)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpManager.java 2010-03-30 20:34:51 UTC (rev 12332)
@@ -0,0 +1,144 @@
+package org.jboss.seam.servlet;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+
+import org.jboss.seam.servlet.event.qualifier.AttributeAdded;
+import org.jboss.seam.servlet.event.qualifier.AttributeRemoved;
+import org.jboss.seam.servlet.event.qualifier.AttributeReplaced;
+import org.jboss.seam.servlet.event.qualifier.Created;
+import org.jboss.seam.servlet.event.qualifier.Destroyed;
+import org.jboss.seam.servlet.event.qualifier.Initialized;
+import org.slf4j.Logger;
+
+/**
+ * A manager for acquiring HTTP artifacts
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+@RequestScoped
+public class HttpManager
+{
+ private static final long serialVersionUID = 5191073522575178427L;
+
+ private HttpSession session;
+ private HttpServletRequest request;
+ private BeanManager beanManager;
+
+ @Inject
+ private Logger log;
+
+ protected void requestInitialized(@Observes @Initialized ServletRequestEvent e)
+ {
+ log.trace("Servlet request initialized with event #0", e);
+ request = (HttpServletRequest) e.getServletRequest();
+ }
+
+ protected void requestDestroyed(@Observes @Destroyed ServletRequestEvent e)
+ {
+ log.trace("Servlet request destroyed with event #0", e);
+ request = null;
+ }
+
+ protected void servletContextAttributeAdded(@Observes @AttributeAdded ServletContextAttributeEvent e)
+ {
+ if (BeanManager.class.getName().equals(e.getName()))
+ {
+ log.trace("Bean manager set in servlet context with event #0", e);
+ beanManager = (BeanManager) e.getValue();
+ }
+ }
+
+ protected void servletContextAttributeReplaced(@Observes @AttributeReplaced ServletContextAttributeEvent e)
+ {
+ if (BeanManager.class.getName().equals(e.getName()))
+ {
+ log.trace("Bean manager replaced in servlet context with event #0", e);
+ beanManager = (BeanManager) e.getValue();
+ }
+ }
+
+ protected void servletContextAttributeRemoved(@Observes @AttributeRemoved ServletContextAttributeEvent e)
+ {
+ if (BeanManager.class.getName().equals(e.getName()))
+ {
+ log.trace("Bean manager removed from servlet context with event #0", e);
+ beanManager = null;
+ }
+ }
+
+ protected void sessionInitialized(@Observes @Created HttpSessionEvent e)
+ {
+ log.trace("HTTP session initalized with event #0", e);
+ session = e.getSession();
+ }
+
+ protected void sessionDestroyed(@Observes @Destroyed HttpSessionEvent e)
+ {
+ log.trace("HTTP session destroyed with event #0", e);
+ session = null;
+ }
+
+ /**
+ * Returns the current HTTP session. Throws an {@link IllegalStateException}
+ * if the session is currently not set.
+ *
+ * @return The current HTTP session
+ */
+ public HttpSession getSession()
+ {
+ if (session == null)
+ {
+ throw new IllegalStateException("The HTTP session is currently not set");
+ }
+ return session;
+ }
+
+ /**
+ * Returns the current HTTP request. Throws an {@link IllegalStateException}
+ * if the request is currently not set.
+ *
+ * @return The current HTTP request
+ */
+ public HttpServletRequest getRequest()
+ {
+ if (request == null)
+ {
+ throw new IllegalStateException("The HTTP request is currently not set");
+ }
+ return request;
+ }
+
+ /**
+ * Returns the current CDI Bean Manager of the WAR. Throws an
+ * {@link IllegalStateException} if the manager is not set.
+ *
+ * @return The current HTTP request
+ */
+ public BeanManager getBeanManager()
+ {
+ if (beanManager == null)
+ {
+ throw new IllegalStateException("The Bean Manager is currently not set");
+ }
+ return beanManager;
+ }
+
+ @Produces
+ @HttpParam("")
+ String getParamValue(InjectionPoint ip)
+ {
+ return getRequest().getParameter(ip.getAnnotated().getAnnotation(HttpParam.class).value());
+ }
+
+}
Copied: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpParam.java (from rev 12262, modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpParam.java)
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpParam.java (rev 0)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/HttpParam.java 2010-03-30 20:34:51 UTC (rev 12332)
@@ -0,0 +1,27 @@
+package org.jboss.seam.servlet;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+
+/**
+ * Qualifies injection points that should have their values fetched from a HTTP request attribute
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target( { FIELD, PARAMETER, METHOD })
+public @interface HttpParam
+{
+ @Nonbinding
+ public String value();
+}
\ No newline at end of file
Deleted: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java 2010-03-30 16:25:44 UTC (rev 12331)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java 2010-03-30 20:34:51 UTC (rev 12332)
@@ -1,144 +0,0 @@
-package org.jboss.seam.servlet.event;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Inject;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletRequestEvent;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionEvent;
-
-import org.jboss.seam.servlet.event.qualifier.AttributeAdded;
-import org.jboss.seam.servlet.event.qualifier.AttributeRemoved;
-import org.jboss.seam.servlet.event.qualifier.AttributeReplaced;
-import org.jboss.seam.servlet.event.qualifier.Created;
-import org.jboss.seam.servlet.event.qualifier.Destroyed;
-import org.jboss.seam.servlet.event.qualifier.Initialized;
-import org.slf4j.Logger;
-
-/**
- * A manager for acquiring HTTP artifacts
- *
- * @author Nicklas Karlsson
- *
- */
-@RequestScoped
-public class HttpManager
-{
- private static final long serialVersionUID = 5191073522575178427L;
-
- private HttpSession session;
- private HttpServletRequest request;
- private BeanManager beanManager;
-
- @Inject
- private Logger log;
-
- protected void requestInitialized(@Observes @Initialized ServletRequestEvent e)
- {
- log.trace("Servlet request initialized with event #0", e);
- request = (HttpServletRequest) e.getServletRequest();
- }
-
- protected void requestDestroyed(@Observes @Destroyed ServletRequestEvent e)
- {
- log.trace("Servlet request destroyed with event #0", e);
- request = null;
- }
-
- protected void servletContextAttributeAdded(@Observes @AttributeAdded ServletContextAttributeEvent e)
- {
- if (BeanManager.class.getName().equals(e.getName()))
- {
- log.trace("Bean manager set in servlet context with event #0", e);
- beanManager = (BeanManager) e.getValue();
- }
- }
-
- protected void servletContextAttributeReplaced(@Observes @AttributeReplaced ServletContextAttributeEvent e)
- {
- if (BeanManager.class.getName().equals(e.getName()))
- {
- log.trace("Bean manager replaced in servlet context with event #0", e);
- beanManager = (BeanManager) e.getValue();
- }
- }
-
- protected void servletContextAttributeRemoved(@Observes @AttributeRemoved ServletContextAttributeEvent e)
- {
- if (BeanManager.class.getName().equals(e.getName()))
- {
- log.trace("Bean manager removed from servlet context with event #0", e);
- beanManager = null;
- }
- }
-
- protected void sessionInitialized(@Observes @Created HttpSessionEvent e)
- {
- log.trace("HTTP session initalized with event #0", e);
- session = e.getSession();
- }
-
- protected void sessionDestroyed(@Observes @Destroyed HttpSessionEvent e)
- {
- log.trace("HTTP session destroyed with event #0", e);
- session = null;
- }
-
- /**
- * Returns the current HTTP session. Throws an {@link IllegalStateException}
- * if the session is currently not set.
- *
- * @return The current HTTP session
- */
- public HttpSession getSession()
- {
- if (session == null)
- {
- throw new IllegalStateException("The HTTP session is currently not set");
- }
- return session;
- }
-
- /**
- * Returns the current HTTP request. Throws an {@link IllegalStateException}
- * if the request is currently not set.
- *
- * @return The current HTTP request
- */
- public HttpServletRequest getRequest()
- {
- if (request == null)
- {
- throw new IllegalStateException("The HTTP request is currently not set");
- }
- return request;
- }
-
- /**
- * Returns the current CDI Bean Manager of the WAR. Throws an
- * {@link IllegalStateException} if the manager is not set.
- *
- * @return The current HTTP request
- */
- public BeanManager getBeanManager()
- {
- if (beanManager == null)
- {
- throw new IllegalStateException("The Bean Manager is currently not set");
- }
- return beanManager;
- }
-
- @Produces
- @HttpParam("")
- String getParamValue(InjectionPoint ip)
- {
- return getRequest().getParameter(ip.getAnnotated().getAnnotation(HttpParam.class).value());
- }
-
-}
Deleted: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpParam.java
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpParam.java 2010-03-30 16:25:44 UTC (rev 12331)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpParam.java 2010-03-30 20:34:51 UTC (rev 12332)
@@ -1,27 +0,0 @@
-package org.jboss.seam.servlet.event;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.util.Nonbinding;
-import javax.inject.Qualifier;
-
-/**
- * Qualifies injection points that should have their values fetched from a HTTP request attribute
- *
- * @author Nicklas Karlsson
- *
- */
-@Qualifier
-@Retention(RUNTIME)
-@Target( { FIELD, PARAMETER, METHOD })
-public @interface HttpParam
-{
- @Nonbinding
- public String value();
-}
\ No newline at end of file
14 years, 6 months
Seam SVN: r12331 - branches/community/Seam_2_2/examples/tasks/view.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-03-30 12:25:44 -0400 (Tue, 30 Mar 2010)
New Revision: 12331
Modified:
branches/community/Seam_2_2/examples/tasks/view/seam-tasks-client.js
Log:
JBSEAM-4624
Modified: branches/community/Seam_2_2/examples/tasks/view/seam-tasks-client.js
===================================================================
--- branches/community/Seam_2_2/examples/tasks/view/seam-tasks-client.js 2010-03-30 16:22:05 UTC (rev 12330)
+++ branches/community/Seam_2_2/examples/tasks/view/seam-tasks-client.js 2010-03-30 16:25:44 UTC (rev 12331)
@@ -1,3 +1,7 @@
+$(document).ready(function() {
+ $.ajaxSetup({ cache: false }); // workaround for IE
+})
+
function getCategories(callback) {
$.get("seam/resource/v1/auth/category", callback);
}
14 years, 6 months
Seam SVN: r12330 - branches/enterprise/JBPAPP_5_0/examples/tasks/view.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-03-30 12:22:05 -0400 (Tue, 30 Mar 2010)
New Revision: 12330
Modified:
branches/enterprise/JBPAPP_5_0/examples/tasks/view/seam-tasks-client.js
Log:
JBPAPP-4012
Modified: branches/enterprise/JBPAPP_5_0/examples/tasks/view/seam-tasks-client.js
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/tasks/view/seam-tasks-client.js 2010-03-30 15:02:22 UTC (rev 12329)
+++ branches/enterprise/JBPAPP_5_0/examples/tasks/view/seam-tasks-client.js 2010-03-30 16:22:05 UTC (rev 12330)
@@ -1,3 +1,7 @@
+$(document).ready(function() {
+ $.ajaxSetup({ cache: false }); // workaround for IE
+})
+
function getCategories(callback) {
$.get("seam/resource/v1/auth/category", callback);
}
14 years, 6 months
Seam SVN: r12329 - branches/community/Seam_2_2/build.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-03-30 11:02:22 -0400 (Tue, 30 Mar 2010)
New Revision: 12329
Modified:
branches/community/Seam_2_2/build/core.pom.xml
branches/community/Seam_2_2/build/excel.pom.xml
branches/community/Seam_2_2/build/mail.pom.xml
branches/community/Seam_2_2/build/resteasy.pom.xml
branches/community/Seam_2_2/build/ui.pom.xml
Log:
other files changed with new version of testng (5.10)
Modified: branches/community/Seam_2_2/build/core.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/core.pom.xml 2010-03-30 14:47:41 UTC (rev 12328)
+++ branches/community/Seam_2_2/build/core.pom.xml 2010-03-30 15:02:22 UTC (rev 12329)
@@ -291,6 +291,7 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${version.testng}</version>
+ <classifier>jdk15</classifier>
<optional>true</optional>
<exclusions>
<exclusion>
Modified: branches/community/Seam_2_2/build/excel.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/excel.pom.xml 2010-03-30 14:47:41 UTC (rev 12328)
+++ branches/community/Seam_2_2/build/excel.pom.xml 2010-03-30 15:02:22 UTC (rev 12329)
@@ -63,6 +63,7 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${version.testng}</version>
+ <classifier>jdk15</classifier>
<optional>true</optional>
<exclusions>
<exclusion>
Modified: branches/community/Seam_2_2/build/mail.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/mail.pom.xml 2010-03-30 14:47:41 UTC (rev 12328)
+++ branches/community/Seam_2_2/build/mail.pom.xml 2010-03-30 15:02:22 UTC (rev 12329)
@@ -69,6 +69,7 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${version.testng}</version>
+ <classifier>jdk15</classifier>
<optional>true</optional>
<exclusions>
<exclusion>
Modified: branches/community/Seam_2_2/build/resteasy.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/resteasy.pom.xml 2010-03-30 14:47:41 UTC (rev 12328)
+++ branches/community/Seam_2_2/build/resteasy.pom.xml 2010-03-30 15:02:22 UTC (rev 12329)
@@ -70,6 +70,7 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${version.testng}</version>
+ <classifier>jdk15</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
Modified: branches/community/Seam_2_2/build/ui.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/ui.pom.xml 2010-03-30 14:47:41 UTC (rev 12328)
+++ branches/community/Seam_2_2/build/ui.pom.xml 2010-03-30 15:02:22 UTC (rev 12329)
@@ -192,6 +192,7 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${version.testng}</version>
+ <classifier>jdk15</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
14 years, 6 months
Seam SVN: r12328 - branches/community/Seam_2_2/build.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-03-30 10:47:41 -0400 (Tue, 30 Mar 2010)
New Revision: 12328
Modified:
branches/community/Seam_2_2/build/root.pom.xml
Log:
version of testng changed to 5.10
Modified: branches/community/Seam_2_2/build/root.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/root.pom.xml 2010-03-30 13:53:39 UTC (rev 12327)
+++ branches/community/Seam_2_2/build/root.pom.xml 2010-03-30 14:47:41 UTC (rev 12328)
@@ -41,7 +41,7 @@
<version.richfaces>3.3.3.CR1</version.richfaces>
<version.wicket>1.3.5.jboss1</version.wicket>
<version.drools>5.0.1</version.drools>
- <version.testng>5.9</version.testng>
+ <version.testng>5.10</version.testng>
<version.resteasy>1.2.1.GA</version.resteasy>
</properties>
14 years, 6 months
Seam SVN: r12327 - branches/enterprise/JBPAPP_5_0/examples.
by seam-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2010-03-30 09:53:39 -0400 (Tue, 30 Mar 2010)
New Revision: 12327
Modified:
branches/enterprise/JBPAPP_5_0/examples/readme.txt
Log:
JBPAPP-4034
Modified: branches/enterprise/JBPAPP_5_0/examples/readme.txt
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/readme.txt 2010-03-30 11:05:52 UTC (rev 12326)
+++ branches/enterprise/JBPAPP_5_0/examples/readme.txt 2010-03-30 13:53:39 UTC (rev 12327)
@@ -143,18 +143,25 @@
1. Install the TestNG Eclipse plugin from http://beust.com/eclipse
-2. Create the TestNG runner with the following directories added to the
- classpath:
-
- examples/${example.name}/src/
- examples/${example.name}/resources/
- bootstrap/
-
- And all jar files from the following directories in your classpath:
-
- lib/test
-
- Make sure all these come before the referenced libraries
-
-3. Locate and run the testng.xml file using the TestNG plugin
+2. From the example's home directory (e.g. booking for the booking example), run ant test.
+3. In Eclipse, click on File > New > Project....
+
+4. Select Java Project from Existing Ant Buildfile from the New Project Wizard, and click Next.
+
+5. Select the example's build.xml file as the base for the new Java project.
+
+6. Select Testing Suite or Testing Class.
+
+7. From the Run As menu, choose TestNG Test. You can cancel the processing of the test run at any time.
+
+8. Go to Run > Run configurations and edit the created TestNG runner.
+
+9. If JDK 1.6 is used as runtime, add the following JVM argument on the Arguments tab:
+
+ -Dsun.lang.ClassLoader.allowArraySyntax=true
+
+10. Go to the Classpath tab and remove all User entries.
+
+11. Add the JARs and folders specified by http://seamframework.org/Community/GettingStartedDevelopingTheSeamFramewo....
+
14 years, 6 months