1 16 17 18 package org.apache.webapp.admin.connector; 19 20 import javax.servlet.http.HttpServletRequest ; 21 import org.apache.struts.action.ActionError; 22 import org.apache.struts.action.ActionErrors; 23 import org.apache.struts.action.ActionForm; 24 import org.apache.struts.action.ActionMapping; 25 import java.net.InetAddress ; 26 import java.util.List ; 27 28 34 35 public final class ConnectorForm extends ActionForm { 36 37 39 42 private String adminAction = "Edit"; 43 44 47 private String objectName = null; 48 49 52 private String serviceName = null; 53 54 57 private String scheme = null; 58 59 63 private String connectorType = null; 64 65 68 private String nodeLabel = null; 69 70 73 private String acceptCountText = null; 74 75 78 private String algorithm = null; 79 80 83 private String ciphers = null; 84 85 88 private String connLingerText = null; 89 90 93 private String connTimeOutText = null; 94 95 98 private String connUploadTimeOutText = null; 99 100 103 private String bufferSizeText = null; 104 105 108 private String disableUploadTimeout = "false"; 109 110 113 private String enableLookups = "false"; 114 115 118 private String compression = "off"; 119 120 123 private String address = null; 124 125 128 private String minProcessorsText = null; 129 130 133 private String maxProcessorsText = null; 134 135 138 private String maxKeepAliveText = null; 139 140 143 private String maxSpare = null; 144 145 148 private String maxThreads = null; 149 150 153 private String minSpare = null; 154 155 158 private String threadPriority = null; 159 160 163 private String uriEncodingText = null; 164 165 168 private String useBodyEncodingForURI = "false"; 169 170 173 private String allowTrace = "false"; 174 175 178 private String portText = null; 179 180 183 private String redirectPortText = null; 184 185 188 private String proxyName = null; 189 190 193 private String proxyPortText = null; 194 195 196 199 private String connectorName = null; 200 201 204 private String clientAuthentication = "false"; 205 206 209 private String keyStoreFileName = null; 210 211 214 private String keyStorePassword = null; 215 216 219 private String keyStoreType = null; 220 221 224 private String sslProtocol= null; 225 226 229 private List booleanVals = null; 230 231 234 private List connectorTypeVals = null; 235 236 239 private List clientAuthVals = null; 240 241 244 private String secure = "false"; 245 248 private String tcpNoDelay = "true"; 249 250 253 private String xpoweredBy = "false"; 254 255 257 260 public String getAdminAction() { 261 262 return this.adminAction; 263 264 } 265 266 267 270 public void setAdminAction(String adminAction) { 271 272 this.adminAction = adminAction; 273 274 } 275 276 279 public String getObjectName() { 280 281 return this.objectName; 282 283 } 284 285 286 289 public void setObjectName(String objectName) { 290 291 this.objectName = objectName; 292 293 } 294 295 298 public String getServiceName() { 299 300 return this.serviceName; 301 302 } 303 304 305 308 public void setServiceName(String serviceName) { 309 310 this.serviceName = serviceName; 311 312 } 313 314 317 public String getScheme() { 318 319 return this.scheme; 320 321 } 322 323 326 public void setScheme(String scheme) { 327 328 this.scheme = scheme; 329 330 } 331 332 335 public String getConnectorType() { 336 337 return this.connectorType; 338 339 } 340 341 344 public void setConnectorType(String connectorType) { 345 346 this.connectorType = connectorType; 347 348 } 349 350 353 public String getNodeLabel() { 354 355 return this.nodeLabel; 356 357 } 358 359 362 public void setNodeLabel(String nodeLabel) { 363 364 this.nodeLabel = nodeLabel; 365 366 } 367 368 371 public String getAcceptCountText() { 372 373 return this.acceptCountText; 374 375 } 376 377 378 381 382 public void setAcceptCountText(String acceptCountText) { 383 384 this.acceptCountText = acceptCountText; 385 386 } 387 388 391 public String getAlgorithm() { 392 393 return this.algorithm; 394 395 } 396 397 398 401 402 public void setAlgorithm(String algorithm) { 403 404 this.algorithm = algorithm; 405 406 } 407 408 411 public String getCiphers() { 412 413 return this.ciphers; 414 415 } 416 417 420 421 public void setCiphers(String ciphers) { 422 423 this.ciphers = ciphers; 424 425 } 426 427 430 public String getConnLingerText() { 431 432 return this.connLingerText; 433 434 } 435 436 439 440 public void setConnLingerText(String connLingerText) { 441 442 this.connLingerText = connLingerText; 443 444 } 445 446 449 public String getConnTimeOutText() { 450 451 return this.connTimeOutText; 452 453 } 454 455 458 459 public void setConnTimeOutText(String connTimeOutText) { 460 461 this.connTimeOutText = connTimeOutText; 462 463 } 464 465 468 public String getConnUploadTimeOutText() { 469 470 return this.connUploadTimeOutText; 471 472 } 473 474 477 478 public void setConnUploadTimeOutText(String connUploadTimeOutText) { 479 480 this.connUploadTimeOutText = connUploadTimeOutText; 481 482 } 483 486 public String getBufferSizeText() { 487 488 return this.bufferSizeText; 489 490 } 491 492 495 496 public void setBufferSizeText(String bufferSizeText) { 497 498 this.bufferSizeText = bufferSizeText; 499 500 } 501 502 505 public String getAddress() { 506 507 return this.address; 508 509 } 510 511 514 515 public void setAddress(String address) { 516 517 this.address = address; 518 519 } 520 521 522 525 public String getProxyName() { 526 527 return this.proxyName; 528 529 } 530 531 534 535 public void setProxyName(String proxyName) { 536 537 this.proxyName = proxyName; 538 539 } 540 541 544 public String getProxyPortText() { 545 546 return this.proxyPortText; 547 548 } 549 550 553 554 public void setProxyPortText(String proxyPortText) { 555 556 this.proxyPortText = proxyPortText; 557 558 } 559 560 563 public String getClientAuthentication() { 564 565 return this.clientAuthentication; 566 567 } 568 569 570 573 public void setClientAuthentication(String clientAuthentication) { 574 575 this.clientAuthentication = clientAuthentication; 576 577 } 578 579 582 public String getKeyStoreFileName() { 583 584 return this.keyStoreFileName; 585 586 } 587 588 589 592 public void setKeyStoreFileName(String keyStoreFileName) { 593 594 this.keyStoreFileName = keyStoreFileName; 595 596 } 597 598 601 public String getKeyStorePassword() { 602 603 return this.keyStorePassword; 604 605 } 606 607 608 611 public void setKeyStorePassword(String keyStorePassword) { 612 613 this.keyStorePassword = keyStorePassword; 614 615 } 616 617 620 public String getKeyStoreType() { 621 622 return this.keyStoreType; 623 624 } 625 626 627 630 public void setKeyStoreType(String keyStoreType) { 631 632 this.keyStoreType = keyStoreType; 633 634 } 635 638 public String getSslProtocol() { 639 640 return this.sslProtocol; 641 642 } 643 644 645 648 public void setSslProtocol(String sslProtocol) { 649 650 this.sslProtocol = sslProtocol; 651 652 } 653 654 657 658 public String getEnableLookups() { 659 660 return this.enableLookups; 661 662 } 663 664 667 public void setEnableLookups(String enableLookups) { 668 669 this.enableLookups = enableLookups; 670 671 } 672 673 676 677 public String getDisableUploadTimeout() { 678 679 return this.disableUploadTimeout; 680 681 } 682 683 686 public void setDisableUploadTimeout(String disableUploadTimeout) { 687 688 this.disableUploadTimeout = disableUploadTimeout; 689 690 } 691 692 695 696 public String getCompression() { 697 698 return this.compression; 699 700 } 701 702 705 public void setCompression(String compression) { 706 707 this.compression = compression; 708 709 } 710 711 714 public List getBooleanVals() { 715 716 return this.booleanVals; 717 718 } 719 720 723 public void setBooleanVals(List booleanVals) { 724 725 this.booleanVals = booleanVals; 726 727 } 728 729 732 public List getClientAuthVals() { 733 return clientAuthVals; 734 } 735 738 public void setClientAuthVals(List clientAuthVals) { 739 this.clientAuthVals = clientAuthVals; 740 } 741 742 745 public String getMinProcessorsText() { 746 747 return this.minProcessorsText; 748 749 } 750 751 754 public void setMinProcessorsText(String minProcessorsText) { 755 756 this.minProcessorsText = minProcessorsText; 757 758 } 759 760 763 public String getMaxProcessorsText() { 764 765 return this.maxProcessorsText; 766 767 } 768 769 772 public void setMaxProcessorsText(String maxProcessorsText) { 773 774 this.maxProcessorsText = maxProcessorsText; 775 776 } 777 778 781 public String getMaxKeepAliveText() { 782 783 return this.maxKeepAliveText; 784 785 } 786 787 790 791 public void setMaxKeepAliveText(String maxKeepAliveText) { 792 793 this.maxKeepAliveText = maxKeepAliveText; 794 795 } 796 797 800 public String getMaxSpare() { 801 802 return this.maxSpare; 803 804 } 805 806 809 810 public void setMaxSpare(String maxSpare) { 811 812 this.maxSpare = maxSpare; 813 814 } 815 816 819 public String getMaxThreads() { 820 821 return this.maxThreads; 822 823 } 824 825 828 829 public void setMaxThreads(String maxThreads) { 830 831 this.maxThreads = maxThreads; 832 833 } 834 835 838 public String getMinSpare() { 839 840 return this.minSpare; 841 842 } 843 844 847 848 public void setMinSpare(String minSpare) { 849 850 this.minSpare = minSpare; 851 852 } 853 854 857 public String getThreadPriority() { 858 859 return this.threadPriority; 860 861 } 862 863 866 867 public void setThreadPriority(String threadPriority) { 868 869 this.threadPriority = threadPriority; 870 871 } 872 873 876 public String getURIEncodingText() { 877 878 return this.uriEncodingText; 879 880 } 881 882 885 public void setURIEncodingText(String uriEncodingText) { 886 887 this.uriEncodingText = uriEncodingText; 888 889 } 890 891 894 public String getUseBodyEncodingForURIText() { 895 896 return this.useBodyEncodingForURI; 897 898 } 899 900 903 public void setUseBodyEncodingForURIText(String useBodyEncodingForURI) { 904 905 this.useBodyEncodingForURI = useBodyEncodingForURI; 906 907 } 908 909 912 public String getAllowTraceText() { 913 914 return this.allowTrace; 915 916 } 917 918 921 public void setAllowTraceText(String allowTrace) { 922 923 this.allowTrace = allowTrace; 924 925 } 926 927 930 public String getPortText() { 931 932 return this.portText; 933 934 } 935 936 939 public void setPortText(String portText) { 940 941 this.portText = portText; 942 943 } 944 945 946 949 public String getRedirectPortText() { 950 951 return this.redirectPortText; 952 953 } 954 955 958 public void setRedirectPortText(String redirectPortText) { 959 960 this.redirectPortText = redirectPortText; 961 962 } 963 964 967 public String getConnectorName() { 968 969 return this.connectorName; 970 971 } 972 973 976 public void setConnectorName(String connectorName) { 977 978 this.connectorName = connectorName; 979 980 } 981 982 985 public List getConnectorTypeVals() { 986 987 return this.connectorTypeVals; 988 989 } 990 991 994 public void setConnectorTypeVals(List connectorTypeVals) { 995 996 this.connectorTypeVals = connectorTypeVals; 997 998 } 999 1000 1003 public String getSecure() { 1004 1005 return this.secure; 1006 1007 } 1008 1009 1012 public void setSecure(String secure) { 1013 1014 this.secure = secure; 1015 1016 } 1017 1018 1021 public String getTcpNoDelay() { 1022 1023 return this.tcpNoDelay; 1024 1025 } 1026 1027 1030 public void setTcpNoDelay(String tcpNoDelay) { 1031 1032 this.tcpNoDelay = tcpNoDelay; 1033 1034 } 1035 1036 1039 public String getXpoweredBy() { 1040 1041 return this.xpoweredBy; 1042 1043 } 1044 1045 1048 public void setXpoweredBy(String xpoweredBy) { 1049 1050 this.xpoweredBy = xpoweredBy; 1051 1052 } 1053 1054 1056 1062 public void reset(ActionMapping mapping, HttpServletRequest request) { 1063 1064 this.objectName = null; 1065 this.connectorType = null; 1066 this.portText = null; 1067 this.acceptCountText = null; 1068 this.connLingerText = null; 1069 this.connTimeOutText = null; 1070 this.connUploadTimeOutText = null; 1071 this.bufferSizeText = null; 1072 this.address = null; 1073 this.enableLookups = "false"; 1074 this.compression = "off"; 1075 this.minProcessorsText = null; 1076 this.maxProcessorsText = null; 1077 this.maxKeepAliveText = null; 1078 this.maxSpare = null; 1079 this.maxThreads = null; 1080 this.minSpare = null; 1081 this.threadPriority = null; 1082 this.uriEncodingText = null; 1083 this.useBodyEncodingForURI = "false"; 1084 this.allowTrace = "false"; 1085 this.portText = null; 1086 this.redirectPortText = null; 1087 this.proxyName = null; 1088 this.proxyPortText = null; 1089 this.keyStoreFileName = null; 1090 this.keyStorePassword = null; 1091 this.clientAuthentication = "false"; 1092 this.secure = "false"; 1093 this.tcpNoDelay = "false"; 1094 this.xpoweredBy = "false"; 1095 1096 } 1097 1098 1108 1109 private ActionErrors errors; 1110 1111 public ActionErrors validate(ActionMapping mapping, 1112 HttpServletRequest request) { 1113 1114 errors = new ActionErrors(); 1115 1116 String submit = request.getParameter("submit"); 1117 1120 1122 if ((address.length() > 0) && !address.equalsIgnoreCase(" ")) { 1123 try { 1124 InetAddress.getByName(address); 1125 } catch (Exception e) { 1126 errors.add("address", new ActionError("error.address.invalid")); 1127 } 1128 } else { 1129 address = " "; 1130 } 1131 1132 1133 numberCheck("portNumber", portText, true, 1, 65535); 1134 numberCheck("redirectPortText", redirectPortText, true, -1, 65535); 1135 1136 1137 1147 if ((proxyName!= null) && (proxyName.length() > 0)) { 1149 try { 1150 InetAddress.getByName(proxyName); 1151 } catch (Exception e) { 1152 errors.add("proxyName", new ActionError("error.proxyName.invalid")); 1153 } 1154 } 1155 1156 if (!("AJP".equalsIgnoreCase(connectorType))) { 1158 numberCheck("acceptCountText", acceptCountText, true, 0, 128); 1159 numberCheck("bufferSizeText", bufferSizeText, true, 1, 8192); 1161 numberCheck("proxyPortText", proxyPortText, true, 0, 65535); 1162 } 1163 1165 return errors; 1166 } 1167 1168 1180 1181 public void numberCheck(String field, String numText, boolean rangeCheck, 1182 int min, int max) { 1183 1184 1185 if ((numText == null) || (numText.length() < 1)) { 1186 errors.add(field, new ActionError("error."+field+".required")); 1187 } else { 1188 1189 1190 try { 1191 int num = Integer.parseInt(numText); 1192 if (rangeCheck) { 1194 if ((num < min) || (num > max )) 1195 errors.add( field, 1196 new ActionError("error."+ field +".range")); 1197 } 1198 } catch (NumberFormatException e) { 1199 errors.add(field, 1200 new ActionError("error."+ field + ".format")); 1201 } 1202 } 1203 } 1204 1205} 1206 | Popular Tags |