WebAppCatalinaForm.java

00001 
00026 package org.objectweb.jonas.webapp.jonasadmin.service.container;
00027 
00028 import javax.servlet.http.HttpServletRequest;
00029 
00030 import org.apache.struts.action.ActionError;
00031 import org.apache.struts.action.ActionErrors;
00032 import org.apache.struts.action.ActionMapping;
00033 
00037 public class WebAppCatalinaForm extends WebAppForm {
00038 
00039 // --------------------------------------------------------- Properties variables
00040 
00041     private String host = null;
00042     private boolean cookies = false;
00043     private boolean reloadable = false;
00044     private boolean swallowOutput = false;
00045     private boolean crossContext = false;
00046     private boolean override = false;
00047     private String docBase = null;
00048     private int state = 0;
00049 
00050 // --------------------------------------------------------- Public Methods
00051 
00059     public void reset(ActionMapping mapping, HttpServletRequest request) {
00060         super.reset(mapping, request);
00061 
00062         cookies = true;
00063         reloadable = false;
00064         swallowOutput = false;
00065         crossContext = false;
00066         override = false;
00067     }
00068 
00080     public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
00081         ActionErrors oErrors = super.validate(mapping, request);
00082         //numberCheck(oErrors, "sessionTimeout", sessionTimeout, true, 1, 65535);
00083         return oErrors;
00084     }
00085 
00086     /*
00087      * Helper method to check that it is a required number and
00088      * is a valid integer within the given range. (min, max).
00089      *
00090      * @param  field  The field name in the form for which this error occured.
00091      * @param  numText  The string representation of the number.
00092      * @param rangeCheck  Boolean value set to true of reange check should be performed.
00093      *
00094      * @param  min  The lower limit of the range
00095      * @param  max  The upper limit of the range
00096      *
00097      */
00098     public void numberCheck(ActionErrors p_Errors, String field, String numText, boolean rangeCheck
00099         , int min, int max) {
00100         // Check for 'is required'
00101         if ((numText == null) || (numText.length() < 1)) {
00102             p_Errors.add(field, new ActionError("error.webapp.setting." + field + ".required"));
00103         }
00104         else {
00105 
00106             // check for 'must be a number' in the 'valid range'
00107             try {
00108                 int num = Integer.parseInt(numText);
00109                 // perform range check only if required
00110                 if (rangeCheck) {
00111                     if ((num < min) || (num > max)) {
00112                         p_Errors.add(field
00113                             , new ActionError("error.webapp.setting." + field + ".range"));
00114                     }
00115                 }
00116             }
00117             catch (NumberFormatException e) {
00118                 p_Errors.add(field, new ActionError("error.webapp.setting." + field + ".format"));
00119             }
00120         }
00121     }
00122 
00123 // --------------------------------------------------------- Properties Methods
00124 /*
00125     public boolean isAvailable() {
00126         return available;
00127     }
00128 
00129     public void setAvailable(boolean available) {
00130         this.available = available;
00131     }
00132 */
00133     public boolean isCookies() {
00134         return cookies;
00135     }
00136 
00137     public void setCookies(boolean cookies) {
00138         this.cookies = cookies;
00139     }
00140 
00141     public boolean isReloadable() {
00142         return reloadable;
00143     }
00144 
00145     public void setReloadable(boolean reloadable) {
00146         this.reloadable = reloadable;
00147     }
00148 
00149     public boolean isSwallowOutput() {
00150         return swallowOutput;
00151     }
00152 
00153     public void setSwallowOutput(boolean swallowOutput) {
00154         this.swallowOutput = swallowOutput;
00155     }
00156 
00157     public String getHost() {
00158         return host;
00159     }
00160 
00161     public void setHost(String host) {
00162         this.host = host;
00163     }
00164 
00165     public boolean isCrossContext() {
00166         return crossContext;
00167     }
00168 
00169     public void setCrossContext(boolean crossContext) {
00170         this.crossContext = crossContext;
00171     }
00172 
00173     public String getDocBase() {
00174         return docBase;
00175     }
00176 
00177     public void setDocBase(String docBase) {
00178         this.docBase = docBase;
00179     }
00180     
00181     public boolean isOverride() {
00182         return override;
00183     }
00184 
00185     public void setOverride(boolean override) {
00186         this.override = override;
00187     }
00188     public int getState() {
00189         return state;
00190     }
00191 
00192     public void setState(int state) {
00193         this.state = state;
00194     }
00195 
00196 
00197 }

Generated on Tue Feb 15 15:05:31 2005 for JOnAS by  doxygen 1.3.9.1