001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.web; 018 019import java.io.File; 020import java.net.InetAddress; 021import java.nio.charset.Charset; 022import java.nio.charset.StandardCharsets; 023import java.time.Duration; 024import java.time.temporal.ChronoUnit; 025import java.util.ArrayList; 026import java.util.HashMap; 027import java.util.List; 028import java.util.Locale; 029import java.util.Map; 030import java.util.TimeZone; 031 032import org.springframework.boot.context.properties.ConfigurationProperties; 033import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; 034import org.springframework.boot.context.properties.NestedConfigurationProperty; 035import org.springframework.boot.convert.DurationUnit; 036import org.springframework.boot.web.server.Compression; 037import org.springframework.boot.web.server.Http2; 038import org.springframework.boot.web.server.Ssl; 039import org.springframework.boot.web.servlet.server.Jsp; 040import org.springframework.boot.web.servlet.server.Session; 041import org.springframework.util.StringUtils; 042import org.springframework.util.unit.DataSize; 043 044/** 045 * {@link ConfigurationProperties} for a web server (e.g. port and path settings). 046 * 047 * @author Dave Syer 048 * @author Stephane Nicoll 049 * @author Andy Wilkinson 050 * @author Ivan Sopov 051 * @author Marcos Barbero 052 * @author Eddú Meléndez 053 * @author Quinten De Swaef 054 * @author Venil Noronha 055 * @author Aurélien Leboulanger 056 * @author Brian Clozel 057 * @author Olivier Lamy 058 * @author Chentao Qu 059 */ 060@ConfigurationProperties(prefix = "server", ignoreUnknownFields = true) 061public class ServerProperties { 062 063 /** 064 * Server HTTP port. 065 */ 066 private Integer port; 067 068 /** 069 * Network address to which the server should bind. 070 */ 071 private InetAddress address; 072 073 @NestedConfigurationProperty 074 private final ErrorProperties error = new ErrorProperties(); 075 076 /** 077 * Whether X-Forwarded-* headers should be applied to the HttpRequest. 078 */ 079 private Boolean useForwardHeaders; 080 081 /** 082 * Value to use for the Server response header (if empty, no header is sent). 083 */ 084 private String serverHeader; 085 086 /** 087 * Maximum size of the HTTP message header. 088 */ 089 private DataSize maxHttpHeaderSize = DataSize.ofKilobytes(8); 090 091 /** 092 * Time that connectors wait for another HTTP request before closing the connection. 093 * When not set, the connector's container-specific default is used. Use a value of -1 094 * to indicate no (that is, an infinite) timeout. 095 */ 096 private Duration connectionTimeout; 097 098 @NestedConfigurationProperty 099 private Ssl ssl; 100 101 @NestedConfigurationProperty 102 private final Compression compression = new Compression(); 103 104 @NestedConfigurationProperty 105 private final Http2 http2 = new Http2(); 106 107 private final Servlet servlet = new Servlet(); 108 109 private final Tomcat tomcat = new Tomcat(); 110 111 private final Jetty jetty = new Jetty(); 112 113 private final Undertow undertow = new Undertow(); 114 115 public Integer getPort() { 116 return this.port; 117 } 118 119 public void setPort(Integer port) { 120 this.port = port; 121 } 122 123 public InetAddress getAddress() { 124 return this.address; 125 } 126 127 public void setAddress(InetAddress address) { 128 this.address = address; 129 } 130 131 public Boolean isUseForwardHeaders() { 132 return this.useForwardHeaders; 133 } 134 135 public void setUseForwardHeaders(Boolean useForwardHeaders) { 136 this.useForwardHeaders = useForwardHeaders; 137 } 138 139 public String getServerHeader() { 140 return this.serverHeader; 141 } 142 143 public void setServerHeader(String serverHeader) { 144 this.serverHeader = serverHeader; 145 } 146 147 public DataSize getMaxHttpHeaderSize() { 148 return this.maxHttpHeaderSize; 149 } 150 151 public void setMaxHttpHeaderSize(DataSize maxHttpHeaderSize) { 152 this.maxHttpHeaderSize = maxHttpHeaderSize; 153 } 154 155 public Duration getConnectionTimeout() { 156 return this.connectionTimeout; 157 } 158 159 public void setConnectionTimeout(Duration connectionTimeout) { 160 this.connectionTimeout = connectionTimeout; 161 } 162 163 public ErrorProperties getError() { 164 return this.error; 165 } 166 167 public Ssl getSsl() { 168 return this.ssl; 169 } 170 171 public void setSsl(Ssl ssl) { 172 this.ssl = ssl; 173 } 174 175 public Compression getCompression() { 176 return this.compression; 177 } 178 179 public Http2 getHttp2() { 180 return this.http2; 181 } 182 183 public Servlet getServlet() { 184 return this.servlet; 185 } 186 187 public Tomcat getTomcat() { 188 return this.tomcat; 189 } 190 191 public Jetty getJetty() { 192 return this.jetty; 193 } 194 195 public Undertow getUndertow() { 196 return this.undertow; 197 } 198 199 /** 200 * Servlet properties. 201 */ 202 public static class Servlet { 203 204 /** 205 * Servlet context init parameters. 206 */ 207 private final Map<String, String> contextParameters = new HashMap<>(); 208 209 /** 210 * Context path of the application. 211 */ 212 private String contextPath; 213 214 /** 215 * Display name of the application. 216 */ 217 private String applicationDisplayName = "application"; 218 219 @NestedConfigurationProperty 220 private final Jsp jsp = new Jsp(); 221 222 @NestedConfigurationProperty 223 private final Session session = new Session(); 224 225 public String getContextPath() { 226 return this.contextPath; 227 } 228 229 public void setContextPath(String contextPath) { 230 this.contextPath = cleanContextPath(contextPath); 231 } 232 233 private String cleanContextPath(String contextPath) { 234 if (StringUtils.hasText(contextPath) && contextPath.endsWith("/")) { 235 return contextPath.substring(0, contextPath.length() - 1); 236 } 237 return contextPath; 238 } 239 240 public String getApplicationDisplayName() { 241 return this.applicationDisplayName; 242 } 243 244 public void setApplicationDisplayName(String displayName) { 245 this.applicationDisplayName = displayName; 246 } 247 248 public Map<String, String> getContextParameters() { 249 return this.contextParameters; 250 } 251 252 public Jsp getJsp() { 253 return this.jsp; 254 } 255 256 public Session getSession() { 257 return this.session; 258 } 259 260 } 261 262 /** 263 * Tomcat properties. 264 */ 265 public static class Tomcat { 266 267 /** 268 * Access log configuration. 269 */ 270 private final Accesslog accesslog = new Accesslog(); 271 272 /** 273 * Regular expression that matches proxies that are to be trusted. 274 */ 275 private String internalProxies = "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 10/8 276 + "192\\.168\\.\\d{1,3}\\.\\d{1,3}|" // 192.168/16 277 + "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16 278 + "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 127/8 279 + "172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 172.16/12 280 + "172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" 281 + "172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 282 + "0:0:0:0:0:0:0:1|::1"; 283 284 /** 285 * Header that holds the incoming protocol, usually named "X-Forwarded-Proto". 286 */ 287 private String protocolHeader; 288 289 /** 290 * Value of the protocol header indicating whether the incoming request uses SSL. 291 */ 292 private String protocolHeaderHttpsValue = "https"; 293 294 /** 295 * Name of the HTTP header used to override the original port value. 296 */ 297 private String portHeader = "X-Forwarded-Port"; 298 299 /** 300 * Name of the HTTP header from which the remote IP is extracted. For instance, 301 * `X-FORWARDED-FOR`. 302 */ 303 private String remoteIpHeader; 304 305 /** 306 * Tomcat base directory. If not specified, a temporary directory is used. 307 */ 308 private File basedir; 309 310 /** 311 * Delay between the invocation of backgroundProcess methods. If a duration suffix 312 * is not specified, seconds will be used. 313 */ 314 @DurationUnit(ChronoUnit.SECONDS) 315 private Duration backgroundProcessorDelay = Duration.ofSeconds(10); 316 317 /** 318 * Maximum amount of worker threads. 319 */ 320 private int maxThreads = 200; 321 322 /** 323 * Minimum amount of worker threads. 324 */ 325 private int minSpareThreads = 10; 326 327 /** 328 * Maximum size of the HTTP post content. 329 */ 330 private DataSize maxHttpPostSize = DataSize.ofMegabytes(2); 331 332 /** 333 * Maximum size of the HTTP message header. 334 */ 335 private DataSize maxHttpHeaderSize = DataSize.ofBytes(0); 336 337 /** 338 * Maximum amount of request body to swallow. 339 */ 340 private DataSize maxSwallowSize = DataSize.ofMegabytes(2); 341 342 /** 343 * Whether requests to the context root should be redirected by appending a / to 344 * the path. 345 */ 346 private Boolean redirectContextRoot = true; 347 348 /** 349 * Whether HTTP 1.1 and later location headers generated by a call to sendRedirect 350 * will use relative or absolute redirects. 351 */ 352 private Boolean useRelativeRedirects; 353 354 /** 355 * Character encoding to use to decode the URI. 356 */ 357 private Charset uriEncoding = StandardCharsets.UTF_8; 358 359 /** 360 * Maximum number of connections that the server accepts and processes at any 361 * given time. Once the limit has been reached, the operating system may still 362 * accept connections based on the "acceptCount" property. 363 */ 364 private int maxConnections = 10000; 365 366 /** 367 * Maximum queue length for incoming connection requests when all possible request 368 * processing threads are in use. 369 */ 370 private int acceptCount = 100; 371 372 /** 373 * Comma-separated list of additional patterns that match jars to ignore for TLD 374 * scanning. The special '?' and '*' characters can be used in the pattern to 375 * match one and only one character and zero or more characters respectively. 376 */ 377 private List<String> additionalTldSkipPatterns = new ArrayList<>(); 378 379 /** 380 * Static resource configuration. 381 */ 382 private final Resource resource = new Resource(); 383 384 public int getMaxThreads() { 385 return this.maxThreads; 386 } 387 388 public void setMaxThreads(int maxThreads) { 389 this.maxThreads = maxThreads; 390 } 391 392 public int getMinSpareThreads() { 393 return this.minSpareThreads; 394 } 395 396 public void setMinSpareThreads(int minSpareThreads) { 397 this.minSpareThreads = minSpareThreads; 398 } 399 400 public DataSize getMaxHttpPostSize() { 401 return this.maxHttpPostSize; 402 } 403 404 public void setMaxHttpPostSize(DataSize maxHttpPostSize) { 405 this.maxHttpPostSize = maxHttpPostSize; 406 } 407 408 public Accesslog getAccesslog() { 409 return this.accesslog; 410 } 411 412 public Duration getBackgroundProcessorDelay() { 413 return this.backgroundProcessorDelay; 414 } 415 416 public void setBackgroundProcessorDelay(Duration backgroundProcessorDelay) { 417 this.backgroundProcessorDelay = backgroundProcessorDelay; 418 } 419 420 public File getBasedir() { 421 return this.basedir; 422 } 423 424 public void setBasedir(File basedir) { 425 this.basedir = basedir; 426 } 427 428 public String getInternalProxies() { 429 return this.internalProxies; 430 } 431 432 public void setInternalProxies(String internalProxies) { 433 this.internalProxies = internalProxies; 434 } 435 436 public String getProtocolHeader() { 437 return this.protocolHeader; 438 } 439 440 public void setProtocolHeader(String protocolHeader) { 441 this.protocolHeader = protocolHeader; 442 } 443 444 public String getProtocolHeaderHttpsValue() { 445 return this.protocolHeaderHttpsValue; 446 } 447 448 public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) { 449 this.protocolHeaderHttpsValue = protocolHeaderHttpsValue; 450 } 451 452 public String getPortHeader() { 453 return this.portHeader; 454 } 455 456 public void setPortHeader(String portHeader) { 457 this.portHeader = portHeader; 458 } 459 460 public Boolean getRedirectContextRoot() { 461 return this.redirectContextRoot; 462 } 463 464 public void setRedirectContextRoot(Boolean redirectContextRoot) { 465 this.redirectContextRoot = redirectContextRoot; 466 } 467 468 public Boolean getUseRelativeRedirects() { 469 return this.useRelativeRedirects; 470 } 471 472 public void setUseRelativeRedirects(Boolean useRelativeRedirects) { 473 this.useRelativeRedirects = useRelativeRedirects; 474 } 475 476 public String getRemoteIpHeader() { 477 return this.remoteIpHeader; 478 } 479 480 public void setRemoteIpHeader(String remoteIpHeader) { 481 this.remoteIpHeader = remoteIpHeader; 482 } 483 484 public Charset getUriEncoding() { 485 return this.uriEncoding; 486 } 487 488 public void setUriEncoding(Charset uriEncoding) { 489 this.uriEncoding = uriEncoding; 490 } 491 492 public int getMaxConnections() { 493 return this.maxConnections; 494 } 495 496 public void setMaxConnections(int maxConnections) { 497 this.maxConnections = maxConnections; 498 } 499 500 @Deprecated 501 @DeprecatedConfigurationProperty(replacement = "server.max-http-header-size") 502 public DataSize getMaxHttpHeaderSize() { 503 return this.maxHttpHeaderSize; 504 } 505 506 @Deprecated 507 public void setMaxHttpHeaderSize(DataSize maxHttpHeaderSize) { 508 this.maxHttpHeaderSize = maxHttpHeaderSize; 509 } 510 511 public DataSize getMaxSwallowSize() { 512 return this.maxSwallowSize; 513 } 514 515 public void setMaxSwallowSize(DataSize maxSwallowSize) { 516 this.maxSwallowSize = maxSwallowSize; 517 } 518 519 public int getAcceptCount() { 520 return this.acceptCount; 521 } 522 523 public void setAcceptCount(int acceptCount) { 524 this.acceptCount = acceptCount; 525 } 526 527 public List<String> getAdditionalTldSkipPatterns() { 528 return this.additionalTldSkipPatterns; 529 } 530 531 public void setAdditionalTldSkipPatterns(List<String> additionalTldSkipPatterns) { 532 this.additionalTldSkipPatterns = additionalTldSkipPatterns; 533 } 534 535 public Resource getResource() { 536 return this.resource; 537 } 538 539 /** 540 * Tomcat access log properties. 541 */ 542 public static class Accesslog { 543 544 /** 545 * Enable access log. 546 */ 547 private boolean enabled = false; 548 549 /** 550 * Format pattern for access logs. 551 */ 552 private String pattern = "common"; 553 554 /** 555 * Directory in which log files are created. Can be absolute or relative to 556 * the Tomcat base dir. 557 */ 558 private String directory = "logs"; 559 560 /** 561 * Log file name prefix. 562 */ 563 protected String prefix = "access_log"; 564 565 /** 566 * Log file name suffix. 567 */ 568 private String suffix = ".log"; 569 570 /** 571 * Whether to enable access log rotation. 572 */ 573 private boolean rotate = true; 574 575 /** 576 * Whether to defer inclusion of the date stamp in the file name until rotate 577 * time. 578 */ 579 private boolean renameOnRotate = false; 580 581 /** 582 * Date format to place in the log file name. 583 */ 584 private String fileDateFormat = ".yyyy-MM-dd"; 585 586 /** 587 * Set request attributes for the IP address, Hostname, protocol, and port 588 * used for the request. 589 */ 590 private boolean requestAttributesEnabled = false; 591 592 /** 593 * Whether to buffer output such that it is flushed only periodically. 594 */ 595 private boolean buffered = true; 596 597 public boolean isEnabled() { 598 return this.enabled; 599 } 600 601 public void setEnabled(boolean enabled) { 602 this.enabled = enabled; 603 } 604 605 public String getPattern() { 606 return this.pattern; 607 } 608 609 public void setPattern(String pattern) { 610 this.pattern = pattern; 611 } 612 613 public String getDirectory() { 614 return this.directory; 615 } 616 617 public void setDirectory(String directory) { 618 this.directory = directory; 619 } 620 621 public String getPrefix() { 622 return this.prefix; 623 } 624 625 public void setPrefix(String prefix) { 626 this.prefix = prefix; 627 } 628 629 public String getSuffix() { 630 return this.suffix; 631 } 632 633 public void setSuffix(String suffix) { 634 this.suffix = suffix; 635 } 636 637 public boolean isRotate() { 638 return this.rotate; 639 } 640 641 public void setRotate(boolean rotate) { 642 this.rotate = rotate; 643 } 644 645 public boolean isRenameOnRotate() { 646 return this.renameOnRotate; 647 } 648 649 public void setRenameOnRotate(boolean renameOnRotate) { 650 this.renameOnRotate = renameOnRotate; 651 } 652 653 public String getFileDateFormat() { 654 return this.fileDateFormat; 655 } 656 657 public void setFileDateFormat(String fileDateFormat) { 658 this.fileDateFormat = fileDateFormat; 659 } 660 661 public boolean isRequestAttributesEnabled() { 662 return this.requestAttributesEnabled; 663 } 664 665 public void setRequestAttributesEnabled(boolean requestAttributesEnabled) { 666 this.requestAttributesEnabled = requestAttributesEnabled; 667 } 668 669 public boolean isBuffered() { 670 return this.buffered; 671 } 672 673 public void setBuffered(boolean buffered) { 674 this.buffered = buffered; 675 } 676 677 } 678 679 /** 680 * Tomcat static resource properties. 681 */ 682 public static class Resource { 683 684 /** 685 * Whether static resource caching is permitted for this web application. 686 */ 687 private boolean allowCaching = true; 688 689 /** 690 * Time-to-live of the static resource cache. 691 */ 692 private Duration cacheTtl; 693 694 public boolean isAllowCaching() { 695 return this.allowCaching; 696 } 697 698 public void setAllowCaching(boolean allowCaching) { 699 this.allowCaching = allowCaching; 700 } 701 702 public Duration getCacheTtl() { 703 return this.cacheTtl; 704 } 705 706 public void setCacheTtl(Duration cacheTtl) { 707 this.cacheTtl = cacheTtl; 708 } 709 710 } 711 712 } 713 714 /** 715 * Jetty properties. 716 */ 717 public static class Jetty { 718 719 /** 720 * Access log configuration. 721 */ 722 private final Accesslog accesslog = new Accesslog(); 723 724 /** 725 * Maximum size of the HTTP post or put content. 726 */ 727 private DataSize maxHttpPostSize = DataSize.ofBytes(200000); 728 729 /** 730 * Number of acceptor threads to use. When the value is -1, the default, the 731 * number of acceptors is derived from the operating environment. 732 */ 733 private Integer acceptors = -1; 734 735 /** 736 * Number of selector threads to use. When the value is -1, the default, the 737 * number of selectors is derived from the operating environment. 738 */ 739 private Integer selectors = -1; 740 741 public Accesslog getAccesslog() { 742 return this.accesslog; 743 } 744 745 public DataSize getMaxHttpPostSize() { 746 return this.maxHttpPostSize; 747 } 748 749 public void setMaxHttpPostSize(DataSize maxHttpPostSize) { 750 this.maxHttpPostSize = maxHttpPostSize; 751 } 752 753 public Integer getAcceptors() { 754 return this.acceptors; 755 } 756 757 public void setAcceptors(Integer acceptors) { 758 this.acceptors = acceptors; 759 } 760 761 public Integer getSelectors() { 762 return this.selectors; 763 } 764 765 public void setSelectors(Integer selectors) { 766 this.selectors = selectors; 767 } 768 769 /** 770 * Jetty access log properties. 771 */ 772 public static class Accesslog { 773 774 /** 775 * Enable access log. 776 */ 777 private boolean enabled = false; 778 779 /** 780 * Log filename. If not specified, logs redirect to "System.err". 781 */ 782 private String filename; 783 784 /** 785 * Date format to place in log file name. 786 */ 787 private String fileDateFormat; 788 789 /** 790 * Number of days before rotated log files are deleted. 791 */ 792 private int retentionPeriod = 31; // no days 793 794 /** 795 * Append to log. 796 */ 797 private boolean append; 798 799 /** 800 * Enable extended NCSA format. 801 */ 802 private boolean extendedFormat; 803 804 /** 805 * Timestamp format of the request log. 806 */ 807 private String dateFormat = "dd/MMM/yyyy:HH:mm:ss Z"; 808 809 /** 810 * Locale of the request log. 811 */ 812 private Locale locale; 813 814 /** 815 * Timezone of the request log. 816 */ 817 private TimeZone timeZone = TimeZone.getTimeZone("GMT"); 818 819 /** 820 * Enable logging of the request cookies. 821 */ 822 private boolean logCookies; 823 824 /** 825 * Enable logging of the request hostname. 826 */ 827 private boolean logServer; 828 829 /** 830 * Enable logging of request processing time. 831 */ 832 private boolean logLatency; 833 834 public boolean isEnabled() { 835 return this.enabled; 836 } 837 838 public void setEnabled(boolean enabled) { 839 this.enabled = enabled; 840 } 841 842 public String getFilename() { 843 return this.filename; 844 } 845 846 public void setFilename(String filename) { 847 this.filename = filename; 848 } 849 850 public String getFileDateFormat() { 851 return this.fileDateFormat; 852 } 853 854 public void setFileDateFormat(String fileDateFormat) { 855 this.fileDateFormat = fileDateFormat; 856 } 857 858 public int getRetentionPeriod() { 859 return this.retentionPeriod; 860 } 861 862 public void setRetentionPeriod(int retentionPeriod) { 863 this.retentionPeriod = retentionPeriod; 864 } 865 866 public boolean isAppend() { 867 return this.append; 868 } 869 870 public void setAppend(boolean append) { 871 this.append = append; 872 } 873 874 public boolean isExtendedFormat() { 875 return this.extendedFormat; 876 } 877 878 public void setExtendedFormat(boolean extendedFormat) { 879 this.extendedFormat = extendedFormat; 880 } 881 882 public String getDateFormat() { 883 return this.dateFormat; 884 } 885 886 public void setDateFormat(String dateFormat) { 887 this.dateFormat = dateFormat; 888 } 889 890 public Locale getLocale() { 891 return this.locale; 892 } 893 894 public void setLocale(Locale locale) { 895 this.locale = locale; 896 } 897 898 public TimeZone getTimeZone() { 899 return this.timeZone; 900 } 901 902 public void setTimeZone(TimeZone timeZone) { 903 this.timeZone = timeZone; 904 } 905 906 public boolean isLogCookies() { 907 return this.logCookies; 908 } 909 910 public void setLogCookies(boolean logCookies) { 911 this.logCookies = logCookies; 912 } 913 914 public boolean isLogServer() { 915 return this.logServer; 916 } 917 918 public void setLogServer(boolean logServer) { 919 this.logServer = logServer; 920 } 921 922 public boolean isLogLatency() { 923 return this.logLatency; 924 } 925 926 public void setLogLatency(boolean logLatency) { 927 this.logLatency = logLatency; 928 } 929 930 } 931 932 } 933 934 /** 935 * Undertow properties. 936 */ 937 public static class Undertow { 938 939 /** 940 * Maximum size of the HTTP post content. When the value is -1, the default, the 941 * size is unlimited. 942 */ 943 private DataSize maxHttpPostSize = DataSize.ofBytes(-1); 944 945 /** 946 * Size of each buffer. The default is derived from the maximum amount of memory 947 * that is available to the JVM. 948 */ 949 private DataSize bufferSize; 950 951 /** 952 * Number of I/O threads to create for the worker. The default is derived from the 953 * number of available processors. 954 */ 955 private Integer ioThreads; 956 957 /** 958 * Number of worker threads. The default is 8 times the number of I/O threads. 959 */ 960 private Integer workerThreads; 961 962 /** 963 * Whether to allocate buffers outside the Java heap. The default is derived from 964 * the maximum amount of memory that is available to the JVM. 965 */ 966 private Boolean directBuffers; 967 968 /** 969 * Whether servlet filters should be initialized on startup. 970 */ 971 private boolean eagerFilterInit = true; 972 973 private final Accesslog accesslog = new Accesslog(); 974 975 public DataSize getMaxHttpPostSize() { 976 return this.maxHttpPostSize; 977 } 978 979 public void setMaxHttpPostSize(DataSize maxHttpPostSize) { 980 this.maxHttpPostSize = maxHttpPostSize; 981 } 982 983 public DataSize getBufferSize() { 984 return this.bufferSize; 985 } 986 987 public void setBufferSize(DataSize bufferSize) { 988 this.bufferSize = bufferSize; 989 } 990 991 public Integer getIoThreads() { 992 return this.ioThreads; 993 } 994 995 public void setIoThreads(Integer ioThreads) { 996 this.ioThreads = ioThreads; 997 } 998 999 public Integer getWorkerThreads() { 1000 return this.workerThreads; 1001 } 1002 1003 public void setWorkerThreads(Integer workerThreads) { 1004 this.workerThreads = workerThreads; 1005 } 1006 1007 public Boolean getDirectBuffers() { 1008 return this.directBuffers; 1009 } 1010 1011 public void setDirectBuffers(Boolean directBuffers) { 1012 this.directBuffers = directBuffers; 1013 } 1014 1015 public boolean isEagerFilterInit() { 1016 return this.eagerFilterInit; 1017 } 1018 1019 public void setEagerFilterInit(boolean eagerFilterInit) { 1020 this.eagerFilterInit = eagerFilterInit; 1021 } 1022 1023 public Accesslog getAccesslog() { 1024 return this.accesslog; 1025 } 1026 1027 /** 1028 * Undertow access log properties. 1029 */ 1030 public static class Accesslog { 1031 1032 /** 1033 * Whether to enable the access log. 1034 */ 1035 private boolean enabled = false; 1036 1037 /** 1038 * Format pattern for access logs. 1039 */ 1040 private String pattern = "common"; 1041 1042 /** 1043 * Log file name prefix. 1044 */ 1045 protected String prefix = "access_log."; 1046 1047 /** 1048 * Log file name suffix. 1049 */ 1050 private String suffix = "log"; 1051 1052 /** 1053 * Undertow access log directory. 1054 */ 1055 private File dir = new File("logs"); 1056 1057 /** 1058 * Whether to enable access log rotation. 1059 */ 1060 private boolean rotate = true; 1061 1062 public boolean isEnabled() { 1063 return this.enabled; 1064 } 1065 1066 public void setEnabled(boolean enabled) { 1067 this.enabled = enabled; 1068 } 1069 1070 public String getPattern() { 1071 return this.pattern; 1072 } 1073 1074 public void setPattern(String pattern) { 1075 this.pattern = pattern; 1076 } 1077 1078 public String getPrefix() { 1079 return this.prefix; 1080 } 1081 1082 public void setPrefix(String prefix) { 1083 this.prefix = prefix; 1084 } 1085 1086 public String getSuffix() { 1087 return this.suffix; 1088 } 1089 1090 public void setSuffix(String suffix) { 1091 this.suffix = suffix; 1092 } 1093 1094 public File getDir() { 1095 return this.dir; 1096 } 1097 1098 public void setDir(File dir) { 1099 this.dir = dir; 1100 } 1101 1102 public boolean isRotate() { 1103 return this.rotate; 1104 } 1105 1106 public void setRotate(boolean rotate) { 1107 this.rotate = rotate; 1108 } 1109 1110 } 1111 1112 } 1113 1114}