'm trying to get the Servlet context
in following environment, started with a submit
|
| @Stateless
| //@Startup
| @Name("xxxxx")
| //@ResourceAdapter("mail-ra.rar")
| @Scope(SESSION)
| public class Shedule implements SheduleINTF
| { @Logger private Log log;
| //@PersistenceContext(type=EXTENDED) //
| @In ("#{entityManager}") public EntityManager em;//allow for db ACCESS
| //@In(create=true) public transINTF txsmail;//db access txn
| @In(create=true) public BeursMailINTF beursmail;//db access txn
| @In FacesMessages facesMessages;
| //@DataModel
|
calling
| public String submit2()
| { setSessuionTimeout(30);
| if (!isNewSession()) log.info("new session :");
| ...
|
|
|
| public int setSessuionTimeout(int minutes)
| { if (minutes <1)minutes=1;
| int tmo=0;
| try {
| Object obj =ServletContexts.getInstance().getRequest();//null
| if
(obj!=null)obj=ServletContexts.getInstance().getRequest().getSession();
| if (obj!=null)
tmo=ServletContexts.instance().getRequest().getSession().getMaxInactiveInterval();
| if (obj!=null)
ServletContexts.instance().getRequest().getSession().setMaxInactiveInterval(minutes*60);
| if (obj!=null) return tmo;
| // int tmo=
| //
org.jboss.seam.web.ServletContexts.instance().getRequest().getSession().getMaxInactiveInterval();
| //
org.jboss.seam.web.ServletContexts.instance().getRequest().getSession().setMaxInactiveInterval(minutes*60);
| return minutes;
| } catch (Exception er)
| { String errmsg=er.getClass().getSimpleName() +" err: "+
er.getMessage();
| if(errmsg.indexOf("NullPointer")>-1 ||
errmsg.indexOf("OutOfBounds")>0) log.fatal("ServletContext error "+ errmsg+"
time:"+tmo+"/"+ minutes,er);
| else log.error("[ServletContext error set timeout "+ errmsg +"
time:"+tmo+"/"+ minutes );}
| return 0;
| }
|
|
| public boolean isNewSession()
|
| { try{
| Object obj
=ServletContexts.getInstance().getRequest();//null
|
| if
(obj!=null)obj=ServletContexts.instance().getRequest().getSession();
| if (obj!=null) return
ServletContexts.instance().getRequest().getSession().isNew();
|
| // return
org.jboss.seam.web.ServletContexts.instance().getRequest().getSession().isNew();
|
| } catch (Exception er)
| { String errmsg=er.getClass().getSimpleName() +" err: "+
er.getMessage();
| if(errmsg.indexOf("NullPointer")>-1 ||
errmsg.indexOf("OutOfBounds")>0) log.fatal("new session error "+ errmsg,er);
| else log.error("[ServletContext error set timeout "+ errmsg );}
|
| return true;
| }
|
|
| [\code]
| as soon as I try the getRequest the object is constantly NULL
| what im I doing wrong ???
|
|
| I would like to access the Request in different EJB environments
| further away ( multiple seam EJB's deeper)
| what are the restrictions to access ServletContext.getRequests
|
|
| (using seam 2.0.1.GA in JBoss 4.2.2GA environment
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128687#4128687
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128687
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user