[jboss-user] [JBossWS] - Re: How can I use session sope in jbossws?

froden do-not-reply at jboss.com
Wed Jan 30 08:51:47 EST 2008


Thanks for your reply, mjhammel, Using the approach described in your links, I managed to get the session object. I can now set and retrieve variables from session as long as the client has the JSESSIONID http header field set correctly.

However, I still have some unresolved issues with this.

In my application, I have a JSF page where users can log in. The page uses a seam component, in which I have the following code (somewhat simplified):

@Stateless
  | @Name("authenticator")
  | public class AuthenticatorAction {
  |   
  |   @EJB
  |   ProfileDAO profileDAO;
  | 
  |   @RequestParameter
  |   String username;
  | 
  |   @RequestParameter
  |   String password;
  | 
  |   @In(required=false)
  |   @Out(required=false, scope=SESSION)
  |   private Profile authenticatedProfile;
  |   
  |   public String login() {
  |     Profile p = profileDAO.getUser(username, password);
  |     authenticatedProfile = profile;
  |   }
  | }

This works fine, and the Profile object is put into the session scope (ie can be fetched in other seam components over different page loads etc).

The question is, how can I retreive the profile object in my web service? Doing a 
session.getAttribute("authenticatedProfile")
does not work. In fact,
System.out.println((session.getValueNames()).length);
reveals that there are no variables stored in the session!

Any ideas?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124775#4124775

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124775



More information about the jboss-user mailing list