1 package org.sapia.soto.state.cocoon; 2 3 import org.apache.cocoon.environment.http.HttpRequest; 4 5 import org.apache.commons.lang.ClassUtils; 6 7 import org.sapia.soto.Debug; 8 import org.sapia.soto.state.Result; 9 import org.sapia.soto.state.helpers.CompositeStep; 10 11 12 20 public class IfNotSession extends CompositeStep { 21 public IfNotSession() { 22 } 23 24 27 public String getName() { 28 return ClassUtils.getShortClassName(getClass()); 29 } 30 31 34 protected boolean doExecute(Result res) { 35 HttpRequest req = (HttpRequest) ((CocoonContext) res.getContext()).getRequest(); 36 boolean exists = req.getSession(false) != null; 37 38 if (Debug.DEBUG) { 39 Debug.debug("Session exists: " + exists); 40 } 41 42 return !exists; 43 } 44 } 45 | Popular Tags |