1 16 17 18 package org.apache.struts.webapp.example2; 19 20 21 import java.io.IOException ; 22 import javax.faces.FacesException; 23 import javax.faces.context.FacesContext; 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 27 28 31 32 public class LoggedOn { 33 34 35 37 38 private static final Log log = LogFactory.getLog(LoggedOn.class); 39 40 41 43 44 47 public String logoff() { 48 49 FacesContext context = FacesContext.getCurrentInstance(); 50 if (log.isDebugEnabled()) { 51 log.debug("logoff(" + context + ")"); 52 } 53 forward(context, "/logoff.do"); 54 return (null); 55 56 } 57 58 59 61 62 71 private void forward(FacesContext context, String url) { 72 73 try { 74 context.getExternalContext().dispatch(url); 75 } catch (IOException e) { 76 throw new FacesException(e); 77 } finally { 78 context.responseComplete(); 79 } 80 81 } 82 83 84 } 85 | Popular Tags |