Session timeout / TouchFaces

UI Components for JSF
Post Reply
luizbarbosa
Posts: 4
Joined: 07 Jul 2010, 22:57

04 Aug 2010, 21:21

I try to do redirect, but....

java.lang.NullPointerException
at org.primefaces.context.PrimeExternalContext.redirect(PrimeExternalContext.java:45)


Here is my code:

Code: Select all

@Override
    public void beforePhase(PhaseEvent event) {
       
        FacesContext cxt = event.getFacesContext();
        ExternalContext ext = cxt.getExternalContext();
        HttpSession session = (HttpSession) ext.getSession(false);

        boolean newSession = (session == null) || (session.isNew());
        boolean postback = !ext.getRequestParameterMap().isEmpty();
        boolean timedout = postback && newSession;

        if (timedout) {
            try {
                String url = "http://localhost:8080/estoque/move";
                ext.redirect(url); // error!!!
            } catch (Exception ex) {
                Logger.getLogger(WMovePhaseListener.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }  


What am I doing wrong?

Best regards,
Luiz
NetBeans IDE 6.9, Mojarra 2.0.2, JSF-2.0, and PrimeFaces-2.0.2 on GlassFish v3

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Aug 2010, 12:54

Not sure what is wrong but org.primefaces.context.PrimeExternalContext is removed in PrimeFaces 2.2 as we've migrated to JSF 2.0 ajax.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 25 guests