1 23 24 28 29 package com.sun.enterprise.config.serverbeans; 30 31 import org.w3c.dom.*; 32 import org.netbeans.modules.schema2beans.*; 33 import java.beans.*; 34 import java.util.*; 35 import java.io.Serializable ; 36 import com.sun.enterprise.config.ConfigBean; 37 import com.sun.enterprise.config.ConfigException; 38 import com.sun.enterprise.config.StaleWriteConfigException; 39 import com.sun.enterprise.util.i18n.StringManager; 40 41 43 public class HttpProtocol extends ConfigBean implements Serializable 44 { 45 46 static Vector comparators = new Vector(); 47 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0); 48 49 50 public HttpProtocol() { 51 this(Common.USE_DEFAULT_VALUES); 52 } 53 54 public HttpProtocol(int options) 55 { 56 super(comparators, runtimeVersion); 57 initPropertyTables(0); 59 this.initialize(options); 60 } 61 62 void initialize(int options) { 64 65 } 66 67 71 public String getVersion() { 72 return getAttributeValue(ServerTags.VERSION); 73 } 74 79 public void setVersion(String v, boolean overwrite) throws StaleWriteConfigException { 80 setAttributeValue(ServerTags.VERSION, v, overwrite); 81 } 82 86 public void setVersion(String v) { 87 setAttributeValue(ServerTags.VERSION, v); 88 } 89 92 public static String getDefaultVersion() { 93 return "HTTP/1.1".trim(); 94 } 95 99 public boolean isDnsLookupEnabled() { 100 return toBoolean(getAttributeValue(ServerTags.DNS_LOOKUP_ENABLED)); 101 } 102 107 public void setDnsLookupEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 108 setAttributeValue(ServerTags.DNS_LOOKUP_ENABLED, ""+(v==true), overwrite); 109 } 110 114 public void setDnsLookupEnabled(boolean v) { 115 setAttributeValue(ServerTags.DNS_LOOKUP_ENABLED, ""+(v==true)); 116 } 117 120 public static String getDefaultDnsLookupEnabled() { 121 return "false".trim(); 122 } 123 127 public String getForcedResponseType() { 128 return getAttributeValue(ServerTags.FORCED_RESPONSE_TYPE); 129 } 130 135 public void setForcedResponseType(String v, boolean overwrite) throws StaleWriteConfigException { 136 setAttributeValue(ServerTags.FORCED_RESPONSE_TYPE, v, overwrite); 137 } 138 142 public void setForcedResponseType(String v) { 143 setAttributeValue(ServerTags.FORCED_RESPONSE_TYPE, v); 144 } 145 148 public static String getDefaultForcedResponseType() { 149 return "text/html; charset=iso-8859-1".trim(); 150 } 151 155 public String getDefaultResponseType() { 156 return getAttributeValue(ServerTags.DEFAULT_RESPONSE_TYPE); 157 } 158 163 public void setDefaultResponseType(String v, boolean overwrite) throws StaleWriteConfigException { 164 setAttributeValue(ServerTags.DEFAULT_RESPONSE_TYPE, v, overwrite); 165 } 166 170 public void setDefaultResponseType(String v) { 171 setAttributeValue(ServerTags.DEFAULT_RESPONSE_TYPE, v); 172 } 173 176 public static String getDefaultDefaultResponseType() { 177 return "text/html; charset=iso-8859-1".trim(); 178 } 179 183 public boolean isSslEnabled() { 184 return toBoolean(getAttributeValue(ServerTags.SSL_ENABLED)); 185 } 186 191 public void setSslEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 192 setAttributeValue(ServerTags.SSL_ENABLED, ""+(v==true), overwrite); 193 } 194 198 public void setSslEnabled(boolean v) { 199 setAttributeValue(ServerTags.SSL_ENABLED, ""+(v==true)); 200 } 201 204 public static String getDefaultSslEnabled() { 205 return "true".trim(); 206 } 207 212 protected String getRelativeXPath() { 213 String ret = null; 214 ret = "http-protocol"; 215 return (null != ret ? ret.trim() : null); 216 } 217 218 221 public static String getDefaultAttributeValue(String attr) { 222 if(attr == null) return null; 223 attr = attr.trim(); 224 if(attr.equals(ServerTags.VERSION)) return "HTTP/1.1".trim(); 225 if(attr.equals(ServerTags.DNS_LOOKUP_ENABLED)) return "false".trim(); 226 if(attr.equals(ServerTags.FORCED_RESPONSE_TYPE)) return "text/html; charset=iso-8859-1".trim(); 227 if(attr.equals(ServerTags.DEFAULT_RESPONSE_TYPE)) return "text/html; charset=iso-8859-1".trim(); 228 if(attr.equals(ServerTags.SSL_ENABLED)) return "true".trim(); 229 return null; 230 } 231 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 233 comparators.add(c); 234 } 235 236 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 238 comparators.remove(c); 239 } 240 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 241 } 242 243 public void dump(StringBuffer str, String indent){ 245 String s; 246 Object o; 247 org.netbeans.modules.schema2beans.BaseBean n; 248 } 249 public String dumpBeanNode(){ 250 StringBuffer str = new StringBuffer (); 251 str.append("HttpProtocol\n"); this.dump(str, "\n "); return str.toString(); 254 }} 255 256 258 | Popular Tags |