1 25 26 package org.objectweb.jonas.webapp.jonasadmin.catalina; 27 28 import java.net.InetAddress ; 29 import java.util.List ; 30 31 import javax.servlet.http.HttpServletRequest ; 32 33 import org.apache.struts.action.ActionMessage; 34 import org.apache.struts.action.ActionErrors; 35 import org.apache.struts.action.ActionForm; 36 import org.apache.struts.action.ActionMapping; 37 38 46 47 public final class ConnectorForm extends ActionForm { 48 49 51 54 private String action = "edit"; 55 56 59 private boolean save = false; 60 61 64 private String objectName = null; 65 66 69 private String serviceName = null; 70 73 private String connectorType = null; 74 75 80 private boolean allowTrace = false; 81 84 private boolean emptySessionPath = false; 85 88 private boolean enableLookups = true; 89 92 private String maxPostSizeText = "2097152"; 93 96 private String protocol = "HTTP/1.1"; 97 100 private String proxyName = null; 101 104 private String proxyPortText = "0"; 105 108 private String scheme = "http"; 109 112 private boolean secure = false; 113 116 private String URIEncoding = null; 117 120 private boolean useBodyEncodingForURI = false; 121 124 private boolean xpoweredBy = false; 125 126 131 private String acceptCountText = "10"; 132 135 private String address = null; 136 139 private String portText = null; 140 143 private String redirectPortText = "-1"; 144 147 private boolean tcpNoDelay = true; 148 149 154 private String minSpareThreadsText = "4"; 155 158 private String maxSpareThreadsText = "50"; 159 162 private String maxThreadsText = "200"; 163 164 168 private String bufferSizeText = "2048"; 169 172 private String compression = "off"; 173 177 private String connectionLingerText = "-1"; 178 181 private String connTimeOutText = "60000"; 182 186 private String connectionUploadTimeoutText = null; 187 190 private boolean disableUploadTimeout = false; 191 194 private String maxHttpHeaderSizeText = "4096"; 195 198 private String maxKeepAliveRequestsText = "100"; 199 202 private String strategy = "If"; 203 206 private String threadPriorityText = "5"; 207 208 212 private boolean tomcatAuthentication = true; 213 214 218 private String algorithm = "SunX509"; 219 222 private boolean clientAuth = false; 223 226 private String keystoreFile = ".keystore"; 227 230 private String keystorePass = "changeit"; 231 234 private String keystoreType = "JKS"; 235 238 private String sslProtocol = "TLS"; 239 242 private String ciphers = null; 243 244 248 private String debugLvl = "0"; 249 250 253 private String connectorName = null; 254 255 258 private List debugLvlVals = null; 259 260 263 private List booleanVals = null; 264 265 268 private List connectorTypeVals = null; 269 270 273 private String minProcessorsText = "5"; 274 275 278 private String maxProcessorsText = "20"; 279 280 292 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 293 294 ActionErrors oErrors = new ActionErrors(); 295 296 numberCheck(oErrors, "acceptCountText", acceptCountText, true, 0, 128); 298 numberCheck(oErrors, "connTimeOutText", connTimeOutText, true, -1, 60000); 299 numberCheck(oErrors, "bufferSizeText", bufferSizeText, true, 1, 8192); 300 301 if (address.length() > 0) { 304 try { 305 InetAddress.getByName(address); 306 } catch (Exception e) { 307 oErrors.add("address", new ActionMessage("error.catalina.connector.address.invalid")); 308 } 309 } else { 310 address = null; 311 } 312 313 numberCheck(oErrors, "portNumber", portText, true, 1, 65535); 315 numberCheck(oErrors, "redirectPortText", redirectPortText, true, -1, 65535); 316 317 numberCheck(oErrors, "maxThreadsText", maxThreadsText, true, 1, 65535); 318 numberCheck(oErrors, "maxSpareThreadsText", maxSpareThreadsText, true, 1, 65535); 319 numberCheck(oErrors, "minSpareThreadsText", minSpareThreadsText, true, 1, 65535); 320 try { 321 int min = Integer.parseInt(minSpareThreadsText); 323 numberCheck(oErrors, "maxThreadsText", maxThreadsText, true, min, 65535); 324 } catch (Exception e) { 325 } 326 327 if ((proxyName != null) && (proxyName.length() > 0)) { 329 try { 330 InetAddress.getByName(proxyName); 331 } catch (Exception e) { 332 oErrors.add("proxyName" 333 , new ActionMessage("error.catalina.connector.proxyName.invalid")); 334 } 335 } 336 337 if (!("AJP".equalsIgnoreCase(connectorType))) { 339 numberCheck(oErrors, "proxyPortText", proxyPortText, true, 0, 65535); 340 } 341 342 return oErrors; 343 } 344 345 357 public void numberCheck(ActionErrors pErrors, String field, String numText, boolean rangeCheck 358 , int min, int max) { 359 if ((numText == null) || (numText.length() < 1)) { 361 pErrors.add(field, new ActionMessage("error.catalina.connector." + field + ".required")); 362 } else { 363 364 try { 366 int num = Integer.parseInt(numText); 367 if (rangeCheck) { 369 if ((num < min) || (num > max)) { 370 pErrors.add(field 371 , new ActionMessage("error.catalina.connector." + field + ".range")); 372 } 373 } 374 } catch (NumberFormatException e) { 375 pErrors.add(field, new ActionMessage("error.catalina.connector." + field + ".format")); 376 } 377 } 378 } 379 380 382 386 public String getAction() { 387 return this.action; 388 } 389 390 394 public void setAction(String action) { 395 this.action = action; 396 } 397 398 402 public String getObjectName() { 403 return this.objectName; 404 } 405 406 410 public void setObjectName(String objectName) { 411 this.objectName = objectName; 412 } 413 414 418 public String getServiceName() { 419 return this.serviceName; 420 } 421 422 426 public void setServiceName(String serviceName) { 427 this.serviceName = serviceName; 428 } 429 430 434 public String getScheme() { 435 return this.scheme; 436 } 437 441 public void setScheme(String scheme) { 442 this.scheme = scheme; 443 } 444 445 449 public String getConnectorType() { 450 return this.connectorType; 451 } 452 453 457 public void setConnectorType(String connectorType) { 458 this.connectorType = connectorType; 459 } 460 461 465 public String getAcceptCountText() { 466 return this.acceptCountText; 467 } 468 469 473 public void setAcceptCountText(String acceptCountText) { 474 this.acceptCountText = acceptCountText; 475 } 476 477 481 public String getConnTimeOutText() { 482 return this.connTimeOutText; 483 } 484 485 489 public void setConnTimeOutText(String connTimeOutText) { 490 this.connTimeOutText = connTimeOutText; 491 } 492 493 497 public String getBufferSizeText() { 498 return this.bufferSizeText; 499 } 500 501 505 public void setBufferSizeText(String bufferSizeText) { 506 this.bufferSizeText = bufferSizeText; 507 } 508 509 513 public String getAddress() { 514 return this.address; 515 } 516 517 521 public void setAddress(String address) { 522 this.address = address; 523 } 524 525 529 public String getProxyName() { 530 return this.proxyName; 531 } 532 533 537 public void setProxyName(String proxyName) { 538 this.proxyName = proxyName; 539 } 540 541 545 public String getProxyPortText() { 546 return this.proxyPortText; 547 } 548 549 553 public void setProxyPortText(String proxyPortText) { 554 this.proxyPortText = proxyPortText; 555 } 556 557 561 public boolean isClientAuth() { 562 return this.clientAuth; 563 } 564 565 569 public void setClientAuth(boolean clientAuthentication) { 570 this.clientAuth = clientAuthentication; 571 } 572 573 576 public String getKeystoreFile() { 577 return this.keystoreFile; 578 } 579 580 583 public void setKeystoreFile(String keyStoreFileName) { 584 this.keystoreFile = keyStoreFileName; 585 } 586 587 590 public String getKeystorePass() { 591 return this.keystorePass; 592 } 593 594 597 public void setKeystorePass(String keyStorePassword) { 598 this.keystorePass = keyStorePassword; 599 } 600 601 605 public List getDebugLvlVals() { 606 return this.debugLvlVals; 607 } 608 609 613 public void setDebugLvlVals(List debugLvlVals) { 614 this.debugLvlVals = debugLvlVals; 615 } 616 617 621 public String getDebugLvl() { 622 return this.debugLvl; 623 } 624 625 629 public void setDebugLvl(String debugLvl) { 630 this.debugLvl = debugLvl; 631 } 632 633 637 public boolean isEnableLookups() { 638 return this.enableLookups; 639 } 640 641 645 public void setEnableLookups(boolean enableLookups) { 646 this.enableLookups = enableLookups; 647 } 648 649 652 public List getBooleanVals() { 653 return this.booleanVals; 654 } 655 656 659 public void setBooleanVals(List booleanVals) { 660 this.booleanVals = booleanVals; 661 } 662 663 667 public String getMinSpareThreadsText() { 668 return this.minSpareThreadsText; 669 } 670 671 675 public void setMinSpareThreadsText(String minSpareThreadsText) { 676 this.minSpareThreadsText = minSpareThreadsText; 677 } 678 679 683 public String getMaxSpareThreadsText() { 684 return this.maxSpareThreadsText; 685 } 686 687 691 public void setMaxSpareThreadsText(String maxSpareThreadsText) { 692 this.maxSpareThreadsText = maxSpareThreadsText; 693 } 694 695 699 public String getMaxThreadsText() { 700 return this.maxThreadsText; 701 } 702 703 707 public void setMaxThreadsText(String maxThreadsText) { 708 this.maxThreadsText = maxThreadsText; 709 } 710 711 715 public String getPortText() { 716 return this.portText; 717 } 718 719 723 public void setPortText(String portText) { 724 this.portText = portText; 725 } 726 727 731 public String getRedirectPortText() { 732 return this.redirectPortText; 733 } 734 735 739 public void setRedirectPortText(String redirectPortText) { 740 this.redirectPortText = redirectPortText; 741 } 742 743 746 public String getConnectorName() { 747 return this.connectorName; 748 } 749 750 753 public void setConnectorName(String connectorName) { 754 this.connectorName = connectorName; 755 } 756 757 761 public List getConnectorTypeVals() { 762 return this.connectorTypeVals; 763 } 764 765 769 public void setConnectorTypeVals(List connectorTypeVals) { 770 this.connectorTypeVals = connectorTypeVals; 771 } 772 775 public String getLabel() { 776 StringBuffer sb = new StringBuffer (getPortText()); 777 if (getAddress() != null) { 778 sb.append(" ("); 779 sb.append(getAddress()); 780 sb.append(")"); 781 } 782 return sb.toString(); 783 } 784 785 789 public boolean isSave() { 790 return save; 791 } 792 793 797 public void setSave(boolean save) { 798 this.save = save; 799 } 800 803 public String getMinProcessorsText() { 804 return minProcessorsText; 805 } 806 809 public void setMinProcessorsText(String minProcessorsText) { 810 this.minProcessorsText = minProcessorsText; 811 } 812 815 public String getMaxProcessorsText() { 816 return maxProcessorsText; 817 } 818 821 public void setMaxProcessorsText(String maxProcessorsText) { 822 this.maxProcessorsText = maxProcessorsText; 823 } 824 825 828 public boolean isAllowTrace() { 829 return allowTrace; 830 } 831 834 public void setAllowTrace(boolean allowTrace) { 835 this.allowTrace = allowTrace; 836 } 837 838 841 public boolean isEmptySessionPath() { 842 return emptySessionPath; 843 } 844 847 public void setEmptySessionPath(boolean emptySessionPath) { 848 this.emptySessionPath = emptySessionPath; 849 } 850 851 854 public String getMaxPostSizeText() { 855 return maxPostSizeText; 856 } 857 858 859 862 public void setMaxPostSizeText(String maxPostSizeText) { 863 this.maxPostSizeText = maxPostSizeText; 864 } 865 866 869 public String getProtocol() { 870 return protocol; 871 } 872 873 876 public boolean isSecure() { 877 return secure; 878 } 879 880 881 884 public void setSecure(boolean secure) { 885 this.secure = secure; 886 } 887 888 891 public String getURIEncoding() { 892 return URIEncoding; 893 } 894 895 896 899 public void setURIEncoding(String encoding) { 900 URIEncoding = encoding; 901 } 902 903 906 public boolean isUseBodyEncodingForURI() { 907 return useBodyEncodingForURI; 908 } 909 910 911 914 public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) { 915 this.useBodyEncodingForURI = useBodyEncodingForURI; 916 } 917 918 921 public boolean isXpoweredBy() { 922 return xpoweredBy; 923 } 924 925 926 929 public void setXpoweredBy(boolean xpoweredBy) { 930 this.xpoweredBy = xpoweredBy; 931 } 932 933 936 public String getCompression() { 937 return compression; 938 } 939 940 941 944 public void setCompression(String compression) { 945 this.compression = compression; 946 } 947 948 951 public String getConnectionLingerText() { 952 return connectionLingerText; 953 } 954 955 956 959 public void setConnectionLingerText(String connectionLingerText) { 960 this.connectionLingerText = connectionLingerText; 961 } 962 963 966 public String getConnectionUploadTimeoutText() { 967 return connectionUploadTimeoutText; 968 } 969 970 971 974 public void setConnectionUploadTimeoutText(String connectionUploadTimeoutText) { 975 this.connectionUploadTimeoutText = connectionUploadTimeoutText; 976 } 977 978 981 public boolean isDisableUploadTimeout() { 982 return disableUploadTimeout; 983 } 984 985 986 989 public void setDisableUploadTimeout(boolean disableUploadTimeout) { 990 this.disableUploadTimeout = disableUploadTimeout; 991 } 992 993 996 public String getMaxHttpHeaderSizeText() { 997 return maxHttpHeaderSizeText; 998 } 999 1000 1001 1004 public void setMaxHttpHeaderSizeText(String maxHttpHeaderSize) { 1005 this.maxHttpHeaderSizeText = maxHttpHeaderSize; 1006 } 1007 1008 1011 public String getMaxKeepAliveRequestsText() { 1012 return maxKeepAliveRequestsText; 1013 } 1014 1015 1016 1019 public void setMaxKeepAliveRequestsText(String maxKeepAliveRequests) { 1020 this.maxKeepAliveRequestsText = maxKeepAliveRequests; 1021 } 1022 1023 1026 public String getStrategy() { 1027 return strategy; 1028 } 1029 1030 1031 1034 public void setStrategy(String strategy) { 1035 this.strategy = strategy; 1036 } 1037 1038 1041 public String getThreadPriorityText() { 1042 return threadPriorityText; 1043 } 1044 1045 1046 1049 public void setThreadPriorityText(String threadPriority) { 1050 this.threadPriorityText = threadPriority; 1051 } 1052 1053 1056 public boolean isTomcatAuthentication() { 1057 return tomcatAuthentication; 1058 } 1059 1060 1061 1064 public void setTomcatAuthentication(boolean tomcatAuthentication) { 1065 this.tomcatAuthentication = tomcatAuthentication; 1066 } 1067 1068 1071 public String getAlgorithm() { 1072 return algorithm; 1073 } 1074 1075 1076 1079 public void setAlgorithm(String algorithm) { 1080 this.algorithm = algorithm; 1081 } 1082 1083 1086 public String getKeystoreType() { 1087 return keystoreType; 1088 } 1089 1090 1091 1094 public void setKeystoreType(String keystoreType) { 1095 this.keystoreType = keystoreType; 1096 } 1097 1098 1101 public String getSslProtocol() { 1102 return sslProtocol; 1103 } 1104 1105 1106 1109 public void setSslProtocol(String sslProtocol) { 1110 this.sslProtocol = sslProtocol; 1111 } 1112 1113 1116 public String getCiphers() { 1117 return ciphers; 1118 } 1119 1120 1121 1124 public void setCiphers(String ciphers) { 1125 this.ciphers = ciphers; 1126 } 1127 1128 1131 public void setProtocol(String protocol) { 1132 this.protocol = protocol; 1133 } 1134 1135 1138 public boolean isTcpNoDelay() { 1139 return tcpNoDelay; 1140 } 1141 1142 1143 1146 public void setTcpNoDelay(boolean tcpNoDelay) { 1147 this.tcpNoDelay = tcpNoDelay; 1148 } 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170} 1171 | Popular Tags |