2.2.2. Changes to Components
SeamTest
now boots Seam at the start of each suite, instead of the start of each class. This improves speed. Check the reference guide if you wish to alter the default.
Document Type Declarations (DTDs) for Seam XML files are no longer supported. XML Schema Declarations (XSDs) should be used for validation instead. Any file that uses Seam 2.0 XSDs should be updated to refer to the Seam 2.1 XSDs instead.
Caught exceptions are now available in EL as #{org.jboss.seam.caughtException}
. They are no longer available in #{org.jboss.seam.exception}
form.
You can now configure the entity manager used from the entity-loader
component. For further details, see the documentation.
Several aspects of Seam, including the Seam Application Framework, rely upon the existence of a common naming convention between the Seam-managed Persistence Context (JPA) and the Hibernate Session. In versions earlier than Seam 2.1, the name of the managed Hibernate Session was assumed to be session
. Since session
is an overloaded term in Seam and the Java Servlet API, the default has been changed to hibernateSession
to reduce ambiguity. This means that, when you inject or resolve the Hibernate Session, it is much easier to identify the appropriate session.
@In private Session hibernateSession;
@In(name = "hibernateSession") private Session session;
session
, you can inject the reference explicitly with the session
property:
<framework:hibernate-entity-home session="#{session}".../> <transaction:entity-transaction session="#{session}".../>
getPersistenceContextName()
method on any persistence controller in the Seam Application Framework with the following:
public String getPersistenceContextName() { "session"; }
The configuration for security rules in components.xml
has changed for projects that use rule-based security. Previously, rules were configured as a property of the identity
component:
<security:identity security-rules="#{securityRules}" authenticate-method="#{authenticator.authenticate}"/>
ruleBasedPermissionResolver
component for its rule-based permission checks. You must activate this component and register the security rules with it instead of with the identity
component:
<security:rule-based-permission-resolver security-rules="#{securityRules}"/>
Important
- name
- action
- contextual object (optional)
s:hasPermission('userManager', 'edit', user)
- target
- action
s:hasPermission(user, 'edit')
s:hasPermission('userManager', 'edit', user)
s:hasPemrission(user, 'edit')
This method will no longer attempt to perform an authentication check if credentials have been set. Instead, it will return true
if the user is currently unauthenticated. To make use of the previous behavior, use Identity.tryLogin()
instead.
components.xml
to ensure that the user is logged in automatically when the application is first accessed:
<event type="org.jboss.seam.security.notLoggedIn"> <action execute="#{redirect.captureCurrentView}"/> <action execute="#{identity.tryLogin}"/> </event> <event type="org.jboss.seam.security.loginSuccessful"> <action execute="#{redirect.returnToCapturedView}"/> </event>
The documentStore
component has been moved from the external pdf/itext
module into Seam itself. Any references to pdf:document-store
in components.xml
should therefore be replaced with document:document-store
. Similarly, if your web.xml
references org.jboss.seam.pdf.DocumentStoreServlet
, you should change the reference to org.jboss.seam.document.DocumentStoreServlet
.
Seam's ManagedEntityInterceptor
(previously ManagedEntityIdentityInterceptor
) is now disabled by default. If you need the ManagedEntityInterceptor
for clustered conversation failover, you can enable it in components.xml
with the following:
<core:init> <core:interceptors> <value>org.jboss.seam.core.SynchronizationInterceptor</value> <value>org.jboss.seam.async.AsynchronousInterceptor</value> <value>org.jboss.seam.ejb.RemoveInterceptor</value> <value>org.jboss.seam.persistence.HibernateSessionProxyInterceptor</value> <value>org.jboss.seam.persistence.EntityManagerProxyInterceptor</value> <value>org.jboss.seam.core.MethodContextInterceptor</value> <value>org.jboss.seam.core.EventInterceptor</value> <value>org.jboss.seam.core.ConversationalInterceptor</value> <value>org.jboss.seam.bpm.BusinessProcessInterceptor</value> <value>org.jboss.seam.core.ConversationInterceptor</value> <value>org.jboss.seam.core.BijectionInterceptor</value> <value>org.jboss.seam.transaction.RollbackInterceptor</value> <value>org.jboss.seam.transaction.TransactionInterceptor</value> <value>org.jboss.seam.webservice.WSSecurityInterceptor</value> <value>org.jboss.seam.security.SecurityInterceptor</value> <value>org.jboss.seam.persistence.ManagedEntityInterceptor</value> </core:interceptors> </core:init>
All asynchronous invocations are now wrapped by exception handling. By default, any exceptions that propagate out of an asynchronous call are caught and logged at the error level. You will find further information in Chapter 21, Asynchronicity and messaging.
The org.jboss.seam.postInitialization
event is no longer called upon redeployment. org.jboss.seam.postReInitialization
is called instead.
Cache support in Seam has been rewritten to support JBoss Cache 3.2, JBoss Cache 2 and Ehcache. Further information is available in Chapter 22, Caching.
<s:cache />
has not changed, but the pojoCache
component can no longer be injected.
CacheProvider
provides a Map-like interface. The getDelegate()
method can then be used to retrieve the underlying cache.
The provided platform is now JBoss Enterprise Application Platform 5.1.0, so javaassist:javaassist
and dom4j:dom4j
are now marked as provided.
A number of properties now expect value expressions:
entityHome.createdMessage
entityHome.updatedMessage
entityHome.deletedMessage
entityQuery.restrictions
components.xml
, no changes are necessary. If you configure the objects with JavaScript, you must create a value expression as follows:
public ValueExpression getCreatedMessage() { return createValueExpression("New person #{person.firstName} #{person.lastName} created"); }