[jboss-user] [JBoss Seam] - Re: Stateless Injection
ovidiucn
do-not-reply at jboss.com
Tue Jul 25 03:45:42 EDT 2006
Thank you for being so quick.
/***********************************/
/* local interface */
@Local
public interface UserManagementLocal {
public Collection getUsers ();
}
/***********************************/
/* business logic */
@Name("userManagement")
@Stateless
public class UserManagement implements UserManagementLocal {
/* The login context created when a user previously logged-in. */
@In(value="loginContext", create=false, required=true)
private LoginContext loginContext;
@In (value="user", create=true, required=true)
private User user;
@In
Context sessionContext;
public Collection getUsers() {
Collection users = new ArrayList ();
/* user bean is null !!! */
/* sessionContext is null !!! */
/* the loginContext is null !!! */
System.out.println("user: " + user);
System.out.println("sessionContext: " + sessionContext);
System.out.println("loginContext: " + loginContext);
try {
SecurityDataService sds = SecurityDataServiceFactory.getService(loginContext.getSubject());
Set attributeNames = new HashSet();
users.addAll(sds.getAllUsers(attributeNames));
} catch (SSDataManagementException e) {
e.printStackTrace();
users.clear();
}
return users;
}
}
/***********************************/
/* JBoss Seam configuration(s) */
<!-- web.xml snippet -->
<listener-class>
org.jboss.seam.servlet.SeamListener
</listener-class>
<!-- faces-config.xml snippet -->
<!-- using myfaces-1.1.3 -->
<phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
<!-- WEB-INF/components.xml -->
true
<!-- using myfaces-1.1.3 -->
false
emp/#{ejbName}/local
<!-- WEB-INF/classes/seam.properties exists & is empty -->
<!-- service-security.jar#!seam.properties exists & is empty -->
Environment:
JRE 1.5.0_06
JBOSS Release ID: JBoss [Zion] 4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000) - installed with JEMS & ejb3 configuration enabled
JBoss Seam 1.0.1.GA
MyFaces 1.1.3
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960603#3960603
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960603
More information about the jboss-user
mailing list