jsf 2 - Trying to implement logging filter for JSF 2.0 -
i'm trying implement loggin filter described in question: how implement login filter in jsf?
but can't attribute associated logged user. i'm using websphere 8.0 build-in apache myfaces 2.0.3
my code following:
string path = req.getservletpath(); httpsession session = req.getsession(false);
i have tried use req.getsession().getattribute("auth");
, return null
; req.getsession().getattribute("username")
returns null
too.
but when try debug or print tostring
session
following output (i've hidden private information):
(java.lang.string) # httpsessionimpl # { _isession=# com.ibm.ws.session.store.memory.memorysession # { _sessionid=f7zha1mienp3cdymammvg1u hashcode : 73409621 create time : sun may 31 19:34:53 idt 2015 last access : sun may 31 19:35:23 idt 2015 max inactive interval : 900 user name : user:**********/uid=******,c=il,ou=**,o=******** valid session : true new session : false overflowed : false app name : default_host/********* attribute names=[org.apache.myfaces.view.facelets.defaultfaceletsstatemanagementhelper.serialized_view, jsf_sequence, org.apache.webbeans.web.failover, webbeansconfigurationlistener, facelets.ui.debugoutput, javax.faces.request.charset] _refcount=1 } _httpsessioncontext=com.ibm.ws.session.http.httpsessioncontextimpl@4cab3001 }
so decided session keeps data need, don't know how it.
when tried debug deeper found contains variable: _isession
of type memorysession
, inside there's variable _username
contains required data, again, couldn't it.
i've tried cast object httpsessionimpl
error: could not resolve type: com.ibm.ws.session.http.httpsessionimpl
the next step required data using reflection, i'm sure it's wrong way. should more convenient way access it.
thank help.
Comments
Post a Comment