0

我看到 TooLongMessageException HTTP content length exceeded 5242880 bytes.我的 finatra 服务器抛出异常。查看通过 可用的标志-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"但我仍然看到TooLongMessageException5 兆字节的值。如何增加这个最大尺寸?

4

1 回答 1

0

也许在代码中它被覆盖了?

您可以以编程方式进行

> 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)   }
于 2019-08-14T09:50:34.833 回答