我看到一个
我的finatra服务器抛出了TooLongMessageException HTTP content length exceeded 5242880 bytes.
个异常。查看通过-help=true
可用的标志,看起来要设置的标志是maxRequestSize
。这是帮助命令的输出
flags:
-admin.announce='java.lang.String': Address for announcing admin server
-admin.port=':9990': Admin http server port
-cert.path='': path to SSL certificate
-doc.root='': File serving directory/namespace for classpath resources
-help='false': Show this help
-http.announce='java.lang.String': Address for announcing HTTP server
-http.name='http': Http server name
-http.port=':8080': External HTTP server port
-http.response.charset.enabled='true': Return HTTP Response Content-Type UTF-8 Charset
-https.announce='java.lang.String': Address for announcing HTTPS server
-https.name='https': Https server name
-https.port='': HTTPs Port
-key.path='': path to SSL key
-local.doc.root='': File serving directory for local development
-log.append='true': If true, appends to existing logfile. Otherwise, file is truncated.
-log.async='true': Log asynchronously
-log.async.inferClassNames='false': Infer class and method names synchronously. See com.twitter.logging.QueueingHandler
-log.async.maxsize='4096': Max queue size for async logging
-log.level='INFO': Log level
-log.output='/dev/stderr': Output file
-log.rollPolicy='Never': When or how frequently to roll the logfile. See com.twitter.logging.Policy#parse documentation for DSL details.
-log.rotateCount='-1': How many rotated logfiles to keep around
-maxRequestSize='5242880.bytes': HTTP(s) Max Request Size
-mustache.templates.dir='templates': templates resource directory
-shutdown.time='1.minutes': Maximum amount of time to wait for pending requests to complete on shutdown
-thrift.announce='java.lang.String': Address for announcing Thrift server
-thrift.name='thrift': Thrift server name
-thrift.port=':9999': External Thrift server port
-thrift.shutdown.time='1.minutes': Maximum amount of time to wait for pending requests to complete on shutdown
我已经传递了-maxRequestSize=10.megabytes
,并且可以在/admin/registry.json
文档中看到该值:maxRequestSize: "10485760.bytes"
,但是我仍然 看到{{1} }与5兆字节的值。如何增加最大尺寸?
答案 0 :(得分:1)
也许在代码中它被覆盖了吗?
您可以通过编程方式完成
> override def configureHttpServer(server: Http.Server): Http.Server = {
> server.withAdmissionControl.concurrencyLimit(maxConcurrentRequests = 2000, maxWaiters = 0)
> .withResponseClassifier(HttpResponseClassifier.ServerErrorsAsFailures)
> .withMaxRequestSize(StorageUnit.fromMegabytes(200))
> .withRequestTimeout(50.seconds) }