Seam SVN: r8301 - trunk/src/main/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 22:46:50 -0400 (Wed, 28 May 2008)
New Revision: 8301
Modified:
trunk/src/main/org/jboss/seam/security/Identity.java
Log:
expose credentials
Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java 2008-05-29 02:29:28 UTC (rev 8300)
+++ trunk/src/main/org/jboss/seam/security/Identity.java 2008-05-29 02:46:50 UTC (rev 8301)
@@ -612,6 +612,11 @@
credentials.setPassword(password);
}
+ public Credentials getCredentials()
+ {
+ return credentials;
+ }
+
public MethodExpression getAuthenticateMethod()
{
return authenticateMethod;
16 years, 7 months
Seam SVN: r8300 - in trunk/src: test/integration/src/org/jboss/seam/test/integration/security and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 22:29:28 -0400 (Wed, 28 May 2008)
New Revision: 8300
Modified:
trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java
trunk/src/test/integration/src/org/jboss/seam/test/integration/security/SecurityTest.java
Log:
fixed broken references
Modified: trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java
===================================================================
--- trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java 2008-05-29 02:13:40 UTC (rev 8299)
+++ trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java 2008-05-29 02:29:28 UTC (rev 8300)
@@ -298,7 +298,7 @@
public void process() throws ServletException, IOException, LoginException
{
Identity identity = Identity.instance();
- identity.setUsername(username);
+ identity.getCredentials().setUsername(username);
identity.authenticate();
}
}.run();
Modified: trunk/src/test/integration/src/org/jboss/seam/test/integration/security/SecurityTest.java
===================================================================
--- trunk/src/test/integration/src/org/jboss/seam/test/integration/security/SecurityTest.java 2008-05-29 02:13:40 UTC (rev 8299)
+++ trunk/src/test/integration/src/org/jboss/seam/test/integration/security/SecurityTest.java 2008-05-29 02:29:28 UTC (rev 8300)
@@ -52,7 +52,7 @@
@Override
protected LoginContext getLoginContext() throws LoginException
{
- return new LoginContext("default", getSubject(), getDefaultCallbackHandler(),
+ return new LoginContext("default", getSubject(), getCredentials().createCallbackHandler(),
createMockJAASConfiguration());
}
}
@@ -90,11 +90,11 @@
// expected
}
- identity.setUsername("foo");
- identity.setPassword("bar");
+ identity.getCredentials().setUsername("foo");
+ identity.getCredentials().setPassword("bar");
- assert("foo".equals(identity.getUsername()));
- assert("bar".equals(identity.getPassword()));
+ assert("foo".equals(identity.getCredentials().getUsername()));
+ assert("bar".equals(identity.getCredentials().getPassword()));
assert("loggedIn".equals(identity.login()));
assert(identity.isLoggedIn());
16 years, 7 months
Seam SVN: r8299 - in trunk/src/main/org/jboss/seam: web and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 22:13:40 -0400 (Wed, 28 May 2008)
New Revision: 8299
Modified:
trunk/src/main/org/jboss/seam/security/FacesSecurityEvents.java
trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java
Log:
fixed broken references
Modified: trunk/src/main/org/jboss/seam/security/FacesSecurityEvents.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/FacesSecurityEvents.java 2008-05-29 01:35:07 UTC (rev 8298)
+++ trunk/src/main/org/jboss/seam/security/FacesSecurityEvents.java 2008-05-29 02:13:40 UTC (rev 8299)
@@ -57,7 +57,7 @@
setDirty();
}
- @Observer(Identity.EVENT_CREDENTIALS_UPDATED)
+ @Observer(Credentials.EVENT_CREDENTIALS_UPDATED)
public void credentialsUpdated()
{
setDirty();
Modified: trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java
===================================================================
--- trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java 2008-05-29 01:35:07 UTC (rev 8298)
+++ trunk/src/main/org/jboss/seam/web/AuthenticationFilter.java 2008-05-29 02:13:40 UTC (rev 8299)
@@ -24,6 +24,7 @@
import org.jboss.seam.contexts.Context;
import org.jboss.seam.contexts.SessionContext;
import org.jboss.seam.log.Log;
+import org.jboss.seam.security.Credentials;
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.NotLoggedInException;
import org.jboss.seam.security.digest.DigestRequest;
@@ -130,6 +131,7 @@
{
Context ctx = new SessionContext( new ServletRequestSessionMap(request) );
Identity identity = (Identity) ctx.get(Identity.class);
+ Credentials credentials = (Credentials) ctx.get(Credentials.class);
boolean requireAuth = false;
@@ -150,11 +152,11 @@
}
// Only reauthenticate if username doesn't match Identity.username and user isn't authenticated
- if (!username.equals(identity.getUsername()) || !identity.isLoggedIn())
+ if (!username.equals(credentials.getUsername()) || !identity.isLoggedIn())
{
try
{
- identity.setPassword(password);
+ credentials.setPassword(password);
authenticate( request, username );
}
catch (Exception ex)
@@ -165,7 +167,7 @@
}
}
- if (!identity.isLoggedIn() && !identity.isCredentialsSet())
+ if (!identity.isLoggedIn() && !credentials.isSet())
{
requireAuth = true;
}
@@ -196,6 +198,7 @@
{
Context ctx = new SessionContext( new ServletRequestSessionMap(request) );
Identity identity = (Identity) ctx.get(Identity.class);
+ Credentials credentials = (Credentials) ctx.get(Credentials.class);
boolean requireAuth = false;
boolean nonceExpired = false;
@@ -247,7 +250,7 @@
}
}
- if (!identity.isLoggedIn() && !identity.isCredentialsSet())
+ if (!identity.isLoggedIn() && !credentials.isSet())
{
requireAuth = true;
}
16 years, 7 months
Seam SVN: r8298 - trunk/examples/seamspace/view.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 21:35:07 -0400 (Wed, 28 May 2008)
New Revision: 8298
Modified:
trunk/examples/seamspace/view/home.xhtml
Log:
bind to credentials
Modified: trunk/examples/seamspace/view/home.xhtml
===================================================================
--- trunk/examples/seamspace/view/home.xhtml 2008-05-29 01:33:19 UTC (rev 8297)
+++ trunk/examples/seamspace/view/home.xhtml 2008-05-29 01:35:07 UTC (rev 8298)
@@ -31,7 +31,7 @@
<div class="loginRow">
<h:outputLabel for="name" value="Member name" styleClass="loginLabel"/>
- <h:inputText id="name" value="#{identity.username}"/>
+ <h:inputText id="name" value="#{credentials.username}"/>
</div>
<div class="validationMsg">
@@ -40,7 +40,7 @@
<div class="loginRow">
<h:outputLabel for="password" value="Password" styleClass="loginLabel"/>
- <h:inputSecret id="password" value="#{identity.password}" redisplay="true"/>
+ <h:inputSecret id="password" value="#{credentials.password}" redisplay="true"/>
</div>
<div class="validationMsg">
16 years, 7 months
Seam SVN: r8297 - trunk/src/main/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 21:33:19 -0400 (Wed, 28 May 2008)
New Revision: 8297
Added:
trunk/src/main/org/jboss/seam/security/Credentials.java
Modified:
trunk/src/main/org/jboss/seam/security/Identity.java
Log:
separate credentials from identity
Added: trunk/src/main/org/jboss/seam/security/Credentials.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Credentials.java (rev 0)
+++ trunk/src/main/org/jboss/seam/security/Credentials.java 2008-05-29 01:33:19 UTC (rev 8297)
@@ -0,0 +1,122 @@
+package org.jboss.seam.security;
+
+import static org.jboss.seam.ScopeType.SESSION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+@Name("org.jboss.seam.security.credentials")
+@Scope(SESSION)
+@Install(precedence = BUILT_IN)
+@BypassInterceptors
+@Startup
+public class Credentials implements Serializable
+{
+ public static final String EVENT_CREDENTIALS_UPDATED = "org.jboss.seam.security.credentialsUpdated";
+
+ private static final LogProvider log = Logging.getLogProvider(Credentials.class);
+
+ private String username;
+ private String password;
+
+ private boolean invalid = false;
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ if (this.username != username && (this.username == null || !this.username.equals(username)))
+ {
+ this.username = username;
+ invalid = false;
+ if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED);
+ }
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ if (this.password != password && (this.password == null || !this.password.equals(password)))
+ {
+ this.password = password;
+ invalid = false;
+ if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED);
+ }
+ }
+
+ public boolean isSet()
+ {
+ return username != null && password != null;
+ }
+
+ public boolean isInvalid()
+ {
+ return invalid;
+ }
+
+ public void invalidate()
+ {
+ invalid = true;
+ }
+
+ public void clear()
+ {
+ username = null;
+ password = null;
+ }
+
+
+ /**
+ * Creates a callback handler that can handle a standard username/password
+ * callback, using the username and password properties.
+ */
+ public CallbackHandler createCallbackHandler()
+ {
+ return new CallbackHandler()
+ {
+ public void handle(Callback[] callbacks)
+ throws IOException, UnsupportedCallbackException
+ {
+ for (int i=0; i < callbacks.length; i++)
+ {
+ if (callbacks[i] instanceof NameCallback)
+ {
+ ( (NameCallback) callbacks[i] ).setName(getUsername());
+ }
+ else if (callbacks[i] instanceof PasswordCallback)
+ {
+ ( (PasswordCallback) callbacks[i] ).setPassword( getPassword() != null ?
+ getPassword().toCharArray() : null );
+ }
+ else
+ {
+ log.warn("Unsupported callback " + callbacks[i]);
+ }
+ }
+ }
+ };
+ }
+}
Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java 2008-05-29 00:29:47 UTC (rev 8296)
+++ trunk/src/main/org/jboss/seam/security/Identity.java 2008-05-29 01:33:19 UTC (rev 8297)
@@ -3,7 +3,6 @@
import static org.jboss.seam.ScopeType.SESSION;
import static org.jboss.seam.annotations.Install.BUILT_IN;
-import java.io.IOException;
import java.io.Serializable;
import java.security.Principal;
import java.security.acl.Group;
@@ -13,11 +12,6 @@
import java.util.List;
import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
@@ -59,7 +53,6 @@
public static final String EVENT_PRE_AUTHENTICATE = "org.jboss.seam.security.preAuthenticate";
public static final String EVENT_POST_AUTHENTICATE = "org.jboss.seam.security.postAuthenticate";
public static final String EVENT_LOGGED_OUT = "org.jboss.seam.security.loggedOut";
- public static final String EVENT_CREDENTIALS_UPDATED = "org.jboss.seam.security.credentialsUpdated";
public static final String EVENT_REMEMBER_ME = "org.jboss.seam.security.rememberMe";
public static final String EVENT_ALREADY_LOGGED_IN = "org.jboss.seam.security.alreadyLoggedIn";
@@ -74,8 +67,7 @@
private static final LogProvider log = Logging.getLogProvider(Identity.class);
- private String username;
- private String password;
+ private Credentials credentials;
private MethodExpression authenticateMethod;
@@ -104,6 +96,8 @@
{
permissionMapper = (PermissionMapper) Component.getInstance(PermissionMapper.class);
}
+
+ credentials = (Credentials) Component.getInstance(Credentials.class);
}
public static boolean isSecurityEnabled()
@@ -140,7 +134,7 @@
public boolean isLoggedIn(boolean attemptLogin)
{
- if (!authenticating && attemptLogin && getPrincipal() == null && isCredentialsSet() &&
+ if (!authenticating && attemptLogin && getPrincipal() == null && credentials.isSet() &&
Contexts.isEventContextActive() &&
!Contexts.getEventContext().isSet(LOGIN_TRIED))
{
@@ -161,11 +155,6 @@
{
return subject;
}
-
- public boolean isCredentialsSet()
- {
- return username != null && password != null;
- }
/**
* Performs an authorization check, based on the specified security expression.
@@ -241,6 +230,8 @@
}
catch (LoginException ex)
{
+ credentials.invalidate();
+
if ( log.isDebugEnabled() )
{
log.debug("Login failed for: " + getUsername(), ex);
@@ -259,7 +250,7 @@
{
try
{
- if (isCredentialsSet())
+ if (credentials.isSet())
{
authenticate();
if (isLoggedIn(false) && Contexts.isEventContextActive())
@@ -268,7 +259,10 @@
}
}
}
- catch (LoginException ex) { }
+ catch (LoginException ex)
+ {
+ credentials.invalidate();
+ }
}
/**
@@ -279,7 +273,7 @@
throws LoginException
{
// If we're already authenticated, then don't authenticate again
- if (!isLoggedIn(false))
+ if (!isLoggedIn(false) && !credentials.isInvalid())
{
principal = null;
subject = new Subject();
@@ -300,7 +294,7 @@
finally
{
// Set password to null whether authentication is successful or not
- password = null;
+ credentials.setPassword(null);
authenticating = false;
}
}
@@ -355,7 +349,7 @@
{
principal = null;
subject = new Subject();
- username = null;
+ credentials.clear();
}
protected LoginContext getLoginContext() throws LoginException
@@ -363,11 +357,11 @@
if (getJaasConfigName() != null)
{
return new LoginContext(getJaasConfigName(), getSubject(),
- getDefaultCallbackHandler());
+ credentials.createCallbackHandler());
}
- return new LoginContext(Configuration.DEFAULT_JAAS_CONFIG_NAME,
- getSubject(), getDefaultCallbackHandler(), Configuration.instance());
+ return new LoginContext(Configuration.DEFAULT_JAAS_CONFIG_NAME, getSubject(),
+ credentials.createCallbackHandler(), Configuration.instance());
}
public void logout()
@@ -583,37 +577,6 @@
}
/**
- * Creates a callback handler that can handle a standard username/password
- * callback, using the username and password properties.
- */
- protected CallbackHandler getDefaultCallbackHandler()
- {
- return new CallbackHandler()
- {
- public void handle(Callback[] callbacks)
- throws IOException, UnsupportedCallbackException
- {
- for (int i=0; i < callbacks.length; i++)
- {
- if (callbacks[i] instanceof NameCallback)
- {
- ( (NameCallback) callbacks[i] ).setName(getUsername());
- }
- else if (callbacks[i] instanceof PasswordCallback)
- {
- ( (PasswordCallback) callbacks[i] ).setPassword( getPassword() != null ?
- getPassword().toCharArray() : null );
- }
- else
- {
- log.warn("Unsupported callback " + callbacks[i]);
- }
- }
- }
- };
- }
-
- /**
* Evaluates the specified security expression, which must return a boolean
* value.
*
@@ -625,32 +588,28 @@
return Expressions.instance().createValueExpression(expr, Boolean.class).getValue();
}
+ @Deprecated
public String getUsername()
{
- return username;
+ return credentials.getUsername();
}
-
+
+ @Deprecated
public void setUsername(String username)
{
- if (this.username != username && (this.username == null || !this.username.equals(username)))
- {
- this.username = username;
- if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED);
- }
+ credentials.setUsername(username);
}
+ @Deprecated
public String getPassword()
{
- return password;
+ return credentials.getPassword();
}
+ @Deprecated
public void setPassword(String password)
{
- if (this.password != password && (this.password == null || !this.password.equals(password)))
- {
- this.password = password;
- if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED);
- }
+ credentials.setPassword(password);
}
public MethodExpression getAuthenticateMethod()
16 years, 7 months
Seam SVN: r8296 - trunk/src/main/org/jboss/seam/security/management.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-28 20:29:47 -0400 (Wed, 28 May 2008)
New Revision: 8296
Modified:
trunk/src/main/org/jboss/seam/security/management/IdentityManager.java
Log:
minor javadoc
Modified: trunk/src/main/org/jboss/seam/security/management/IdentityManager.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/management/IdentityManager.java 2008-05-28 17:32:53 UTC (rev 8295)
+++ trunk/src/main/org/jboss/seam/security/management/IdentityManager.java 2008-05-29 00:29:47 UTC (rev 8296)
@@ -223,11 +223,23 @@
// TODO fix
}
+ /**
+ * Returns a list of the roles that are explicitly granted to the specified user;
+ *
+ * @param name The user for which to return a list of roles
+ * @return List containing the names of the granted roles
+ */
public List<String> getGrantedRoles(String name)
{
return roleIdentityStore.getGrantedRoles(name);
}
+ /**
+ * Returns a list of roles that are either explicitly or indirectly granted to the specified user.
+ *
+ * @param name The user for which to return the list of roles
+ * @return List containing the names of the implied roles
+ */
public List<String> getImpliedRoles(String name)
{
return roleIdentityStore.getImpliedRoles(name);
16 years, 7 months
Seam SVN: r8295 - trunk/build.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-28 13:32:53 -0400 (Wed, 28 May 2008)
New Revision: 8295
Modified:
trunk/build/debug.pom.xml
trunk/build/gen.pom.xml
trunk/build/ioc.pom.xml
trunk/build/jbas5.pom.xml
trunk/build/mail.pom.xml
trunk/build/pdf.pom.xml
trunk/build/remoting.pom.xml
trunk/build/root.pom.xml
trunk/build/ui.pom.xml
trunk/build/wicket.pom.xml
Log:
JBSEAM-3034
Modified: trunk/build/debug.pom.xml
===================================================================
--- trunk/build/debug.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/debug.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -18,6 +18,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
Modified: trunk/build/gen.pom.xml
===================================================================
--- trunk/build/gen.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/gen.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -36,6 +36,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
<scope>runtime</scope>
<exclusions>
<exclusion>
Modified: trunk/build/ioc.pom.xml
===================================================================
--- trunk/build/ioc.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/ioc.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -30,6 +30,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
Modified: trunk/build/jbas5.pom.xml
===================================================================
--- trunk/build/jbas5.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/jbas5.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -19,6 +19,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
Modified: trunk/build/mail.pom.xml
===================================================================
--- trunk/build/mail.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/mail.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -18,6 +18,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
Modified: trunk/build/pdf.pom.xml
===================================================================
--- trunk/build/pdf.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/pdf.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -29,6 +29,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
Modified: trunk/build/remoting.pom.xml
===================================================================
--- trunk/build/remoting.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/remoting.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -18,6 +18,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
Modified: trunk/build/root.pom.xml
===================================================================
--- trunk/build/root.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/root.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -56,6 +56,7 @@
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<version>@seam.version@</version>
+ <type>ejb</type>
</dependency>
<dependency>
Modified: trunk/build/ui.pom.xml
===================================================================
--- trunk/build/ui.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/ui.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -78,6 +78,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
Modified: trunk/build/wicket.pom.xml
===================================================================
--- trunk/build/wicket.pom.xml 2008-05-28 13:18:20 UTC (rev 8294)
+++ trunk/build/wicket.pom.xml 2008-05-28 17:32:53 UTC (rev 8295)
@@ -18,6 +18,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
</dependency>
<dependency>
16 years, 7 months
Seam SVN: r8294 - trunk/src/main/org/jboss/seam/mock.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-28 09:18:20 -0400 (Wed, 28 May 2008)
New Revision: 8294
Modified:
trunk/src/main/org/jboss/seam/mock/MockServletContext.java
Log:
Sometimes web.xml isn't present
Modified: trunk/src/main/org/jboss/seam/mock/MockServletContext.java
===================================================================
--- trunk/src/main/org/jboss/seam/mock/MockServletContext.java 2008-05-28 12:58:55 UTC (rev 8293)
+++ trunk/src/main/org/jboss/seam/mock/MockServletContext.java 2008-05-28 13:18:20 UTC (rev 8294)
@@ -35,9 +35,16 @@
{
try
{
- webInfRoot = new File(getClass().getResource("/WEB-INF/web.xml").toURI()).getParentFile();
- webInfClassesRoot = new File(webInfRoot.getParentFile().getPath() + "/classes");
- webappRoot = webInfRoot.getParentFile();
+ URL webxml = getClass().getResource("/WEB-INF/web.xml");
+ if (webxml != null)
+ {
+ webInfRoot = new File(webxml.toURI()).getParentFile();
+ if (webInfRoot != null)
+ {
+ webInfClassesRoot = new File(webInfRoot.getParentFile().getPath() + "/classes");
+ webappRoot = webInfRoot.getParentFile();
+ }
+ }
}
catch (URISyntaxException e)
{
16 years, 7 months
Seam SVN: r8293 - trunk/examples/mail/src/org/jboss/seam/example/mail/test.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-28 08:58:55 -0400 (Wed, 28 May 2008)
New Revision: 8293
Modified:
trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java
Log:
Fixes for attachment changes
Modified: trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java
===================================================================
--- trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java 2008-05-28 12:28:59 UTC (rev 8292)
+++ trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java 2008-05-28 12:58:55 UTC (rev 8293)
@@ -123,22 +123,41 @@
MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
// Test the attachments (no ui:repeat atm, so only 6)
- assert body.getCount() == 6;
+ assert body.getCount() == 1;
- // Attachment 1
- assert body.getBodyPart(0) != null;
+ // The root multipart/related
+ assert body.getBodyPart(0) != null;
assert body.getBodyPart(0) instanceof MimeBodyPart;
MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
assert bodyPart.getContent() != null;
+ assert bodyPart.getContent() instanceof MimeMultipart;
+ assert bodyPart.isMimeType("multipart/related");
+
+ MimeMultipart attachments = (MimeMultipart) bodyPart.getContent();
+
+ // Attachment 0 (the actual message)
+ assert attachments.getBodyPart(0) != null;
+ assert attachments.getBodyPart(0) instanceof MimeBodyPart;
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(0);
+ assert bodyPart.getContent() != null;
+ assert bodyPart.getContent() != null;
+ assert "inline".equals(bodyPart.getDisposition());
+ assert bodyPart.isMimeType("text/html");
+
+ // Attachment 1
+ assert attachments.getBodyPart(1) != null;
+ assert attachments.getBodyPart(1) instanceof MimeBodyPart;
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(1);
+ assert bodyPart.getContent() != null;
assert bodyPart.getContent() instanceof InputStream;
assert "jboss.jpg".equals(bodyPart.getFileName());
assert bodyPart.isMimeType("image/jpeg");
- assert "attachment".equals(bodyPart.getDisposition());
+ assert "inline".equals(bodyPart.getDisposition());
// Attachment 2
- assert body.getBodyPart(1) != null;
- assert body.getBodyPart(1) instanceof MimeBodyPart;
- bodyPart = (MimeBodyPart) body.getBodyPart(1);
+ assert attachments.getBodyPart(2) != null;
+ assert attachments.getBodyPart(2) instanceof MimeBodyPart;
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(2);
assert bodyPart.getContent() != null;
assert bodyPart.getContent() instanceof InputStream;
assert "numbers.csv".equals(bodyPart.getFileName());
@@ -146,9 +165,9 @@
assert "attachment".equals(bodyPart.getDisposition());
// Attachment 3
- assert body.getBodyPart(2) != null;
- assert body.getBodyPart(2) instanceof MimeBodyPart;
- bodyPart = (MimeBodyPart) body.getBodyPart(2);
+ assert attachments.getBodyPart(3) != null;
+ assert attachments.getBodyPart(3) instanceof MimeBodyPart;
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(3);
assert bodyPart.getContent() != null;
assert bodyPart.getContent() != null;
assert bodyPart.getContent() instanceof InputStream;
@@ -157,9 +176,9 @@
assert "inline".equals(bodyPart.getDisposition());
// Attachment 4
- assert body.getBodyPart(3) != null;
- assert body.getBodyPart(3) instanceof MimeBodyPart;
- bodyPart = (MimeBodyPart) body.getBodyPart(3);
+ assert attachments.getBodyPart(4) != null;
+ assert attachments.getBodyPart(4) instanceof MimeBodyPart;
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(4);
assert bodyPart.getContent() != null;
// No PDF rendering here :(
assert bodyPart.getContent() instanceof String;
@@ -167,22 +186,14 @@
assert "attachment".equals(bodyPart.getDisposition());
// Attachment 5
- assert body.getBodyPart(4) != null;
- assert body.getBodyPart(4) instanceof MimeBodyPart;
- bodyPart = (MimeBodyPart) body.getBodyPart(4);
+ assert attachments.getBodyPart(5) != null;
+ assert attachments.getBodyPart(5) instanceof MimeBodyPart;
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(5);
assert bodyPart.getContent() != null;
assert "Gavin_King.jpg".equals(bodyPart.getFileName());
assert bodyPart.isMimeType("image/jpeg");
assert "attachment".equals(bodyPart.getDisposition());
- // Attachment 6 (the actual message)
- assert body.getBodyPart(5) != null;
- assert body.getBodyPart(5) instanceof MimeBodyPart;
- bodyPart = (MimeBodyPart) body.getBodyPart(5);
- assert bodyPart.getContent() != null;
- assert bodyPart.getContent() != null;
- assert "inline".equals(bodyPart.getDisposition());
- assert bodyPart.isMimeType("text/html");
}
}.run();
@@ -204,20 +215,15 @@
UIAttachment attachment = new UIAttachment();
attachment.setFileName("filename.pdf");
UIMessage message = new UIMessage();
+ attachment.setParent(message);
message.setMailSession(MailSession.instance());
- attachment.setParent(message);
DocumentData doc = new DocumentData("filename", new DocumentData.DocumentType("pdf", "application/pdf"), new byte[] {});
attachment.setValue(doc);
attachment.encodeEnd(FacesContext.getCurrentInstance());
// verify we built the message
- MimeMessage mimeMessage = message.getMimeMessage();
- Object content = mimeMessage.getContent();
- assert content instanceof MimeMultipart;
- MimeMultipart multipartContent = (MimeMultipart) content;
- assert multipartContent.getCount() == 1;
- assert multipartContent.getBodyPart(0) instanceof MimeBodyPart;
- MimeBodyPart bodyPart = (MimeBodyPart) multipartContent.getBodyPart(0);
+ assert new Integer(1).equals(message.getAttachments().size());
+ MimeBodyPart bodyPart = message.getAttachments().get(0);
assert "filename.pdf".equals(bodyPart.getFileName());
assert "attachment".equals(bodyPart.getDisposition());
}
16 years, 7 months
Seam SVN: r8292 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-28 08:28:59 -0400 (Wed, 28 May 2008)
New Revision: 8292
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Drools.xml
Log:
JBSEAM-3047
Modified: trunk/doc/Seam_Reference_Guide/en-US/Drools.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Drools.xml 2008-05-28 11:57:16 UTC (rev 8291)
+++ trunk/doc/Seam_Reference_Guide/en-US/Drools.xml 2008-05-28 12:28:59 UTC (rev 8292)
@@ -208,6 +208,22 @@
assignable.setPooledActors( new String[] {"reviewers"} );
end]]></programlisting>
+ <note>
+ <para>
+ You can find out more about Drools at
+ <ulink url="http://www.drools.org" />
+ </para>
+ </note>
+
+ <tip>
+ <para>
+ Drools comes with MVEL compiled for Java 1.4, which is
+ compatible with Java 1.4, Java 5 and Java 6. You may want to
+ change your MVEL jar with one compiled for the version of Java
+ you are using
+ </para>
+ </tip>
+
</section>
</chapter>
16 years, 7 months