FileDocCategorySizeDatePackage
SessionTimeout.javaAPI DocGlassfish v2 API4886Fri May 04 22:34:10 BST 2007com.sun.enterprise.tools.verifier.tests.web

SessionTimeout

public class SessionTimeout extends com.sun.enterprise.tools.verifier.tests.web.WebTest implements WebCheck
The session-timeout element deinfes the default session timeout interval for all sessions created in this web application. The units used must be expressed in whole minutes.

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(WebBundleDescriptor descriptor)
The session-timeout element deinfes the default session timeout interval for all sessions created in this web application. The units used must be expressed in whole minutes.

param
descriptor the Web deployment descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

	boolean na = false;
	boolean foundIt = false;
	Integer sessionTimeout = new Integer(descriptor.getSessionTimeout());
	// tomcat doesn't throw exception to DOL if you pass "ten" to xml element,
	// it initializes session-timeout to -1, hence this check
	if (sessionTimeout.intValue() == -1 ) {
	    na = true;
	} else if (sessionTimeout.intValue() >= 0 ) {
	    foundIt = true;
	} else {
	    foundIt = false;
	}
   
	// always true until DOL lets something other than integer thru...
	if (na) {
	    result.addNaDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
	    result.notApplicable(smh.getLocalString
			  (getClass().getName() + ".notApplicable",
			   "Not Applicable: Servlet session-timeout [ {0} ] element does not define the default session timeout interval.",
			   new Object[] {sessionTimeout.toString()}));
	} else if (foundIt) {
	    result.addGoodDetails(smh.getLocalString
				  ("tests.componentNameConstructor",
				   "For [ {0} ]",
				   new Object[] {compName.toString()}));	
	    result.passed(smh.getLocalString
			      (getClass().getName() + ".passed",
			   "Servlet session-timeout [ {0} ] element defines the default session timeout interval expressed in whole minutes.",
			   new Object[] {sessionTimeout.toString()}));
	} else {
	    result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
	    result.failed(smh.getLocalString
			  (getClass().getName() + ".failed",
			   "Error: Servlet session-timeout [ {0} ] element does not define the default session timeout interval expressed in whole minutes.",
			   new Object[] {sessionTimeout.toString()}));
	}
	return result;