Seam SVN: r9666 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-11-26 15:49:02 -0500 (Wed, 26 Nov 2008)
New Revision: 9666
Modified:
trunk/src/main/org/jboss/seam/pages-2.1.xsd
Log:
JBSEAM-3742
Modified: trunk/src/main/org/jboss/seam/pages-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-11-26 17:18:04 UTC (rev 9665)
+++ trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-11-26 20:49:02 UTC (rev 9666)
@@ -218,7 +218,7 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.navigation">
- <xs:attribute name="from-action" type="pages:method-expression" />
+ <xs:attribute name="from-action" type="pages:from-action-expression" />
<xs:attribute name="evaluate" type="pages:method-expression" />
</xs:attributeGroup>
@@ -473,6 +473,12 @@
<xs:enumeration value="http"/>
</xs:restriction>
</xs:simpleType>
+
+ <xs:simpleType name="outcome">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[^\#\{\}]+"/>
+ </xs:restriction>
+ </xs:simpleType>
<xs:simpleType name="view-id">
<xs:restriction base="xs:string">
@@ -484,6 +490,10 @@
<xs:union memberTypes="pages:view-id pages:method-expression"></xs:union>
</xs:simpleType>
+ <xs:simpleType name="from-action-expression">
+ <xs:union memberTypes="pages:outcome pages:method-expression"></xs:union>
+ </xs:simpleType>
+
<xs:simpleType name="ableness">
<xs:restriction base="xs:token">
<xs:enumeration value="enabled"/>
@@ -605,7 +615,7 @@
<xs:simpleType name="method-expression">
<xs:restriction base="xs:token">
- <xs:pattern value="#\{.*\}"/>
+ <xs:pattern value="#\{.+\..+\}"/>
</xs:restriction>
</xs:simpleType>
16 years, 2 months
Seam SVN: r9665 - trunk/build.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-11-26 12:18:04 -0500 (Wed, 26 Nov 2008)
New Revision: 9665
Modified:
trunk/build/ci.build.xml
Log:
oops, Ant does not reset its own properties when inheritAll="false"
Modified: trunk/build/ci.build.xml
===================================================================
--- trunk/build/ci.build.xml 2008-11-26 17:13:35 UTC (rev 9664)
+++ trunk/build/ci.build.xml 2008-11-26 17:18:04 UTC (rev 9665)
@@ -104,6 +104,9 @@
<element name="properties" optional="true" />
<sequential>
<ant antfile="${seam.dir}/build.xml" target="@{target}" inheritall="false" inheritrefs="false" dir="../">
+ <propertyset>
+ <propertyref name="ant.version"/>
+ </propertyset>
<property name="dist.location" value="${dist.location}" />
<property name="qualifier" value="-SNAPSHOT" />
<property name="quietclean" value="true" />
16 years, 2 months
Seam SVN: r9664 - in trunk/examples: openid and 10 other directories.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-11-26 12:13:35 -0500 (Wed, 26 Nov 2008)
New Revision: 9664
Added:
trunk/examples/openid/
trunk/examples/openid/build.xml
trunk/examples/openid/resources/
trunk/examples/openid/resources/META-INF/
trunk/examples/openid/resources/META-INF/application.xml
trunk/examples/openid/resources/META-INF/ejb-jar.xml
trunk/examples/openid/resources/META-INF/jboss-app.xml
trunk/examples/openid/resources/META-INF/persistence.xml
trunk/examples/openid/resources/WEB-INF/
trunk/examples/openid/resources/WEB-INF/components.xml
trunk/examples/openid/resources/WEB-INF/faces-config.xml
trunk/examples/openid/resources/WEB-INF/pages.xml
trunk/examples/openid/resources/WEB-INF/web.xml
trunk/examples/openid/resources/components.properties
trunk/examples/openid/resources/import.sql
trunk/examples/openid/resources/jboss-seam-openid-ds.xml
trunk/examples/openid/resources/seam.properties
trunk/examples/openid/src/
trunk/examples/openid/src/org/
trunk/examples/openid/src/org/jboss/
trunk/examples/openid/src/org/jboss/seam/
trunk/examples/openid/src/org/jboss/seam/example/
trunk/examples/openid/src/org/jboss/seam/example/openid/
trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java
trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java
trunk/examples/openid/view/
trunk/examples/openid/view/index.html
trunk/examples/openid/view/login-bg.gif
trunk/examples/openid/view/main.xhtml
Log:
JBSEAM-2655
Added: trunk/examples/openid/build.xml
===================================================================
--- trunk/examples/openid/build.xml (rev 0)
+++ trunk/examples/openid/build.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<project name="openid" default="deploy" basedir=".">
+
+ <!-- Naming -->
+ <property name="Name" value="Seam OpenID Example"/>
+ <property name="example.name" value="jboss-seam-openid"/>
+
+ <!-- Libraries to include -->
+ <property name="seam.ui.lib" value="yes"/>
+ <property name="seam.debug.lib" value="yes"/>
+ <property name="facelets.lib" value="yes"/>
+ <property name="richfaces.lib" value="yes"/>
+
+ <property name="openid.lib" value="yes"/>
+
+ <!-- Datasource -->
+ <property name="example.ds" value="jboss-seam-openid-ds.xml"/>
+ <import file="../build.xml"/>
+
+</project>
Added: trunk/examples/openid/resources/META-INF/application.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/application.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/application.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+ version="5">
+
+ <display-name>Seam Openid</display-name>
+
+ <module>
+ <web>
+ <web-uri>jboss-seam-openid.war</web-uri>
+ <context-root>/seam-openid</context-root>
+ </web>
+ </module>
+
+ <module>
+ <ejb>jboss-seam-openid.jar</ejb>
+ </module>
+
+ <module>
+ <ejb>jboss-seam.jar</ejb>
+ </module>
+
+</application>
Added: trunk/examples/openid/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/ejb-jar.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/ejb-jar.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Added: trunk/examples/openid/resources/META-INF/jboss-app.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/jboss-app.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/jboss-app.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE jboss-app
+ PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
+
+<jboss-app>
+ <loader-repository>
+ seam.jboss.org:loader=seam-openid
+ </loader-repository>
+</jboss-app>
Added: trunk/examples/openid/resources/META-INF/persistence.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/persistence.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/persistence.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="openidDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/openidDatasource</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="jboss.entity.manager.factory.jndi.name"
+ value="java:/openidEntityManagerFactory"/>
+ </properties>
+ </persistence-unit>
+</persistence>
+
+
Added: trunk/examples/openid/resources/WEB-INF/components.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/components.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/components.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:persistence="http://jboss.com/products/seam/persistence"
+ xmlns:security="http://jboss.com/products/seam/security" xmlns:framework="http://jboss.com/products/seam/framework"
+ xmlns:transaction="http://jboss.com/products/seam/transaction"
+ xmlns:international="http://jboss.com/products/seam/international"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.com/products/seam/core /Users/orb/proj/jboss/seam/trunk/src/main/org/jboss/seam/core-2.1.xsd
+ http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
+ http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.1.xsd
+ http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
+ http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
+
+ <core:init jndi-pattern="@jndiPattern@" debug="true"/>
+
+ <core:manager conversation-timeout="1200000" concurrent-request-timeout="50000" conversation-id-parameter="cid"/>
+
+ <transaction:ejb-transaction/>
+
+ <security:identity authenticate-method="#{authenticator.authenticate}"/>
+
+ <persistence:managed-persistence-context name="entityManager" auto-create="true"
+ persistence-unit-jndi-name="java:/openidEntityManagerFactory"/>
+
+ <component name="newpost" class="org.jboss.seam.example.openid.Post">
+ <property name="createDate">#{currentDate}</property>
+ <property name="creator">#{openid.validatedId}</property>
+ </component>
+
+ <framework:entity-query name="posts">
+ <framework:ejbql>select p from Post p</framework:ejbql>
+ </framework:entity-query>
+
+ <framework:entity-home name="postHome" entity-class="org.jboss.seam.example.openid.Post" new-instance="#{newpost}"/>
+
+
+ <event type="org.jboss.seam.security.loggedOut">
+ <action execute="#{openid.logout}" />
+ </event>
+ <!-- not used here -->
+ <event type="org.jboss.seam.openid.ok">
+ <action execute="#{openid.loginImmediately}"/>
+ <!--
+ <action execute="#{redirect.returnToCapturedView}" />
+ -->
+ </event>
+</components>
Added: trunk/examples/openid/resources/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/faces-config.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/faces-config.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<faces-config version="1.2"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-faces
+config_1_2.xsd">
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+ <lifecycle>
+ <phase-listener>org.jboss.seam.security.openid.OpenIdPhaseListener</phase-listener>
+ </lifecycle>
+</faces-config>
+
Added: trunk/examples/openid/resources/WEB-INF/pages.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/pages.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/pages.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pages xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
+ no-conversation-view-id="/main.xhtml" login-view-id="/home.xhtml">
+
+ <page view-id="/openid.xhtml">
+ <navigation evaluate="#{openid.loginImmediately()}">
+ <rule if-outcome="true">
+ <redirect view-id="/main.xhtml">
+ <message>Welcome #{openid.validatedId}</message>
+ </redirect>
+ </rule>
+ <rule if-outcome="false">
+ <redirect view-id="/main.xhtml">
+ <message>OpenID login failed...</message>
+ </redirect>
+ </rule>
+ </navigation>
+ </page>
+
+ <page view-id="/main.xhtml">
+ <navigation from-action="#{postHome.persist}" evaluate="#{postHome.clearInstance()}">
+ <redirect />
+ </navigation>
+ </page>
+
+ <exception class="org.jboss.seam.security.NotLoggedInException">
+ <redirect view-id="/home.xhtml">
+ <message severity="warn">You must be logged in to use this feature</message>
+ </redirect>
+ </exception>
+
+</pages>
Added: trunk/examples/openid/resources/WEB-INF/web.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/web.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/web.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>Seam openid Example</display-name>
+
+ <!-- Seam -->
+
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <url-pattern>/seam/resource/*</url-pattern>
+ </servlet-mapping>
+
+ <filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+ <context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>emeraldTown</param-value>
+ </context-param>
+
+ <!-- JSF -->
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
Added: trunk/examples/openid/resources/components.properties
===================================================================
--- trunk/examples/openid/resources/components.properties (rev 0)
+++ trunk/examples/openid/resources/components.properties 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,3 @@
+# The pattern in components.xml is replaced by an application server specific value in the ant build. This value is used for running tests
+
+jndiPattern \#{ejbName}/local
\ No newline at end of file
Added: trunk/examples/openid/resources/import.sql
===================================================================
--- trunk/examples/openid/resources/import.sql (rev 0)
+++ trunk/examples/openid/resources/import.sql 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1 @@
+insert into post (creator,message,createDate) values ('http://maximoburrito.myopenid.com/','This is too cool',now());
Added: trunk/examples/openid/resources/jboss-seam-openid-ds.xml
===================================================================
--- trunk/examples/openid/resources/jboss-seam-openid-ds.xml (rev 0)
+++ trunk/examples/openid/resources/jboss-seam-openid-ds.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>openidDatasource</jndi-name>
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+</datasources>
+
Added: trunk/examples/openid/resources/seam.properties
===================================================================
Added: trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java
===================================================================
--- trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java (rev 0)
+++ trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,23 @@
+package org.jboss.seam.example.openid;
+
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.security.openid.*;
+
+@Name("authenticator")
+public class Auth
+{
+ @In(create=false) OpenId openid;
+
+ public boolean authenticate()
+ {
+ System.out.println("AUTH: " + openid + "-" + openid.getValidatedId());
+
+ return true;
+ }
+
+
+ public boolean authenticateOpenID() {
+ return true;
+ }
+
+}
Added: trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java
===================================================================
--- trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java (rev 0)
+++ trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,56 @@
+package org.jboss.seam.example.openid;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+
+
+@Entity
+@Table(name="post")
+public class Post {
+ long id;
+ String creator;
+ String message;
+ Date createDate;
+
+ @Id
+ @GeneratedValue
+ @Column(name="id")
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name="creator")
+ public String getCreator() {
+ return creator;
+ }
+ public void setCreator(String creator) {
+ this.creator = creator;
+ }
+
+ @Column(name="message")
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+
+ @Column(name="createDate")
+ public Date getCreateDate() {
+ return createDate;
+ }
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+}
Added: trunk/examples/openid/view/index.html
===================================================================
--- trunk/examples/openid/view/index.html (rev 0)
+++ trunk/examples/openid/view/index.html 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=main.seam">
+</head>
+</html>
Added: trunk/examples/openid/view/login-bg.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/openid/view/login-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/openid/view/main.xhtml
===================================================================
--- trunk/examples/openid/view/main.xhtml (rev 0)
+++ trunk/examples/openid/view/main.xhtml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,98 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition 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:rich="http://richfaces.org/rich"
+ xmlns:s="http://jboss.com/products/seam/taglib" xmlns:a="http://richfaces.org/a4j">
+
+<html>
+ <head>
+ <title>OpenID Wall</title>
+ <style type="text/css">
+.openid_input {
+ background: #fff url("login-bg.gif") no-repeat;
+ border: 1px solid #666;
+ width: 232px;
+ padding-left: 18px;
+}
+ </style>
+
+
+ </head>
+ <body>
+
+ <div id="top">
+
+
+
+ <rich:toolBar height="34" itemSeparator="line">
+ <rich:toolBarGroup>
+ <h:outputLabel value="OpenId Wall Demo" />
+ </rich:toolBarGroup>
+
+ <rich:toolBarGroup location="right">
+ <s:div rendered="#{!identity.loggedIn}">
+ <h:form>
+ <h:inputText value="#{openid.id}" styleClass="openid_input"/>
+ <h:commandButton action="#{openid.login}" value="OpenID Login"/>
+ </h:form>
+ </s:div>
+ <s:div rendered="#{identity.loggedIn}">
+ <h:form>
+ <h:outputLabel value="#{openid.validatedId}" />
+ <h:commandButton action="#{identity.logout}" value="Logout"/>
+ </h:form>
+ </s:div>
+ </rich:toolBarGroup>
+ </rich:toolBar>
+ </div>
+
+ <rich:panel>
+ <f:facet name="header">About the Demo</f:facet>
+ <rich:modalPanel id="panel" width="350" height="100">
+ <f:facet name="header">
+ <h:panelGroup>OpenID</h:panelGroup>
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/modal/close.png" style="cursor:pointer" id="hidelink"/>
+ <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+
+ OpenID is cool...
+ </rich:modalPanel>
+
+
+
+ <rich:messages />
+
+ <h:outputLink value="#" id="link">
+ Learn more about OpenID
+ <rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
+ </h:outputLink>
+ </rich:panel>
+
+
+
+ <rich:panel rendered="#{identity.loggedIn}">
+ <f:facet name="header">New Post</f:facet>
+
+ <h:form>
+ <h:inputText value="#{postHome.instance.message}" required="true" />
+ <h:commandButton value="Post" action="#{postHome.persist}" />
+ </h:form>
+ </rich:panel>
+
+
+ <rich:panel>
+ <f:facet name="header">Wall Posts</f:facet>
+ <ui:repeat value="#{posts.resultList}" var="post">
+ <rich:panel>
+ #{post.message}
+ <br />
+ #{post.creator} -- #{post.createDate}
+ </rich:panel>
+ </ui:repeat>
+ </rich:panel>
+ </body>
+</html>
+</ui:composition>
16 years, 2 months
Seam SVN: r9663 - in trunk/src/main: org/jboss/seam/security/openid and 1 other directory.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-11-26 11:56:36 -0500 (Wed, 26 Nov 2008)
New Revision: 9663
Modified:
trunk/src/main/META-INF/components.xml
trunk/src/main/org/jboss/seam/security/openid/OpenId.java
Log:
cleanup openid
Modified: trunk/src/main/META-INF/components.xml
===================================================================
--- trunk/src/main/META-INF/components.xml 2008-11-26 16:27:07 UTC (rev 9662)
+++ trunk/src/main/META-INF/components.xml 2008-11-26 16:56:36 UTC (rev 9663)
@@ -18,6 +18,7 @@
<import>org.jboss.seam.security</import>
<import>org.jboss.seam.security.management</import>
<import>org.jboss.seam.security.permission</import>
+ <import>org.jboss.seam.security.openid</import>
<import>org.jboss.seam.captcha</import>
<import>org.jboss.seam.excel.exporter</import>
Modified: trunk/src/main/org/jboss/seam/security/openid/OpenId.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/openid/OpenId.java 2008-11-26 16:27:07 UTC (rev 9662)
+++ trunk/src/main/org/jboss/seam/security/openid/OpenId.java 2008-11-26 16:56:36 UTC (rev 9663)
@@ -29,10 +29,11 @@
import org.openid4java.message.ax.FetchRequest;
import org.openid4java.message.ax.FetchResponse;
-@Name("openid")
+@Name("org.jboss.seam.security.openid.openid")
@Install(precedence=Install.BUILT_IN, classDependencies="org.openid4java.consumer.ConsumerManager")
@Scope(ScopeType.SESSION)
-public class OpenId implements Serializable
+public class OpenId
+ implements Serializable
{
String id;
String validatedId;
@@ -45,6 +46,9 @@
throws ConsumerException
{
manager = new ConsumerManager();
+ discovered = null;
+ id = null;
+ validatedId = null;
}
@@ -68,13 +72,10 @@
throws IOException
{
validatedId = null;
-
String returnToUrl = returnToUrl();
- System.out.println("return to " + returnToUrl);
String url = authRequest(id, returnToUrl);
- System.out.println("auth to --> " + url);
-
+
Redirect redirect = Redirect.instance();
redirect.captureCurrentView();
@@ -111,7 +112,6 @@
authReq.addExtension(fetch);
return authReq.getDestinationUrl(true);
- // httpResp.sendRedirect(authReq.getDestinationUrl(true));
} catch (OpenIDException e) {
e.printStackTrace();
}
@@ -129,7 +129,6 @@
public boolean loginImmediately() {
- System.out.println("* LOGIN IMMEDIATELY! " + validatedId);
if (validatedId !=null) {
Identity.instance().acceptExternallyAuthenticatedPrincipal((new OpenIdPrincipal(validatedId)));
return true;
@@ -139,11 +138,10 @@
}
public boolean isValid() {
- System.out.println("is valid?" + validatedId);
return validatedId != null;
}
- public String validatedId() {
+ public String getValidatedId() {
return validatedId;
}
@@ -155,10 +153,7 @@
// (which comes in as a HTTP request from the OpenID provider)
ParameterList response =
new ParameterList(httpReq.getParameterMap());
-
-
- System.out.println("DISCOVERED IS " + discovered);
-
+
// extract the receiving URL from the HTTP request
StringBuffer receivingURL = httpReq.getRequestURL();
String queryString = httpReq.getQueryString();
@@ -177,6 +172,7 @@
AuthSuccess authSuccess =
(AuthSuccess) verification.getAuthResponse();
+ System.out.println("*** EXT: " + authSuccess.getExtensions());
if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
FetchResponse fetchResp = (FetchResponse) authSuccess
.getExtension(AxMessage.OPENID_NS_AX);
@@ -195,4 +191,9 @@
return null;
}
+ public void logout()
+ throws ConsumerException
+ {
+ init();
+ }
}
16 years, 2 months
Seam SVN: r9662 - trunk.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-11-26 11:27:07 -0500 (Wed, 26 Nov 2008)
New Revision: 9662
Modified:
trunk/build.xml
Log:
JBSEAM-3386 - require Ant 1.7.0 to build Seam
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-11-26 10:24:31 UTC (rev 9661)
+++ trunk/build.xml 2008-11-26 16:27:07 UTC (rev 9662)
@@ -1,6 +1,13 @@
<?xml version="1.0"?>
<project name="Seam" default="build" basedir="." xmlns:artifact="urn:maven-artifact-ant">
+ <!-- Check that we are using Ant 1.7.0. Not using <antversion> as it wasn't available until 1.7.0. -->
+ <condition property="compatible.ant">
+ <contains string="${ant.version}" substring="1.7.0"/>
+ </condition>
+
+ <fail unless="compatible.ant">You must use Ant 1.7.0 to build Seam. Ant 1.7.1 has known bugs.</fail>
+
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="JBoss Seam" />
<property name="name" value="jboss-seam" />
16 years, 2 months
Seam SVN: r9661 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-11-26 05:24:31 -0500 (Wed, 26 Nov 2008)
New Revision: 9661
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Security.xml
Log:
Fix incorrect description of PermissionResolver.filterSetByAction()
Modified: trunk/doc/Seam_Reference_Guide/en-US/Security.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Security.xml 2008-11-26 08:06:45 UTC (rev 9660)
+++ trunk/doc/Seam_Reference_Guide/en-US/Security.xml 2008-11-26 10:24:31 UTC (rev 9661)
@@ -3199,8 +3199,8 @@
</entry>
<entry>
<para>
- This method should remove any objects from the specified set, that would otherwise
- return <literal>false</literal> if passed to the <literal>hasPermission()</literal> method with the
+ This method should remove any objects from the specified set, that would
+ return <literal>true</literal> if passed to the <literal>hasPermission()</literal> method with the
same <literal>action</literal> parameter value.
</para>
</entry>
16 years, 2 months
Seam SVN: r9660 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-11-26 03:06:45 -0500 (Wed, 26 Nov 2008)
New Revision: 9660
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml
Log:
JBSEAM-3034 - additional notes
Modified: trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml 2008-11-26 07:57:13 UTC (rev 9659)
+++ trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml 2008-11-26 08:06:45 UTC (rev 9660)
@@ -489,9 +489,10 @@
]]></programlisting>
<para> Assuming your EJB bean class is deployed in an EAR named myapp, the global JNDI name
- myapp/AuthenticatorBean/local will be assigned to it. As you learned, you can reference this EJB
- component as a Seam component with the name <literal>authenticator</literal> and Seam will take care of
- finding it in JNDI according to the JNDI pattern (or <literal>@JndiName</literal> annotation). </para>
+ myapp/AuthenticatorBean/local will be assigned to it on JBoss AS. As you learned, you can reference this
+ EJB component as a Seam component with the name <literal>authenticator</literal> and Seam will take care
+ of finding it in JNDI according to the JNDI pattern (or <literal>@JndiName</literal> annotation).
+ </para>
<para> So what about the rest of the application servers? Well, according to the Java EE spec, which most
vendors try to adhere to religiously, you have to declare an EJB reference for your EJB in order for it
@@ -499,10 +500,10 @@
JNDI naming convention so that you can leverage the Seam JNDI pattern. You might find the JBoss
convention a good one to follow.</para>
- <para> There are two places you have to define the EJB reference. If you are going to be looking up the
- Seam EJB component through JSF (in a JSF view or as a JSF action listener) or a Seam JavaBean component,
- then you must declare the EJB reference in web.xml. Here is the EJB reference for the example component
- just shown: </para>
+ <para> There are two places you have to define the EJB reference when using Seam on non-JBoss application
+ servers. If you are going to be looking up the Seam EJB component through JSF (in a JSF view or as a JSF
+ action listener) or a Seam JavaBean component, then you must declare the EJB reference in web.xml. Here
+ is the EJB reference for the example component just shown: </para>
<programlisting role="XML"><![CDATA[<ejb-local-ref>
<ejb-ref-name>myapp/AuthenticatorBean/local</ejb-ref-name>
@@ -521,7 +522,8 @@
<literal>@In</literal>, it isn't going to be successful looking up the component in JNDI. You cannot
simply resolve JNDI names as you please. You have to define those references explicitly. Unlike with the
web context, however, you cannot declare EJB references globally for all EJB components. Instead, you
- have to specify the JNDI resources for a given EJB component one-by-one.</para>
+ have to specify the JNDI resources for a given EJB component one-by-one (this applies to JBoss AS 5 in
+ addition to non-JBoss application servers).</para>
<para> Let's assume that we have an EJB named RegisterAction (the name is resolved using the three steps
mentioned previously). That EJB has the following Seam injection:</para>
16 years, 2 months
Seam SVN: r9659 - in trunk/examples/jee5: booking/resources/WEB-INF and 3 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-11-26 02:57:13 -0500 (Wed, 26 Nov 2008)
New Revision: 9659
Modified:
trunk/examples/jee5/booking/resources/META-INF/application.xml
trunk/examples/jee5/booking/resources/META-INF/ejb-jar.xml
trunk/examples/jee5/booking/resources/WEB-INF/web.xml
trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/Authenticator.java
trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java
trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/BookingListAction.java
trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/ChangePasswordAction.java
trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelBookingAction.java
trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelSearchingAction.java
trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/RegisterAction.java
trunk/examples/jee5/remoting/resources/META-INF/application.xml
trunk/examples/jee5/remoting/resources/WEB-INF/web.xml
Log:
JBSEAM-3034
Modified: trunk/examples/jee5/booking/resources/META-INF/application.xml
===================================================================
--- trunk/examples/jee5/booking/resources/META-INF/application.xml 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/resources/META-INF/application.xml 2008-11-26 07:57:13 UTC (rev 9659)
@@ -8,12 +8,12 @@
<module>
<web>
- <web-uri>jboss-seam-jee5.war</web-uri>
- <context-root>/seam-jee5</context-root>
+ <web-uri>jboss-seam-jee5-booking.war</web-uri>
+ <context-root>/seam-jee5-booking</context-root>
</web>
</module>
<module>
- <ejb>jboss-seam-jee5.jar</ejb>
+ <ejb>jboss-seam-jee5-booking.jar</ejb>
</module>
<module>
<ejb>jboss-seam.jar</ejb>
Modified: trunk/examples/jee5/booking/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/examples/jee5/booking/resources/META-INF/ejb-jar.xml 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/resources/META-INF/ejb-jar.xml 2008-11-26 07:57:13 UTC (rev 9659)
@@ -1,16 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
-<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
version="3.0">
-
-
+
+ <enterprise-beans>
+ <!-- EJB reference required when one Seam EJB component references another Seam EJB component using @In -->
+ <!-- Not required if you inject using @EJB, but then you lose state management and client-side interceptors (e.g., security) -->
+ <session>
+ <ejb-name>RegisterAction</ejb-name>
+ <ejb-local-ref>
+ <ejb-ref-name>jboss-seam-jee5/AuthenticatorAction/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.jboss.seam.example.booking.Authenticator</local>
+ </ejb-local-ref>
+ </session>
+ </enterprise-beans>
+
<interceptors>
<interceptor>
<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor>
</interceptors>
-
+
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
Modified: trunk/examples/jee5/booking/resources/WEB-INF/web.xml
===================================================================
--- trunk/examples/jee5/booking/resources/WEB-INF/web.xml 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/resources/WEB-INF/web.xml 2008-11-26 07:57:13 UTC (rev 9659)
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app version="2.5"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
<!-- Seam -->
-
- <listener>
- <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
- </listener>
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
+
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
@@ -19,96 +19,88 @@
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-
+
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
-
+
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
- </servlet-mapping>
-
+ </servlet-mapping>
+
<!-- JSF and Facelets -->
-
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
</context-param>
-
- <context-param>
- <param-name>facelets.DEVELOPMENT</param-name>
- <param-value>true</param-value>
- </context-param>
-
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
<!-- Faces Servlet -->
-
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
</servlet>
-
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.seam</url-pattern>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
</servlet-mapping>
-
+
<!-- JEE5 EJB3 names -->
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/AuthenticatorAction/local</ejb-ref-name>
+
+ <ejb-local-ref>
+ <ejb-ref-name>jboss-seam-jee5/AuthenticatorAction/local</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
- <local>org.jboss.seam.example.booking.Authenticator</local>
- <ejb-link>AuthenticatorAction</ejb-link>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/BookingListAction/local</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>org.jboss.seam.example.booking.BookingList</local>
- <ejb-link>BookingListAction</ejb-link>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/RegisterAction/local</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>org.jboss.seam.example.booking.Register</local>
- <ejb-link>RegisterAction</ejb-link>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/ChangePasswordAction/local</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>org.jboss.seam.example.booking.ChangePassword</local>
- <ejb-link>ChangePasswordAction</ejb-link>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/HotelBookingAction/local</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>org.jboss.seam.example.booking.HotelBooking</local>
- <ejb-link>HotelBookingAction</ejb-link>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/HotelSearchingAction/local</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>org.jboss.seam.example.booking.HotelSearching</local>
- <ejb-link>HotelSearchingAction</ejb-link>
- </ejb-local-ref>
-
+ <local>org.jboss.seam.example.booking.Authenticator</local>
+ </ejb-local-ref>
+
<ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/EjbSynchronizations/local</ejb-ref-name>
+ <ejb-ref-name>jboss-seam-jee5/BookingListAction/local</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
+ <local>org.jboss.seam.example.booking.BookingList</local>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>jboss-seam-jee5/RegisterAction/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.jboss.seam.example.booking.Register</local>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>jboss-seam-jee5/ChangePasswordAction/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.jboss.seam.example.booking.ChangePassword</local>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>jboss-seam-jee5/HotelBookingAction/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.jboss.seam.example.booking.HotelBooking</local>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>jboss-seam-jee5/HotelSearchingAction/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.jboss.seam.example.booking.HotelSearching</local>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>jboss-seam-jee5/EjbSynchronizations/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
<local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
- <ejb-link>EjbSynchronizations</ejb-link>
</ejb-local-ref>
-
<session-config>
- <session-timeout>10</session-timeout>
- </session-config>
-
+ <session-timeout>10</session-timeout>
+ </session-config>
+
</web-app>
Modified: trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/Authenticator.java
===================================================================
--- trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/Authenticator.java 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/Authenticator.java 2008-11-26 07:57:13 UTC (rev 9659)
@@ -6,4 +6,5 @@
public interface Authenticator
{
public boolean authenticate();
+ public boolean isUsernameAvailable();
}
Modified: trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java
===================================================================
--- trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java 2008-11-26 07:57:13 UTC (rev 9659)
@@ -9,21 +9,30 @@
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.log.Log;
@Stateless
@Name("authenticator")
public class AuthenticatorAction implements Authenticator, Serializable
{
+ @Logger private Log log;
+
@PersistenceContext EntityManager em;
- @Out(required=false, scope = SESSION)
+ @In(required = false)
+ @Out(required = false, scope = SESSION)
private User user;
public boolean authenticate()
{
- List results = em.createQuery("select u from User u where u.username=#{identity.username} and u.password=#{identity.password}")
+ log.info("Authenticating #{identity.username}");
+ List results = em.createQuery(
+ "select u from User u where u.username = #{identity.username} and u.password = #{identity.password}")
.getResultList();
if ( results.size()==0 )
@@ -36,5 +45,30 @@
return true;
}
}
+
+ public boolean isUsernameAvailable()
+ {
+ // check if user is available in context
+ // we are proving that bijection is working on inter-EJB calls
+ if (user == null)
+ {
+ throw new IllegalStateException("No user available in context.");
+ }
+ log.info("Checking if username is available: {0}", user.getUsername());
+ List results = em.createQuery(
+ "select u.username from User u where u.username = :username")
+ .setParameter("username", user.getUsername())
+ .getResultList();
+
+ if ( results.size() == 0 )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
}
Modified: trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/BookingListAction.java
===================================================================
--- trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/BookingListAction.java 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/BookingListAction.java 2008-11-26 07:57:13 UTC (rev 9659)
@@ -22,13 +22,14 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.annotations.datamodel.DataModelSelection;
+import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
@Stateful
@Scope(SESSION)
@Name("bookingList")
-// @LoggedIn
+@Restrict("#{identity.loggedIn}")
@TransactionAttribute(REQUIRES_NEW)
public class BookingListAction implements BookingList, Serializable
{
Modified: trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/ChangePasswordAction.java
===================================================================
--- trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/ChangePasswordAction.java 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/ChangePasswordAction.java 2008-11-26 07:57:13 UTC (rev 9659)
@@ -15,12 +15,13 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.faces.FacesMessages;
@Stateful
@Scope(EVENT)
@Name("changePassword")
-// @LoggedIn
+@Restrict("#{identity.loggedIn}")
public class ChangePasswordAction implements ChangePassword, Serializable
{
Modified: trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelBookingAction.java
===================================================================
--- trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelBookingAction.java 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelBookingAction.java 2008-11-26 07:57:13 UTC (rev 9659)
@@ -20,13 +20,14 @@
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
@Stateful
@Name("hotelBooking")
-// @LoggedIn
+@Restrict("#{identity.loggedIn}")
public class HotelBookingAction implements HotelBooking, Serializable
{
@@ -60,7 +61,7 @@
@Begin
public void selectHotel(Hotel selectedHotel)
{
- hotel = em.merge(selectedHotel);
+ hotel = em.find(Hotel.class, selectedHotel.getId());
}
public void bookHotel()
Modified: trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelSearchingAction.java
===================================================================
--- trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelSearchingAction.java 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/HotelSearchingAction.java 2008-11-26 07:57:13 UTC (rev 9659)
@@ -20,7 +20,6 @@
@Stateful
@Name("hotelSearch")
@Scope(ScopeType.SESSION)
-// @LoggedIn
public class HotelSearchingAction implements HotelSearching, Serializable
{
@@ -48,10 +47,6 @@
private void queryHotels()
{
- // String searchPattern = searchString==null ? "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
- // hotels = em.createQuery("select h from Hotel h where lower(h.name) like :search or lower(h.city) like :search or lower(h.zip) like :search or lower(h.address) like :search")
- // .setParameter("search", searchPattern)
-
hotels = em.createQuery("select h from Hotel h where lower(h.name) like #{pattern} or lower(h.city) like #{pattern} or lower(h.zip) like #{pattern} or lower(h.address) like #{pattern}")
.setMaxResults(pageSize)
.setFirstResult( page * pageSize )
Modified: trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/RegisterAction.java
===================================================================
--- trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/RegisterAction.java 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/booking/src/org/jboss/seam/example/booking/RegisterAction.java 2008-11-26 07:57:13 UTC (rev 9659)
@@ -25,10 +25,15 @@
@In
private User user;
-
+
@PersistenceContext
private EntityManager em;
+ // if use @EJB, you don't need the ejb-local-ref defined in ejb-jar.xml,
+ // but you also lose state management and client-side interceptors
+ @In(create = true)
+ private Authenticator authenticator;
+
@In
private FacesMessages facesMessages;
@@ -40,15 +45,10 @@
{
if ( user.getPassword().equals(verify) )
{
- // List existing = em.createQuery("select u.username from User u where u.username=:username")
- // .setParameter("username", user.getUsername())
- List existing = em.createQuery("select u.username from User u where u.username=#{user.username}")
- .getResultList();
- if (existing.size()==0)
+ if ( authenticator.isUsernameAvailable() )
{
em.persist(user);
- // facesMessages.add("Successfully registered as #{user.username}");
- facesMessages.addToControl("username", "Username #{user.username} already exists");
+ facesMessages.add("Successfully registered as #{user.username}");
registered = true;
}
else
Modified: trunk/examples/jee5/remoting/resources/META-INF/application.xml
===================================================================
--- trunk/examples/jee5/remoting/resources/META-INF/application.xml 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/remoting/resources/META-INF/application.xml 2008-11-26 07:57:13 UTC (rev 9659)
@@ -8,12 +8,12 @@
<module>
<web>
- <web-uri>jboss-seam-remoting.war</web-uri>
- <context-root>/seam-remoting</context-root>
+ <web-uri>jboss-seam-jee5-remoting.war</web-uri>
+ <context-root>/seam-jee5-remoting</context-root>
</web>
</module>
<module>
- <ejb>jboss-seam-remoting.jar</ejb>
+ <ejb>jboss-seam-jee5-remoting.jar</ejb>
</module>
<module>
<ejb>jboss-seam.jar</ejb>
Modified: trunk/examples/jee5/remoting/resources/WEB-INF/web.xml
===================================================================
--- trunk/examples/jee5/remoting/resources/WEB-INF/web.xml 2008-11-26 07:56:46 UTC (rev 9658)
+++ trunk/examples/jee5/remoting/resources/WEB-INF/web.xml 2008-11-26 07:57:13 UTC (rev 9659)
@@ -55,27 +55,12 @@
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
- <!-- MyFaces -->
- <!--
- <listener>
- <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
- </listener>
- -->
-
- <!-- JSF RI -->
-
- <listener>
- <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
- </listener>
-
<!-- JEE5 EJB3 names -->
<ejb-local-ref>
<ejb-ref-name>jboss-seam-remoting/HelloAction/local</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
- <local-home/>
<local>org.jboss.seam.example.remoting.HelloLocal</local>
- <ejb-link>HelloAction</ejb-link>
</ejb-local-ref>
<session-config>
16 years, 2 months
Seam SVN: r9658 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-11-26 02:56:46 -0500 (Wed, 26 Nov 2008)
New Revision: 9658
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml
trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
Log:
JBSEAM-3034
correctly document the need for ejb-local-ref and why it is needed to inject one Seam EJB component into another
Modified: trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml 2008-11-26 07:55:35 UTC (rev 9657)
+++ trunk/doc/Seam_Reference_Guide/en-US/Configuration.xml 2008-11-26 07:56:46 UTC (rev 9658)
@@ -5,8 +5,8 @@
<title>Configuring Seam and packaging Seam applications</title>
<para> Configuration is a very boring topic and an extremely tedious pastime. Unfortunately, several lines of XML
are required to integrate Seam into your JSF implementation and servlet container. There's no need to be too put
- off by the following sections; you'll never need to type any of this stuff yourself, since you can just copy and
- paste from the example applications! </para>
+ off by the following sections; you'll never need to type any of this stuff yourself, since you can just use
+ seam-gen to start your application or you can copy and paste from the example applications! </para>
<sect1>
<title>Basic Seam configuration</title>
@@ -70,9 +70,9 @@
</sect2>
<sect2>
- <title>Using facelets</title>
+ <title>Using Facelets</title>
- <para> If you want follow our advice and use facelets instead of JSP, add the following lines to
+ <para> If you want follow our advice and use Facelets instead of JSP, add the following lines to
<literal>faces-config.xml</literal>: </para>
<programlisting role="XML"><![CDATA[<application>
@@ -87,12 +87,14 @@
</context-param>]]></programlisting>
<para>
- If you are using facelets in JBoss AS, you'll find that facelets
- logging is broken. Seam provides a bridge to fix this, to use it
- copy <literal>lib/interop/jboss-seam-jul.jar</literal> to
- <literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/</literal>
- and include the <literal>jboss-seam-ui.jar</literal> in the
- <literal>WEB-INF/lib</literal> of your application.
+ If you are using facelets in JBoss AS, you'll find that Facelets logging is broken (the log messages
+ don't make it to the server log). Seam provides a bridge to fix this, to use it copy
+ <literal>lib/interop/jboss-seam-jul.jar</literal> to
+ <literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/</literal> and include the
+ <literal>jboss-seam-ui.jar</literal> in the <literal>WEB-INF/lib</literal> of your application. The
+ Facelets logging catagories are itemized in the <ulink
+ url="https://facelets.dev.java.net/nonav/docs/dev/docbook.html#config-logging">Facelets Developer
+ Documentation</ulink>.
</para>
</sect2>
@@ -398,10 +400,16 @@
<sect2>
<title>Integrating Seam with your EJB container</title>
- <para> We need to apply the <literal>SeamInterceptor</literal> to our Seam components. The simplest way to
- do this across an entire application is to add the following interceptor configuration in
- <literal>ejb-jar.xml</literal>: </para>
+ <para> In a Seam application, EJB components have a certain duality, as they are managed by both the EJB
+ container and Seam. Actually, it's more that Seam resolves EJB component references, manages the
+ lifetime of stateful session bean components, and also participates in each method call via
+ interceptors. Let's start with the configuration of the Seam interceptor chain.</para>
+ <para> We need to apply the <literal>SeamInterceptor</literal> to our Seam EJB components. This interceptor
+ delegates to a set of built-in server-side interceptors that handle such concerns as bijection,
+ conversation demarcation, and business process signals. The simplest way to do this across an entire
+ application is to add the following interceptor configuration in <literal>ejb-jar.xml</literal>: </para>
+
<programlisting role="XML"><![CDATA[<interceptors>
<interceptor>
<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
@@ -420,29 +428,157 @@
<literal>@JndiName</literal> annotation on every session bean Seam component. However, this is quite
tedious. A better approach is to specify a pattern that Seam can use to calculate the JNDI name from the
EJB name. Unfortunately, there is no standard mapping to global JNDI defined in the EJB3 specification,
- so this mapping is vendor-specific. We usually specify this option in <literal>components.xml</literal>. </para>
+ so this mapping is vendor-specific (and may depend on your own naming conventions as well). We usually
+ specify this option in <literal>components.xml</literal>. </para>
<para> For JBoss AS, the following pattern is correct: </para>
- <programlisting role="XML"><![CDATA[<core:init jndi-name="myEarName/#{ejbName}/local" />]]></programlisting>
+ <programlisting role="XML"><![CDATA[<core:init jndi-name="earName/#{ejbName}/local" />]]></programlisting>
- <para> Where <literal>myEarName</literal> is the name of the EAR in which the bean is deployed. </para>
+ <para> In this case, <literal>earName</literal> is the name of the EAR in which the bean is deployed, Seam
+ replaces <literal>#{ejbName}</literal> with the name of the EJB, and the final segment represents the
+ type of interface (local or remote). </para>
- <para> Outside the context of an EAR (when using the JBoss Embeddable EJB3 container), the following pattern
- is the one to use: </para>
+ <para> Outside the context of an EAR (when using the JBoss Embeddable EJB3 container), the first segment is
+ dropped since there is no EAR, leaving us with the following pattern: </para>
<programlisting role="XML"><![CDATA[<core:init jndi-name="#{ejbName}/local" />]]></programlisting>
- <para> You'll have to experiment to find the right setting for other application servers. Note that some
- servers (such as GlassFish) require you to specify JNDI names for all EJB components explicitly (and
- tediously). In this case, you can pick your own pattern ;-) </para>
-
+ <para> How these JNDI names are resolved and somehow locate an EJB component might appear a bit like black
+ magic at this point, so let's dig into the details. First, let's talk about how the EJB components get
+ into JNDI.</para>
+
+ <para> The folks at JBoss don't care much for XML, if you can't tell. So when they designed JBoss AS, they
+ decided that EJB components would get assigned a global JNDI name automatically, using the pattern
+ just described (i.e., EAR name/EJB name/interface type). The EJB name is the first non-empty value
+ from the following list: </para>
+ <itemizedlist>
+ <listitem>
+ <para>The value of the <literal><ejb-name></literal> element in ejb-jar.xml</para>
+ </listitem>
+ <listitem>
+ <para>The value of the <literal>name</literal> attribute in the @Stateless or @Stateful annotation</para>
+ </listitem>
+ <listitem>
+ <para>The simple name of the bean class</para>
+ </listitem>
+ </itemizedlist>
+
+ <para> Let's look at an example. Assume that you have the following EJB bean and interface defined. </para>
+
+ <programlisting role="JAVA"><![CDATA[package com.example.myapp;
+
+import javax.ejb.Local;
+
+@Local
+public class Authenticator
+{
+ boolean authenticate();
+}
+
+package com.example.myapp;
+
+import javax.ejb.Stateless;
+
+@Stateless
+@Name("authenticator")
+public class AuthenticatorBean implements Authenticator
+{
+ public boolean authenticate() { ... }
+}
+]]></programlisting>
+
+ <para> Assuming your EJB bean class is deployed in an EAR named myapp, the global JNDI name
+ myapp/AuthenticatorBean/local will be assigned to it. As you learned, you can reference this EJB
+ component as a Seam component with the name <literal>authenticator</literal> and Seam will take care of
+ finding it in JNDI according to the JNDI pattern (or <literal>@JndiName</literal> annotation). </para>
+
+ <para> So what about the rest of the application servers? Well, according to the Java EE spec, which most
+ vendors try to adhere to religiously, you have to declare an EJB reference for your EJB in order for it
+ to be assigned a JNDI name. That requires some XML. It also means that it is up to you to establish a
+ JNDI naming convention so that you can leverage the Seam JNDI pattern. You might find the JBoss
+ convention a good one to follow.</para>
+
+ <para> There are two places you have to define the EJB reference. If you are going to be looking up the
+ Seam EJB component through JSF (in a JSF view or as a JSF action listener) or a Seam JavaBean component,
+ then you must declare the EJB reference in web.xml. Here is the EJB reference for the example component
+ just shown: </para>
+
+ <programlisting role="XML"><![CDATA[<ejb-local-ref>
+ <ejb-ref-name>myapp/AuthenticatorBean/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.example.vehicles.action.Authenticator</local>
+</ejb-local-ref>
+]]></programlisting>
+
+ <para> This reference will cover most uses of the component in a Seam application. However, if you want to
+ be able to inject a Seam EJB component into another Seam EJB component using <literal>@In</literal>, you
+ need to define this EJB reference in another location. This time, it must be defined in ejb-jar.xml, and
+ it's a bit tricker. </para>
+
+ <para> Within the context of an EJB method call, you have to deal with a somewhat sheltered JNDI context.
+ When Seam attempts to find another Seam EJB component to satisfy an injection point defined using
+ <literal>@In</literal>, it isn't going to be successful looking up the component in JNDI. You cannot
+ simply resolve JNDI names as you please. You have to define those references explicitly. Unlike with the
+ web context, however, you cannot declare EJB references globally for all EJB components. Instead, you
+ have to specify the JNDI resources for a given EJB component one-by-one.</para>
+
+ <para> Let's assume that we have an EJB named RegisterAction (the name is resolved using the three steps
+ mentioned previously). That EJB has the following Seam injection:</para>
+
+ <programlisting role="JAVA"><![CDATA[@In(create = true)
+Authenticator authenticator;
+]]></programlisting>
+
+ <para> In order for this injection to work, the link must be established in the ejb-jar.xml file as follows: </para>
+
+ <programlisting role="XML"><![CDATA[<ejb-jar>
+ <enterprise-beans>
+ <session>
+ <ejb-name>RegisterAction</ejb-name>
+ <ejb-local-ref>
+ <ejb-ref-name>myapp/AuthenticatorAction/local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>com.example.myapp.Authenticator</local>
+ </ejb-local-ref>
+ </session>
+ </enterprise-beans>
+
+ ...
+
+</ejb-jar>
+]]></programlisting>
+
+ <para> Notice that the contents of the <literal><ejb-local-ref></literal> are identical to what we
+ defined in web.xml. What we are doing is bringing the reference into the EJB context where it can be
+ used by the RegisterAction bean. You will need to add one of these references for any injection of a
+ Seam EJB compoenent into another Seam EJB component using <literal>@In</literal>. (You can see an
+ example of this setup in the jee5/booking example).</para>
+
+ <para> But what about <literal>@EJB</literal>? It's true that you can inject one EJB into another using
+ <literal>@EJB</literal>. However, by doing so, you are injecting the actual EJB reference rather than the
+ Seam EJB component instance. In this case, some Seam features will work, while others won't. That's
+ because Seam's interceptor is invoked on any method call to an EJB component. But that only invokes
+ Seam's server-side interceptor chain. What you lose is Seam's state management and Seam's client-side
+ interceptor chain. Client-side interceptors handle concerns such as security and concurrency. Also, when
+ injecting a SFSB, there is no guarantee that you will get the SFSB bound to the active session or
+ conversation, whatever the case may be. Thus, you definitely want to inject the Seam EJB component using
+ <literal>@In</literal>.</para>
+
+ <para> That covers how JNDI names are defined and used. The lesson is that with some application servers,
+ such as GlassFish, you are going to have to specify JNDI names for all EJB components explicitly, and
+ sometimes twice! And even if you are following the same naming convention as JBoss AS, the JNDI pattern
+ in Seam may need to be altered. For instance, the global JNDI names are automatically prefixed with
+ java:comp/env on GlassFish, so you need to define the JNDI pattern as follows:</para>
+
+ <programlisting role="XML"><![CDATA[<core:init jndi-name="java:comp/env/earName/#{ejbName}/local" />]]></programlisting>
+
<para>
- In an EJB3 environment, we recommend the use of a special built-in component for transaction management,
- that is fully aware of container transactions, and can correctly process transaction success events
- registered with the <literal>Events</literal> component. If you don't add this line to your
- <literal>components.xml</literal> file, Seam won't know when container-managed transactions end:
- </para>
+ Finally, let's talk about transactions. In an EJB3 environment, we recommend the use of a special
+ built-in component for transaction management, that is fully aware of container transactions, and can
+ correctly process transaction success events registered with the <literal>Events</literal> component. If
+ you don't add this line to your <literal>components.xml</literal> file, Seam won't know when
+ container-managed transactions end: </para>
<programlisting role="XML"><![CDATA[<transaction:ejb-transaction/>]]></programlisting>
Modified: trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml 2008-11-26 07:55:35 UTC (rev 9657)
+++ trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml 2008-11-26 07:56:46 UTC (rev 9658)
@@ -527,25 +527,45 @@
</term>
<listitem>
<para>
- As with the <literal>jee5/booking</literal> example we
- need to add EJB references to the web.xml. These
- references require the empty
- <literal>local-home</literal> to flag them for GlassFish
- to perform the proper binding.
+ As with the <literal>jee5/booking</literal> example, we
+ need to add EJB references to web.xml. Technically, the
+ reference type is not required, but we add it here for
+ good measure. Note that these references require the
+ presence of an empty <literal>local-home</literal>
+ element to retain compatibility with a JBoss AS 4.x
+ deployment.
</para>
<programlisting role="XML"><![CDATA[<ejb-local-ref>
<ejb-ref-name>seamgen_example/AuthenticatorAction</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
+ <local-home/>
<local>org.jboss.seam.tutorial.glassfish.action.Authenticator</local>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>seamgen_example/EjbSynchronizations</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
+ <local-home/>
<local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
</ejb-local-ref>]]></programlisting>
+ <para>
+ Keep in mind that if you are deploying to JBoss AS 4.x,
+ and have defined the EJB references shown above in your
+ web.xml, you will need to also define local JNDI names
+ for each of them in jboss-web.xml, as shown below.
+ This step is not required when deploying to GlassFish,
+ but it's mentioned here in case you are also deploying the
+ application to JBoss AS 4.x (not required for JBoss AS 5).
+ </para>
+ <programlisting role="XML"><![CDATA[<ejb-local-ref>
+ <ejb-ref-name>seamgen_example/AuthenticatorAction</ejb-ref-name>
+ <local-jndi-name>AuthenticatorAction</local-jndi-name>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>seamgen_example/EjbSynchronizations</ejb-ref-name>
+ <local-jndi-name>EjbSynchronizations</local-jndi-name>
+ </ejb-local-ref>]]></programlisting>
</listitem>
</varlistentry>
</variablelist>
16 years, 2 months
Seam SVN: r9657 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-11-26 02:55:35 -0500 (Wed, 26 Nov 2008)
New Revision: 9657
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Concepts.xml
Log:
whitespace
fix notes about stateless context and bad example
Modified: trunk/doc/Seam_Reference_Guide/en-US/Concepts.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Concepts.xml 2008-11-26 07:55:07 UTC (rev 9656)
+++ trunk/doc/Seam_Reference_Guide/en-US/Concepts.xml 2008-11-26 07:55:35 UTC (rev 9657)
@@ -27,7 +27,7 @@
<para> Stateless context </para>
</listitem>
<listitem>
- <para> Event (or request) context </para>
+ <para> Event (i.e., request) context </para>
</listitem>
<listitem>
<para> Page context </para>
@@ -64,9 +64,10 @@
<sect2>
<title>Stateless context</title>
<para>
- Components which are truly stateless (stateless session beans, primarily) always live in the
- stateless context (this is really a non-context). Stateless components are not very interesting, and are
- arguably not very object-oriented. Nevertheless, they are important and often useful.
+ Components which are truly stateless (stateless session beans, primarily) always live in the stateless
+ context (which is basically the absense of a context since the instance Seam resolves is not stored).
+ Stateless components are not very interesting, and are arguably not very object-oriented. Nevertheless,
+ they do get developed and used and are thus an important part of any Seam application.
</para>
</sect2>
@@ -302,7 +303,7 @@
<para> EJB 3.0 stateful session beans </para>
</listitem>
<listitem>
- <para> EJB 3.0 entity beans </para>
+ <para> EJB 3.0 entity beans (i.e., JPA entity classes)</para>
</listitem>
<listitem>
<para> JavaBeans </para>
@@ -310,6 +311,9 @@
<listitem>
<para> EJB 3.0 message-driven beans </para>
</listitem>
+ <listitem>
+ <para> Spring beans (see <xref linkend="spring"/>)</para>
+ </listitem>
</itemizedlist>
<sect2>
@@ -508,20 +512,19 @@
</para>
<para>
- Just like in JSF, a seam component instance is usually bound to a context variable with the same name
- as the component name. So, for example, we would access the <literal>LoginAction</literal> using
- <literal>Contexts.getStatelessContext().get("loginAction")</literal>. In particular, whenever Seam
- itself instantiates a component, it binds the new instance to a variable with the component name.
- However, again like JSF, it is possible for the application to bind a component to some other context
- variable by programmatic API call. This is only useful if a particular component serves more than one
- role in the system. For example, the currently logged in <literal>User</literal> might be bound to the
- <literal>currentUser</literal> session context variable, while a <literal>User</literal> that is the
- subject of some administration functionality might be bound to the <literal>user</literal> conversation
- context variable.
- </para>
-
+ Whenever Seam instantiates a component, it binds the new instance to a variable in the scope configured
+ for the component that matches the component name. This behavior is identical to how JSF managed beans
+ work, except that Seam allows you to configure this mapping using annotations rather than XML. You can
+ also programmatically bind a component to a context variable. This is useful if a particular component
+ serves more than one role in the system. For example, the currently logged in <literal>User</literal>
+ might be bound to the <literal>currentUser</literal> session context variable, while a
+ <literal>User</literal> that is the subject of some administration functionality might be bound to the
+ <literal>user</literal> conversation context variable. Be careful, though, because through a
+ programmatic assignment, it's possible to overwrite a context variable that has a reference to a Seam
+ component, potentially confusing matters. </para>
<para>
- For very large applications, and for built-in seam components, qualified names are often used.
+ For very large applications, and for built-in seam components, qualified component names are often used
+ to avoid naming conflicts.
</para>
<programlisting role="JAVA"><![CDATA[@Name("com.jboss.myapp.loginAction")
@@ -759,7 +762,7 @@
}]]></programlisting>
<para>
- Injected values are disinjected (i.e, set to <literal>null</literal>) immediately after method
+ Injected values are disinjected (i.e., set to <literal>null</literal>) immediately after method
completion and outjection.
</para>
@@ -1237,32 +1240,37 @@
<programlisting role="JAVA"><![CDATA[@Name("hens")
@Scope(APPLICATION)
-public class HenHouse {
-
+public class HenHouse
+{
Set<Hen> hens;
@In(required=false) Hen hen;
@Unwrap
- public List<Hen> getHens() {
- if (hens == null) {
+ public List<Hen> getHens()
+ {
+ if (hens == null)
+ {
// Setup our hens
}
return hens;
}
@Observer({"chickBorn", "chickenBoughtAtMarket"})
- public addHen() {
+ public addHen()
+ {
hens.add(hen);
}
@Observer("chickenSoldAtMarket")
- public removeHen() {
+ public removeHen()
+ {
hens.remove(hen);
}
@Observer("foxGetsIn")
- public removeAllHens() {
+ public removeAllHens()
+ {
hens.clear();
}
...
16 years, 2 months