播放框架2.6 max-uri-length

时间:2018-04-08 20:54:22

标签: playframework

我在我的应用程序2.6.6中收到此错误

MBean: kafka.streams:type=stream-metrics,thread.client-id=[threadId]
Attribute: process-rate

我已尝试在应用程序中插入此内容:

[info] c.MyController - URI length exceeds the configured limit of 2048 characters
[error] application - 

! @77gm5oe8k - Internal server error, for (GET) [/api/v1/retrieve] ->

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[JsonParseException: Unrecognized token 'URI': was expecting ('true', 'false' or 'null')
 at [Source: [B@6b37cd3a; line: 1, column: 5]]]
    at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:255)
    at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:182)
    at play.filters.cors.AbstractCORSPolicy$$anonfun$1.applyOrElse(AbstractCORSPolicy.scala:122)
    at play.filters.cors.AbstractCORSPolicy$$anonfun$1.applyOrElse(AbstractCORSPolicy.scala:120)
    at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:414)
    at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
    at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
    at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:68)
    at scala.concurrent.impl.Promise$DefaultPromise.$anonfun$tryComplete$1(Promise.scala:284)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'URI': was expecting ('true', 'false' or 'null')
 at [Source: [B@6b37cd3a; line: 1, column: 5]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3528)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2686)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:878)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:772)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3850)
    at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3772)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2115)
    at play.api.libs.json.jackson.JacksonJson$.parseJsValue(JacksonJson.scala:232)

因为如果我用这个命令打印全局配置:

akka.actor.http.parsing.max-uri-length=20480

我找到了这个配置:

play.Play.application.configuration.asMap().toString

如果我重新启动应用程序,在我更改conf并打印全局conf后,我发现了这种情况:

akka.actor.http.parsing.max-uri-length=2k

有人已经看到过这个问题吗? 感谢

1 个答案:

答案 0 :(得分:0)

通过查看akka-http的来源,正确的配置密钥似乎是:akka.http.parsing.max-uri-length