New aribaweb blog article

31 views
Skip to first unread message

František Kolář

unread,
Oct 4, 2012, 2:23:51 PM10/4/12
to arib...@googlegroups.com
Hello to everyone, 

Please check out my new article http://aribaweb.blogspot.cz

SessionManagement  - Most of you will probably recognize that this the reaction for the one of the article initiated by Aby ;-). 


I have still some blog post in the pipe line, and really want to start with the MetaUi which I think for the most of you might be even more interesting, but if anyone have something more urgent that you want to see in action please e-mail me. Also as you will see at the bottom of the article source code for this example can be sent based on the requests. 


Regards

František Kolář 

František Kolář

unread,
Oct 4, 2012, 2:28:13 PM10/4/12
to arib...@googlegroups.com
Not sure why there is .cz , but http://aribaweb.blogspot.com should work too ;-)
Regards

František Kolář 
Phone: +420 604 55 55 77  




On Oct 4, 2012, at 8:23 PM, František Kolář wrote:

Hello to everyone, 

Please check out my new article http://aribaweb.blogspot.cz

SessionManagement  - Most of you will probably recognize that this the reaction for the one of the post initiated by Aby ;-). 

aby peter

unread,
Oct 5, 2012, 7:48:33 AM10/5/12
to arib...@googlegroups.com
Thank you František.

It is a great article and you have shared lot of knowledge regarding SessionManagement. I am trying to integrate this thought but I have faced some issues,

Application.java

public class Application extends AWServletApplication
{
   
     public Application(){
         if (_sessionValidator == null){
             setSessionValidator(new MyLoginSessionHandler());
          }       
        }
   
     public static class MyLoginSessionHandler extends AWLocalLoginSessionHandler {

        @Override
        protected boolean requireSessionValidationForAllComponentActions (){
        return true;
        }
       
        protected boolean validateSession (AWRequestContext requestContext){           
            WebSession ws=(WebSession)requestContext.session(false);    ////////////////Here Class cast Exception       
            return ws.isAuthenticated();           
            }
       
        @Override
        protected AWResponseGenerating showLoginPage (AWRequestContext requestContext,
                CompletionCallback callback){
                    Main loginPage = (Main)requestContext.pageWithName(Main.class.getName());
                    loginPage.init(callback);
                    return loginPage;
        }   
       
    }
       
}

I am getting an exception ( exception is  ariba.ui.aribaweb.core.AWSession  cannot be cast to  app.WebSession ) in  method validateSession()
.

Also I have not seen the method  bindUserToSession() in  WebSession.java  so that I have implemented in following way and  I am not sure about my  implementation

WebSession.java

public class WebSession extends AWSession
{
    private boolean isAuthenticated;
    private String _userName;
    static final String _SessionUIDKey = "_OC_USER_ID";
 
    public String get_userName() {
        return _userName;
    }

    public void set_userName(String userName) {
        _userName = userName;
    }

    public boolean isAuthenticated ()
    {
        return isAuthenticated;
    }

   public static void bindUserToSession (AWSession session,UserAccountDto user )
    {
        session.dict().put(_SessionUIDKey, user.getUser_id());
    }

   
   
}


Kindly guide me


Thanks,
Aby





František Kolář

unread,
Oct 5, 2012, 8:28:29 AM10/5/12
to arib...@googlegroups.com
In your application did you specified that your session class is you WebSession ?


Regards

František Kolář 
Phone: +420 604 55 55 77  




--
You received this message because you are subscribed to the Google Groups "AribaWeb (aribaweb.org)" group.
To post to this group, send email to arib...@googlegroups.com.
To unsubscribe from this group, send email to aribaweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/aribaweb?hl=en.

František Kolář

unread,
Oct 5, 2012, 8:36:56 AM10/5/12
to arib...@googlegroups.com
Please check out whole example:

1. Basically you need to tell your AW Application that your sessino class is not AWSession but WebSession
2. You need to find the best way to how store your session information. here in this simple example I just update the created websession my my information 

But then you might need to check out the :

AWSession.LifecycleListener {
        public void sessionWillAwake(AWSession session) {
            _ThreadLocalSession.set(session.dict().get(SessionKey));


        }

        public void sessionWillSleep(AWSession session) {
            _ThreadLocalSession.set(null);
        }
    }



Archive.zip

Mengu

unread,
Oct 8, 2012, 6:37:47 PM10/8/12
to AribaWeb (aribaweb.org)
i have a question.

why in the world aribaweb is not mvc?
> Regards
>
> František Kolář
>
> Fadamo s.r.o.
> Zelená 480
> 250 66 Zdiby
> Phone: +420 604 55 55 77
> Email: fko...@fadamo.com
> IC: 24135691 | DIC: CZ24135691
>
> On Oct 5, 2012, at 2:28 PM, František Kolář wrote:
>
>
>
>
>
>
>
> > In your application did you specified that your session class is you WebSession ?
>
> > Regards
>
> > František Kolář
> > Phone: +420 604 55 55 77
> > Email: franti...@kolar.pro
>
> > <btn_viewmy_160x25.png>

aby peter

unread,
Oct 9, 2012, 1:24:23 AM10/9/12
to arib...@googlegroups.com
Hi František,

I have checked out your Example - Code and implemented  but the Logout link is not enabled so that I am not able to logoff the application.

Kindly tell me How to enable the Logout and Home link ?

Thanks,
Aby

František Kolář

unread,
Oct 9, 2012, 3:39:47 AM10/9/12
to arib...@googlegroups.com

Regards
František Kolář 
 

Fadamo s.r.o. 
Zelená 480  
250 66 Zdiby 
Phone: +420 604 55 55 77  
IC: 24135691 | DIC: CZ24135691 

František Kolář

unread,
Oct 9, 2012, 3:42:54 AM10/9/12
to arib...@googlegroups.com
Hi Aby, 


to show link:

ConditionHandler.setHandler(BindingNames.disableLogoutAction, new ConditionHandler() {
            public boolean evaluateCondition(AWRequestContext requestContext) {
                return YOUR CONDITION
            }
        });




To handle the CLICK on the logout link


ActionHandler.setHandler(AribaAction.LogoutAction, new ActionHandler() {
            public AWResponseGenerating actionClicked(AWRequestContext requestContext) {
                AWSession session = requestContext.session(false);
                MetaNavTabBar.invalidateState(session);
                AuthenticationUtil.logout(session);

}
///// 
                return AWComponentActionRequestHandler.SharedInstance.processFrontDoorRequest(requestContext);
            }
        });


 AuthenticationUtil.logout(session) {

// here I have only something like
WebSession ws = (WebSession) session; ws.initiateLogout(); WebApplication webApplication = (WebApplication) AWConcreteApplication.sharedInstance(); Log.securityAuthentication.info("Terminating user session: " + session.httpSession().getId() + ". ConcurentUsers = " + webApplication.concurrentUsers()); if (session != null) { session.terminate();


Regards

František Kolář 
 

Fadamo s.r.o. 
Zelená 480  
250 66 Zdiby 
Phone: +420 604 55 55 77  
IC: 24135691 | DIC: CZ24135691 

Reply all
Reply to author
Forward
0 new messages